[issue9732] Addition of getattr_static for inspect module

2010-11-20 Thread Michael Foord
Michael Foord added the comment: Committed revision 86566. -- resolution: -> accepted stage: -> committed/rejected status: open -> closed ___ Python tracker ___ ___

[issue9732] Addition of getattr_static for inspect module

2010-11-20 Thread Nick Coghlan
Changes by Nick Coghlan : -- versions: +Python 3.2 -Python 2.5 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue9732] Addition of getattr_static for inspect module

2010-11-20 Thread Michael Foord
Changes by Michael Foord : -- versions: +Python 2.5 -Python 3.2 Added file: http://bugs.python.org/file19673/getattr_static.patch ___ Python tracker ___ __

[issue9732] Addition of getattr_static for inspect module

2010-11-20 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file19669/getattr_static.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue9732] Addition of getattr_static for inspect module

2010-11-20 Thread Michael Foord
Michael Foord added the comment: Reworked as a patch, including documentation and NEWS update. -- keywords: +patch Added file: http://bugs.python.org/file19669/getattr_static.patch ___ Python tracker __

[issue9732] Addition of getattr_static for inspect module

2010-11-04 Thread Michael Foord
Changes by Michael Foord : Added file: http://bugs.python.org/file19490/test_static.py ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue9732] Addition of getattr_static for inspect module

2010-11-04 Thread Michael Foord
Michael Foord added the comment: Further updated implementation. Now handles data descriptors correctly but removes the code that resolves the builtin descriptors (calling __get__ on slot and attribute descriptors). As it was resolving some descriptors but not all, and resolving getset descr

[issue9732] Addition of getattr_static for inspect module

2010-11-04 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file19484/test_static.py ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue9732] Addition of getattr_static for inspect module

2010-11-04 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file19483/static.py ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue9732] Addition of getattr_static for inspect module

2010-11-03 Thread Michael Foord
Changes by Michael Foord : Added file: http://bugs.python.org/file19484/test_static.py ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue9732] Addition of getattr_static for inspect module

2010-11-03 Thread Michael Foord
Michael Foord added the comment: Updated implementation that handles instances with inherited __slots__ members and attributes from C descriptors correctly. I think is both "good enough" and useful enough to add to inspect. (The remaining constraints are rare or pathological.) -- Add

[issue9732] Addition of getattr_static for inspect module

2010-11-03 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file18701/test_static.py ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue9732] Addition of getattr_static for inspect module

2010-11-03 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file18699/static.py ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue9732] Addition of getattr_static for inspect module

2010-09-04 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue9732] Addition of getattr_static for inspect module

2010-09-04 Thread Andreas Stührk
Changes by Andreas Stührk : -- nosy: +Trundle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Guido van Rossum
Guido van Rossum added the comment: > Since the addition of __dir__, dir(obj) can return arbitrary values. > Typically (I guess) this will be used to add dynamically created attributes > that this function will fail to find - so it is *more* likely that we will > fail to find something in dir

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Michael Foord added the comment: (Or vice versa - getattr_static may succeed in finding members - like descriptors that raise AttributeError when fetched - when getattr fails.) -- ___ Python tracker __

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Michael Foord added the comment: Since the addition of __dir__, dir(obj) can return arbitrary values. Typically (I guess) this will be used to add dynamically created attributes that this function will fail to find - so it is *more* likely that we will fail to find something in dir than the r

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Guido van Rossum
Guido van Rossum added the comment: Just jumping in here with commentary from the side bench... I noticed you say "this does not always return the same results as dir(x)". But since dir(x) exists, perhaps it would make sense to match dir(x) as closely as possible? I.e. if dir(x) doesn't know

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Michael Foord added the comment: (Reposted as text was entirely duplicated - oops.) As discussed on python-dev, a version of getattr that does static lookups - bypassing the descriptor protocol, __getattr__, and __getattribute__. Initial implementation by Nick Coghlan, amended and tests added

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Changes by Michael Foord : -- Removed message: http://bugs.python.org/msg115296 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: +1 on the principle. This could help things like pydoc, especially on modern Web frameworks which do incredibly ugly things (per-thread global variables, descriptors executing tons of code etc.). -- nosy: +pitrou _

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Michael Foord added the comment: Tests require Python 3. Implementation works with Python 2 as well. -- Added file: http://bugs.python.org/file18701/test_static.py ___ Python tracker ___

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Changes by Michael Foord : -- Removed message: http://bugs.python.org/msg115297 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Changes by Michael Foord : Removed file: http://bugs.python.org/file18700/test_static.py ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
Michael Foord added the comment: Tests require Python 3. Implementation works with Python 2 as well. -- Added file: http://bugs.python.org/file18700/test_static.py ___ Python tracker ___

[issue9732] Addition of getattr_static for inspect module

2010-09-01 Thread Michael Foord
New submission from Michael Foord : As discussed on python-dev, a version of getattr that does static lookups - bypassing the descriptor protocol, __getattr__, and __getattribute__. Initial implementation by Nick Coghlan, amended and tests added by me. Phillip Eby objects to this code existing