[New-bugs-announce] [issue9855] Complex number slicing neither works nor causes an error on immediate use

Tom report at bugs.python.org
Tue Sep 14 18:50:23 CEST 2010


New submission from Tom <tom at littlemonster.co.uk>:

I hope the title of this makes sense. I've been out of things for a long time.

Going through the Python tutorial (http://docs.python.org/tutorial/introduction.html) I departed from the script to try something. It gave neither of the results I had thought it might.

    >>> (0+1j)*(0+1j).imag
    1j
    >>> (0+1j)*(0+1j).real
    0j
    >>> a=(0+1j)*(0+1j)
    >>> a.imag
    0.0
    >>> a.real
    -1.0
    >>> 

This being my first crack at this language, I may have missed something that is obvious to the more experienced.

In my naivety, I thought that slicing the result of a calculation should work - why not? It should have the same structure as that pointed to by a variable.

So I'll leave this for either somebody with the patience to put me straight or somebody to fix.

Cheers!

----------
messages: 116409
nosy: LittleMonster
priority: normal
severity: normal
status: open
title: Complex number slicing neither works nor causes an error on immediate use
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9855>
_______________________________________


More information about the New-bugs-announce mailing list