Thanks for the elaboration!
On Wed, Dec 26, 2012 at 6:42 PM, Antoine Pitrou wrote:
> On Wed, 26 Dec 2012 13:37:13 +0200
> Andrew Svetlov wrote:
>> >
>> > As Serhiy's example shows, this mapping of error numbers to subclasses
>> > is implemented directly in OSError.__new__. We did this so that co
On Wed, 26 Dec 2012 13:37:13 +0200
Andrew Svetlov wrote:
> >
> > As Serhiy's example shows, this mapping of error numbers to subclasses
> > is implemented directly in OSError.__new__. We did this so that code
> > could catch the new exceptions, even when dealing with old code that
> > raises the l
It sould be in Python-Ideas: add keyword argument support for OSError
and subclasses with suitable default values. I.e.
>>> OSError(errno=errno.ENOENT)
FileNotFoundError(2, 'No such file or directory')
>>> FileNotFoundError(filename='qwerty')
FileNotFoundError(2, 'No such file or directory')
>>>
On Wed, Dec 26, 2012 at 12:16 PM, Nick Coghlan wrote:
> On Wed, Dec 26, 2012 at 6:50 PM, Serhiy Storchaka wrote:
>> On 25.12.12 23:55, Andrew Svetlov wrote:
>>>
>>> Currently we have exception tree of classes inherited from OSError
>>> When we use C API we can call PyErr_SetFromErrno and
>>> PyEr
On Wed, Dec 26, 2012 at 6:50 PM, Serhiy Storchaka wrote:
> On 25.12.12 23:55, Andrew Svetlov wrote:
>>
>> 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 rai
On 25.12.12 23:55, Andrew Svetlov wrote:
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 im
static method is better than new builtin function, agree.
On Wed, Dec 26, 2012 at 12:03 AM, Benjamin Peterson wrote:
> 2012/12/25 Andrew Svetlov :
>> Currently we have exception tree of classes inherited from OSError
>> When we use C API we can call PyErr_SetFromErrno and
>> PyErr_SetFromErrnoWit
2012/12/25 Andrew Svetlov :
> 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 implici