__getitem__, __getslice__ question for python 2.2
Erik Max Francis
max at alcyone.com
Wed May 15 02:01:41 EDT 2002
Raymond Hettinger wrote:
> "logistix" <logstx at bellatlantic.net> wrote
>
> > Also, some people don't like to use isinstance, but I'm not sure how
> > else to
> > tell if you got an int.
>
> if x != int(x): print 'expected an integer'
This is a pretty poor test. Consider the cases where x is 'a', or when
it is 2.0.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Who'd ever think it / Such a squalid little ending
\__/ The American and Florence, _Chess_
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list
mailing list