msg57870 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-27 11:18 |
Todo:
im_self -> __self__
im_func -> __func__
im_class -> __self__.__class__
instancemethod(func, self, cls) -> instancemethod(func, self)
|
msg57874 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-27 18:02 |
Crys, why don't you give it a try yourself? It's quite easy to write
such a simple substitution.
|
msg57880 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-27 19:15 |
Added fix_methodattrs with an unit test in r59196. Can you check it please.
By the way how do you know my IRC nick? Are you lurking in #python? :)
|
msg57882 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-27 20:15 |
It works, though the "__self__.__class__" substitution is technically
wrong -- it creates a single NAME node whose contents is that string,
while in the parse tree it should really be three tokens. But as it
works, I wouldn't worry about it.
I saw you sign a bug with 'Crys' once and I believe you mentioned it in
your intro to python-dev. :-)
|
msg57884 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-27 20:27 |
You are too fast. I haven't written a fixer for new.instancemethod yet.
Do we need one?
|
msg57885 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-27 20:36 |
A fixer for new.instancemethod would be nice, though I doubt that there
will be many uses. We could also go a different way: since new.py has a
comment stating it is deprecated (in 2.5 already), perhaps we should
just kill in in 3.0 and add an explicit 3.0 warning to it in 2.6. (This
is really part of the library reorg, but we might as well take care of
it now rather than making a temporary change to it.)
|
msg57886 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-27 21:14 |
How should I issue a warning in the new module? Should and can I check
for the -3 warning option or should I warn w/o checks for the -3 option?
from warnings import warn as _warn
_warn("The 'new' module is not supported in 3.x",
DeprecationWarning, 2)
|
msg57889 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-27 22:21 |
There's C code like this:
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"apply() not supported in 3.x") < 0)
return NULL;
I don't know how to check for that flag in Python though -- we should
really export all flags via the sys module...
|
msg57896 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-27 23:17 |
Guido van Rossum wrote:
> Guido van Rossum added the comment:
>
> There's C code like this:
>
> if (Py_Py3kWarningFlag &&
> PyErr_Warn(PyExc_DeprecationWarning,
> "apply() not supported in 3.x") < 0)
> return NULL;
>
> I don't know how to check for that flag in Python though -- we should
> really export all flags via the sys module...
I've exposed the flag in r59204 as sys.py3kwarning. I've also added a
method warnings.warnpy3k().
Christian
|
msg57998 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-30 19:19 |
Does this still need to remain open?
|
msg58001 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-30 20:23 |
Some cases aren't covered by the fixer. I'm not sure if we need fixers
for two cases:
Python 2.x:
Cls.method = types.MethodType(function, None, Cls)
Python 3.0:
Cls.method = function
Python 2.x:
instance.method = types.MethodType(function, instance, instance.__class__)
Python 3.0:
instance.method = types.MethodType(function, instance)
|
msg58005 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-30 20:44 |
Aren't there equivalent ways to spell those with the "new" module? How
about a fixer for that code (which may be easier to write)?
|
msg58012 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-30 21:18 |
The 'new' module is already gone. I've ripped it out a couple of days
ago and added deprecation warnings in 2.6
|
msg58013 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-30 21:29 |
Exactly. I'm proposing that we don't bother with people who call
types.MethodType(), but we *do* bother converting code that calls
new.method().
|
msg58021 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-30 22:44 |
Whatever you say. But shouldn't we make people to use types.MethodType()
or whatever we use as the new module for PyMethod_Type()? People are
going to use types.MethodType() when they see the deprecation warning.
By the way I've updated the docs in r59248.
|
msg58023 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-30 22:51 |
> Whatever you say. But shouldn't we make people to use types.MethodType()
> or whatever we use as the new module for PyMethod_Type()? People are
> going to use types.MethodType() when they see the deprecation warning.
Well, if new.method is deprecated, then types.MethodType should be
doubly deprecated. The types module was only ever intended for type
checking, not for creating new instances.
The correct solution will be to use whatever we end up deciding about
pyvm. Certainly the types module will go.
Maybe new in 2.6 should be a -3 deprecation only?
|
msg58027 - (view) |
Author: Christian Heimes (christian.heimes) * |
Date: 2007-11-30 23:14 |
The deprecation warning in 'new' is a -3 warning. I've added a new
method warning.warnpy3k for the job.
You are right about the rest. Can you start a discussion on the list?
The last time I tried to kick off a poll it ended up a lots of bad jokes. :(
|
msg58031 - (view) |
Author: Guido van Rossum (gvanrossum) * |
Date: 2007-11-30 23:28 |
> You are right about the rest. Can you start a discussion on the list?
Well the only question is where to put these symbols, right? I guess I
still like putting them in sys best, for the ones that don't fit in
collections.
> The last time I tried to kick off a poll it ended up a lots of bad jokes. :(
Naming contests *always* end in bad jokes. :-) Some of the jokes were
kind of cute. I got a laughing fit over the naming rights suggestion.
|
msg71746 - (view) |
Author: Benjamin Peterson (benjamin.peterson) * |
Date: 2008-08-22 13:18 |
Must this still be open?
|
msg116793 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-09-18 15:15 |
No reply to msg71746.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:28 | admin | set | github: 45845 |
2010-09-18 15:15:23 | BreamoreBoy | set | status: open -> closed nosy:
+ BreamoreBoy messages:
+ msg116793
|
2008-08-22 13:18:15 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages:
+ msg71746 |
2008-01-06 22:29:44 | admin | set | keywords:
- py3k versions:
Python 3.0 |
2007-11-30 23:28:39 | gvanrossum | set | messages:
+ msg58031 |
2007-11-30 23:14:48 | christian.heimes | set | messages:
+ msg58027 |
2007-11-30 22:51:12 | gvanrossum | set | messages:
+ msg58023 |
2007-11-30 22:44:59 | christian.heimes | set | messages:
+ msg58021 |
2007-11-30 21:29:08 | gvanrossum | set | messages:
+ msg58013 |
2007-11-30 21:18:36 | christian.heimes | set | messages:
+ msg58012 |
2007-11-30 20:44:29 | gvanrossum | set | messages:
+ msg58005 |
2007-11-30 20:23:29 | christian.heimes | set | messages:
+ msg58001 |
2007-11-30 19:19:21 | gvanrossum | set | priority: normal messages:
+ msg57998 |
2007-11-27 23:17:56 | christian.heimes | set | messages:
+ msg57896 |
2007-11-27 22:21:26 | gvanrossum | set | messages:
+ msg57889 |
2007-11-27 21:14:25 | christian.heimes | set | messages:
+ msg57886 |
2007-11-27 20:36:55 | gvanrossum | set | messages:
+ msg57885 |
2007-11-27 20:27:48 | christian.heimes | set | status: closed -> open messages:
+ msg57884 |
2007-11-27 20:15:11 | gvanrossum | set | status: open -> closed resolution: accepted messages:
+ msg57882 |
2007-11-27 19:15:48 | christian.heimes | set | messages:
+ msg57880 |
2007-11-27 18:02:43 | gvanrossum | set | nosy:
+ gvanrossum messages:
+ msg57874 |
2007-11-27 11:18:41 | christian.heimes | create | |