static method is better than new builtin function, agree.

On Wed, Dec 26, 2012 at 12:03 AM, Benjamin Peterson <benja...@python.org> wrote:
> 2012/12/25 Andrew Svetlov <andrew.svet...@gmail.com>:
>> Currently we have exception tree of classes inherited from OSError
>> When we use C API we can call PyErr_SetFromErrno and
>> PyErr_SetFromErrnoWithFilename[Object] functions.
>> This ones raise concrete exception class (FileNotFoundError for
>> example) looking on implicit errno value.
>> I cannot see the way to do it from python.
>>
>> Maybe adding builtin like exception_from_errno(errno, filename=None)
>> make some value?
>> Function returns exception instance, concrete class depends of errno value
>
> I think a static method on OSError like .from_errno would be good.
>
>
> --
> Regards,
> Benjamin



-- 
Thanks,
Andrew Svetlov
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to