does lack of type declarations make Python unsafe?
David Abrahams
david.abrahams at rcn.com
Sun Jun 29 19:13:09 EDT 2003
david.abrahams at rcn.com (David Abrahams) wrote in message news:<ea97dfd9.0306290730.137c6837 at posting.google.com>...
> Alex Martelli <aleax at aleax.it> writes:
>
> > In Python one generally identifies (just as informally) a container as
> > "an object which has a length" (using "length", perhaps a suboptimal
> > choice of wording, to mean "number of items currently contained") and
> > simultaneously express both 'c is a container' and
> > 'that container is not empty' by
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sorry, I missed that.
> >
> > assert len(c)
>
> That understanding of "containerness" is, AFAICT, not universally held
> among Pythonistas by any means.
I still stand by the above.
> Good thing too, probably: it looks
> like there is no such thing as an empty container:
>
> >>> assert len([])
> Traceback ...
But that example was obviously just wrong.
-Ddave
More information about the Python-list
mailing list