ways to declare empty set variable
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Feb 12 19:02:02 EST 2008
Steve Holden <steve at holdenweb.com> writes:
> Ben Finney wrote:
> [...]
> >
> > Note that '()' is syntactically null. Parentheses don't declare a
> > tuple literal, commas do. Parentheses are for grouping within
> > expressions, not specifying type.
> >
> Tell that to the interpreter:
>
> >>> type(())
> <type 'tuple'>
> >>> tuple() is ()
> True
> >>>
Well, knock me down with a kipper.
That makes it even more a violation of principle-of-least-astonishment
that the '(foo)' form doesn't give a one-element tuple literal.
--
\ "If consumers even know there's a DRM, what it is, and how it |
`\ works, we've already failed." —Peter Lee, Disney corporation, |
_o__) 2005 |
Ben Finney
More information about the Python-list
mailing list