Python bug: Can assign [] = (), but not () = []
bugs.python.org
Python bug: Can assign [] = (), but not () = []
1–10 of 53 posts
Re: Python bug: Can assign [] = (), but not () = []
#2Re: Python bug: Can assign [] = (), but not () = []
#3Re: Python bug: Can assign [] = (), but not () = []
#4[deleted]
a) did you even read the link b) what does your statement even mean? note that (a,b,c) = (1,2,3) works perfectly.
Re: Python bug: Can assign [] = (), but not () = []
#5Re: Python bug: Can assign [] = (), but not () = []
#6 >>> 'x'*3.5
Traceback (most recent call last):
File "", line 1, in
TypeError: can't multiply sequence by non-int of type 'float'
>>> import numpy as np
>>> print 'x'*np.float64(3.5)
xxxRe: Python bug: Can assign [] = (), but not () = []
#7This is a fun numpy quirk: >>> 'x'*3.5 Traceback (most recent call last): File " ", line 1, in TypeError: can't multiply sequence by non-int of type 'float' >>> import numpy as np >>> print 'x'*np.float64(3.5) xxx
Is this behavior because numpy overloads the multiplication operation with a string as string repetition and then implicitly casts the float64 down to an integer of 3? I'm curious why this behavior manifests. When I get a chance I'll test 'xyz'*np.float(3.5)
Re: Python bug: Can assign [] = (), but not () = []
#8This is a fun numpy quirk: >>> 'x'*3.5 Traceback (most recent call last): File " ", line 1, in TypeError: can't multiply sequence by non-int of type 'float' >>> import numpy as np >>> print 'x'*np.float64(3.5) xxx
Re: Python bug: Can assign [] = (), but not () = []
#9This is a fun numpy quirk: >>> 'x'*3.5 Traceback (most recent call last): File " ", line 1, in TypeError: can't multiply sequence by non-int of type 'float' >>> import numpy as np >>> print 'x'*np.float64(3.5) xxx
As an occasional numpy contributor, I would call this a bug.
Re: Python bug: Can assign [] = (), but not () = []
#10 >>> True = False
>>> False = True