Newbie: Object assignment return value

Dean Goodmanson ponderor at lycos.com
Thu Feb 14 13:51:40 EST 2002


(I think) I'm trying to understand if object assignment has a return value.

Scenario A:
>>> str( spam= 5 )
''
>>> str((spam=5))
  File "<stdin>", line 1
    str((spam=5))
            ^
SyntaxError: invalid syntax
>>> #  continued : Scenario B:
>>> print spam
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'spam' is not defined

A: Why does including an extra set of paranthesis throw when the original doesn't?

B: What happend to my spam?
Espcially when this works:
>>> str(int())
'0'
>>> str((int()))
'0'
>>>

Wishin'-I-had-something-practical-for-an-example,

Dean



More information about the Python-list mailing list