[Python-Dev] Add os.path.resolve to simplify the use of os.readlink

Nick Coghlan ncoghlan at gmail.com
Thu Jun 21 16:12:20 CEST 2012


On Thu, Jun 21, 2012 at 11:16 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On 2012年6月21日 15:04:17 +0200
> Christian Heimes <lists at cheimes.de> wrote:
>>>> How about adding keyword support to OSError and derive the strerror from
>> errno if the second argument is not given?
>> That's not the original behaviour:
>> Python 3.2.2+ (3.2:9ef20fbd340f, Oct 15 2011, 21:22:07)
> [GCC 4.5.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> e = OSError(5)
>>>> e.errno
>>>> e.strerror
>>>> str(e)
> '5'
>>> I don't mind making this particular compatibility-breaking change,
> though.

+1 from me. Existing code that just passes errno will now get strerror
set automatically, and existing code *can't* just be passing the errno
and filename, since OSError doesn't yet support keyword arguments.
Cheers,
Nick.
-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /