Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Paul Wise
On Tue, Aug 3, 2010 at 10:50 PM, Tristan Seligmann wrote: > How would you implement the warning? There's no way to easily tell > whether a given name is an existing class name or not. Using whatever method Jakub used to create his list, if it is implementable in perl that is. Actually, is there

Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Tristan Seligmann
On Tue, Aug 3, 2010 at 11:47 PM, Paul Wise wrote: > 2010/8/3 Jakub Wilk : >> You might be easily mislead into thinking that this code > ... >> will catch both IOError and OSError exceptions. In fact, it will not, as it >> is more or less equivalent to: > ... >> There are about 50 packages in the a

Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Paul Wise
2010/8/3 Jakub Wilk : > You might be easily mislead into thinking that this code ... > will catch both IOError and OSError exceptions. In fact, it will not, as it > is more or less equivalent to: ... > There are about 50 packages in the archive whose developers make this kind > of mistake. I have a

Re: Packages whith “except” overwriting builtins

2010-08-03 Thread Sandro Tosi
Hi Jakub, 2010/8/3 Jakub Wilk : > You might be easily mislead into thinking that this code > >   try: >      eggs() >   except IOError, OSError: >      pass > > will catch both IOError and OSError exceptions. In fact, it will not, as it > is more or less equivalent to: > >   try: >      eggs() >  

Re: Packages whith “except ” overwriting builtins

2010-08-03 Thread Yaroslav Halchenko
Thank you Jakub! I believe that quick resolution which could be recommended is instead of >except IOError, OSError: having then grouped in a tuple >except (IOError, OSError): -- .-. =-- /v\ = Kee

Packages whith “except ” overwriting builtins

2010-08-03 Thread Jakub Wilk
You might be easily mislead into thinking that this code try: eggs() except IOError, OSError: pass will catch both IOError and OSError exceptions. In fact, it will not, as it is more or less equivalent to: try: eggs() except IOError, ex: OSError = ex # Who

Python packages hardcoding errno values

2010-08-03 Thread Jakub Wilk
There are ca 70 packages in the archive that does things like: try: eggs() except OSError, e: if e.errno == 17: ham() This is wrong, because according to POSIX[0], “only […] symbolic names should be used in programs, since the actual value of the error number is unspec