[Python-Dev] PEP-3121 and PyType_Copy

2008-08-17 Thread Paul Pogonyshev
Hi, In the mailing list archive I see a message that this PEP was implemented, dated June 10. However, while everything else PEP describes does seem to be in SVN, I cannot find PyType_Copy(). Is this function still planned for Python 3000, or are there any simple alternatives? Or are modules jus

Re: [Python-Dev] Py_CLEAR and assigning values

2008-08-05 Thread Paul Pogonyshev
Daniel Stutzbach wrote: > On Tue, Aug 5, 2008 at 3:38 PM, Paul Pogonyshev <[EMAIL PROTECTED]> wrote: > > > Py_CLEAR way: > > > >Py_CLEAR (self->x); > >/* But __del__ can now in principle trigger access to NULL. */ > >self->

[Python-Dev] Py_CLEAR and assigning values

2008-08-05 Thread Paul Pogonyshev
Hi, Sorry if this topic was discussed before, but I couldn't find. Py_CLEAR documentation explains why it is better than Py_DECREF and NULL assignment. However, I don't understand why there is no similar macro for the case you want to replace one object with another? I.e. 'naive' way:

Re: [Python-Dev] proposed attribute lookup optimization

2007-07-11 Thread Paul Pogonyshev
[I don't know why I didn't receive this mail, presumably spam filter at gmx.net sucks as always] Phillip J. Eby wrote: > At 08:23 PM 7/8/2007 +0300, Paul Pogonyshev wrote: > >I would like to propose an optimization (I think so, anyway) for the > >way

[Python-Dev] proposed attribute lookup optimization

2007-07-08 Thread Paul Pogonyshev
Hi, I would like to propose an optimization (I think so, anyway) for the way attributes are looked up. Currently, it is done like this: return value of attribute in instance.__dict__ if present for type in instance.__class__.__mro__: return value of attribute in type.

Re: [Python-Dev] concerns regarding callable() method

2007-04-08 Thread Paul Pogonyshev
Guido van Rossum wrote: > On 4/8/07, Paul Pogonyshev <[EMAIL PROTECTED]> wrote: > > Guido van Rossum wrote: > > > What if someone passes a callable that doesn't have the expected > > > signature? > > > > Well, I don't know a way to catch s

Re: [Python-Dev] concerns regarding callable() method

2007-04-08 Thread Paul Pogonyshev
Guido van Rossum wrote: > On 4/8/07, Paul Pogonyshev <[EMAIL PROTECTED]> wrote: > > Additionally consider something like > > > > something.set_callback (x) > > > > Assume that set_callback() wants to check if `x' is callable at > > all

[Python-Dev] concerns regarding callable() method

2007-04-08 Thread Paul Pogonyshev
Hi, I have seen in PEP 3100 that callable() function is planned to be removed in Python 3000 with this replacement: "just call the object and catch the exception???". For one, the object (if it is callable) can raise exception itself, so you need to somehow to differentiate between exception rais