nested exceptions?

holger krekel pyth at devel.trillke.net
Sun Apr 21 10:19:17 EDT 2002


On Sun, Apr 21, 2002 at 03:57:10PM +0200, Just van Rossum wrote:
> In article <a9ufpv$6hb$1 at panix1.panix.com>, aahz at pythoncraft.com (Aahz) 
> wrote:
> 
> > ...and if you're using Python 2.2, write it as
> > 
> >     while oid not in objects:
> > 
> > 
> > Hmmmm....  it occurs to me that those of us teaching Python will need to
> > be *very* careful in making sure that people avoid 'in' over lists.
> 
> I'm already happy if they don't do
> 
>   if x in d.keys(): ...
>
> :-)


but that's better than:

    for key in d.keys():
    	if key==x:
		....

:-)

anyone worse-case (realistic) suggestions?

  holger





More information about the Python-list mailing list