Postfix/Prefix Operators (++,--)
John Roth
johnroth at ameritech.net
Sat Jun 7 07:02:12 EDT 2003
More information about the Python-list mailing list
Sat Jun 7 07:02:12 EDT 2003
- Previous message (by thread): Postfix/Prefix Operators (++,--)
- Next message (by thread): Postfix/Prefix Operators (++,--)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Peter Hansen" <peter at engcorp.com> wrote in message news:3EE149EF.73C7373F at engcorp.com... > John Roth wrote: > > > > "Peter Hansen" <peter at engcorp.com> wrote in message > > news:3EE0D19C.7D7FFCA0 at engcorp.com... > > > Joshua Marshall wrote: > > > > >>> c = 1 > > > > >>> a = c++ > > > > >>> a > > > > 1 > > > > >>> c > > > > 2 > > > > > > Except that that violates a fundamental aspect of Python, which while > > > I can't describe it in the best technical terms as I don't ever work > > > at the compiler level, could be said as "you are rebinding a name (c) > > > without using an assignment statement". > > > > Well, let's see. The "def", "class" and "import" statements all (re)bind > > names. So do several of the builtin functions (setattr() comes to mind > > immediately.) > > I figured my inability to use the proper technical terms would cause > trouble. I think Joshua has the best perspective: the fundamental > aspect of Python which is being violated here is that of not rebinding > things in an expression. The examples you give are not expressions so > I think they still fit in the Python mould. I'll comment on Joshua's > exception in a response to his message... But setattr() is used in expressions! However, I agree with you in general, setattr() is an exceptional case. John Roth > > -Peter
- Previous message (by thread): Postfix/Prefix Operators (++,--)
- Next message (by thread): Postfix/Prefix Operators (++,--)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list