On Wed, Mar 19, 2014 at 4:53 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> On Wed, Mar 19, 2014 at 4:09 AM, Marko Rauhamaa wrote:
>>> So complex(a, b) is documented to produce a+bj when a and b are integers
>>> or floats. What's more natural than saying it produces a+bj when a and b
>>> are comple
On Wed, Mar 19, 2014 at 5:04 AM, Skip Montanaro wrote:
> On Wed, Mar 19, 2014 at 5:33 AM, Ian Kelly wrote:
>> When is it ever useful though?
>
> About as often as int(0), float(0), or float(0.0) which all work as
> expected, though probably don't turn up in a lot of code.
The analogous call to t
Le mercredi 19 mars 2014 12:04:06 UTC+1, Skip Montanaro a écrit :
> On Wed, Mar 19, 2014 at 5:33 AM, Ian Kelly wrote:
>
> > When is it ever useful though?
>
>
>
> About as often as int(0), float(0), or float(0.0) which all work as
>
> expected, though probably don't turn up in a lot of code.
On Wed, Mar 19, 2014 at 5:33 AM, Ian Kelly wrote:
> When is it ever useful though?
About as often as int(0), float(0), or float(0.0) which all work as
expected, though probably don't turn up in a lot of code.
Skip
--
https://mail.python.org/mailman/listinfo/python-list
Ian Kelly :
> On Wed, Mar 19, 2014 at 4:09 AM, Marko Rauhamaa wrote:
>> So complex(a, b) is documented to produce a+bj when a and b are integers
>> or floats. What's more natural than saying it produces a+bj when a and b
>> are complex numbers? It's a straightforward generalization that in no
>>
On Wed, Mar 19, 2014 at 4:09 AM, Marko Rauhamaa wrote:
> wxjmfa...@gmail.com:
>
>> Le mercredi 19 mars 2014 09:51:20 UTC+1, Marko Rauhamaa a écrit :
>>> wxjmfa...@gmail.com:
>>> complex(2, 1+1j)
>>> > (1+1j)
>>>
>>> I find it neat, actually.
>>
> # tricky: yes, neat: no
> complex(1+1j
wxjmfa...@gmail.com:
> Le mercredi 19 mars 2014 09:51:20 UTC+1, Marko Rauhamaa a écrit :
>> wxjmfa...@gmail.com:
>> complex(2, 1+1j)
>> > (1+1j)
>>
>> I find it neat, actually.
>
# tricky: yes, neat: no
complex(1+1j, 2)
> (1+3j)
So complex(a, b) is documented to produce a+bj when
Le mercredi 19 mars 2014 09:51:20 UTC+1, Marko Rauhamaa a écrit :
> wxjmfa...@gmail.com:
>
>
>
> > This is, in my mind, more questionable:
>
> >
>
> complex(2, 1+1j)
>
> > (1+1j)
>
>
>
> I find it neat, actually.
>
>
>
>
>
> Marko
>>> # tricky: yes, neat: no
>>> complex(1+1j, 2)
wxjmfa...@gmail.com:
> This is, in my mind, more questionable:
>
complex(2, 1+1j)
> (1+1j)
I find it neat, actually.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
z = a + b*i with a, b, elements of R
z = r*exp(i*phi)with r, phi, elements of R
z = [[a, -b], [b, a]] with a, b, elements of R
This is, in my mind, more questionable:
>>> complex(2, 1+1j)
(1+1j)
>>>
>>> print(complex.__doc__)
complex(real[, imag]) -> complex number
Create a complex n
On 3/17/14 11:52 PM, Steven D'Aprano wrote:
On Mon, 17 Mar 2014 11:18:56 -0500, Mark H Harris wrote:
Who knows, beats me.
With respect, that's just because you would make a lousy language
designer :-)
Ouch;-)
"How should one spell a complex number?" There is perfectly good syntax
Christian Gollwitzer :
> The same problem arises with unary minus, but it's less annoying
> because -(a*b) = (-a)*b.
>>> -1**2
-1
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Hi Steven,
Am 18.03.14 09:00, schrieb Steven D'Aprano:
On Tue, 18 Mar 2014 08:04:44 +0100, Christian Gollwitzer wrote:
Am 15.03.14 17:26, schrieb Jayanth Koushik:
This is regarding the inbuilt 'complex' function. The python docs say:
"Note: When converting from a string, the string must not c
On Tue, 18 Mar 2014 08:04:44 +0100, Christian Gollwitzer wrote:
> Am 15.03.14 17:26, schrieb Jayanth Koushik:
>> This is regarding the inbuilt 'complex' function. The python docs say:
>> "Note: When converting from a string, the string must not contain
>> whitespace around the central + or - opera
On Tue, Mar 18, 2014 at 6:04 PM, Christian Gollwitzer wrote:
> As others have explained, the basic issue is the question how to parse an
> expression like
>
> 1+2i*3
>
> is it "complex(1+2i) times 3" or is it sum of 1 and product of complex 2i
> and 3?
The only way to have it be the forme
Am 15.03.14 17:26, schrieb Jayanth Koushik:
This is regarding the inbuilt 'complex' function. The python docs
say: "Note: When converting from a string, the string must not
contain whitespace around the central + or - operator. For example,
complex('1+2j') is fine, but complex('1 + 2j') raises Va
On Tue, Mar 18, 2014 at 3:52 PM, Steven D'Aprano wrote:
> The first is a valid identifier, the second is a syntax error. Oh
> somebody please tell me it's not a valid C expression! *wink*
It's not a valid C expression.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 17 Mar 2014 11:18:56 -0500, Mark H Harris wrote:
> How should one spell a complex number? Should we use i or j ? Should the
> imaginary part be set off somehow? Should literals be parsed
> differently (or consistently) with correctly formed strings? Who knows,
> beats me.
With respect,
On Mon, 17 Mar 2014 21:22:18 +0200, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa
>> wrote:
>>> Is "-2.0" a literal?
>>>
>>> What's the outcome of
>>>
>>>-2.0.__str__()
>>
>> If you mean (-2.0).__str__(), then it returns '-2.0', but that proves
On Mon, Mar 17, 2014 at 7:16 PM, Chris Angelico wrote:
> On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro wrote:
>> Perhaps it's worth pointing out that pylint complains about most/many
>> infix operations if you don't surround the operator with white space.
>
> IMO that's excessive. Not every in
On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro wrote:
> Perhaps it's worth pointing out that pylint complains about most/many
> infix operations if you don't surround the operator with white space.
IMO that's excessive. Not every infix operator needs whitespace.
ChrisA
--
https://mail.python.
On Mon, Mar 17, 2014 at 5:06 PM, Terry Reedy wrote:
> Mathematicians genearally write both without spaces.
Mathematicians also have a tendency to use single letter variables and
often escape into non-ASCII character sets as well.
Perhaps it's worth pointing out that pylint complains about most/
On 3/17/2014 1:55 PM, Mark Dickinson wrote:
Jayanth Koushik gmail.com> writes:
"Note: When converting from a string, the string must not contain whitespace
around the central + or - operator. For example, complex('1+2j') is fine, but
complex('1 + 2j') raises ValueError."
Why is this so?
See
On Tue, Mar 18, 2014 at 6:22 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa wrote:
>>> Is "-2.0" a literal?
>>>
>>> What's the outcome of
>>>
>>>-2.0.__str__()
>>
>> If you mean (-2.0).__str__(), then it returns '-2.0', but that proves
>> not
Chris Angelico :
> On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa wrote:
>> Is "-2.0" a literal?
>>
>> What's the outcome of
>>
>>-2.0.__str__()
>
> If you mean (-2.0).__str__(), then it returns '-2.0', but that proves
> nothing.
The point is, you don't need to "philosophize" about complex
On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa wrote:
>>> This '3 + 2j' is not a number, its an algebraic sum.
>>>
>>> This '3+2j' is a complex number. Ok, maybe not, but its closer to what
>>> we expect (I'm sorry, but I like i instead of j )
>>
>>Hmm. That's a pretty tricky distinction.
>
> I
On Mon, Mar 17, 2014 at 12:15 PM, Marko Rauhamaa wrote:
> Is "-2.0" a literal?
>
> What's the outcome of
>
>-2.0.__str__()
No. The compiler will try to optimize it into a single constant if it
can, but it has to be done in accordance with the order of operations.
In that example, the __str_
On 3/17/14 12:03 PM, Chris Angelico wrote:
ast.dump(ast.parse("complex( 3 +2j )"))
"Module(body=[Expr(value=Call(func=Name(id='complex', ctx=Load()),
args=[BinOp(left=Num(n=3), op=Add(), right=Num(n=2j))], keywords=[],
starargs=None, kwargs=None))])"
The sole argument to complex() is an expr
Chris Angelico :
> On Tue, Mar 18, 2014 at 3:18 AM, Mark H Harris wrote:
>> Philosophically, I tend to think about it this way. A complex number
>> is like any other number. I would not form a PI string like this> ' 3
>> .14 1 5 9265 3 . . .' I would rather see it formed like so,
>> '3.1415926535
Jayanth Koushik gmail.com> writes:
> "Note: When converting from a string, the string must not contain whitespace
> around the central + or - operator. For example, complex('1+2j') is fine, but
> complex('1 + 2j') raises ValueError."
>
> Why is this so?
See http://bugs.python.org/issue9574 for
On Tue, Mar 18, 2014 at 3:18 AM, Mark H Harris wrote:
> You actually answered your own question, as you were asking it. If the doc
> says "whatever you do, don't push the purple button," well, leave the purple
> button alone. :) (I don't know, push it if you want)
https://www.wizards.com/m
On 3/15/14 11:26 AM, Jayanth Koushik wrote:
This is a very interesting philosophical question, one which I am
surprised no one has answered; although, I think the reason for that
might be entirely obvious.
You actually answered your own question, as you were asking it. If the
doc says "whate
Hi everyone!
This is regarding the inbuilt 'complex' function. The python docs say:
"Note: When converting from a string, the string must not contain whitespace
around the central + or - operator. For example, complex('1+2j') is fine, but
complex('1 + 2j') raises ValueError."
Why is this so? Wh
33 matches
Mail list logo