[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Did anyone mention "clutch"? :-) Oh, well, please close issue1367711 as a duplicate. __ Tracker <[EMAIL PROTECTED]> __ _

[issue2144] os.environ should inherit dict

2008-02-23 Thread Martin v. Löwis
Martin v. Löwis added the comment: I also disagree that UserDict is a clutch, and that inheriting from dict is in any way more modern or cleaner than inheriting from UserDict. Hence I'm rejecting this patch. To "appeal", please discuss on python-dev. -- resolution: -> rejected status:

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Let's get back on-topic. I assume you are recommending to close this issue by rejecting the patch. I disagree. The patch can be fixed to properly override all methods and a unit test can be added to guarantee that all dict methods are overridden. The

[issue2144] os.environ should inherit dict

2008-02-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Py3.0 updte: UserDict is going to survive into Py3.0 and will be moved into the collections module. DictMixin is replaced by the abstract base classes for mappings. I think the discussion here has grown far beyond the original bug report. I recommend th

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > The builtins make direct calls to their own internal methods. Raymond, I guess issue2067 escaped your review. :-) __ Tracker <[EMAIL PROTECTED]> __ __

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: First, if the new thread on dict behavior does not make sense, please see discussion at issue1367711 where it started. (My mistake following up here.) Second, the ability to subclass built-in type is such a great feature, that it is a shame that doing

[issue2144] os.environ should inherit dict

2008-02-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: The builtins make direct calls to their own internal methods. This has existed for a long time. It would be hard to change without crushing performance. Changing it violates Meyer's open-closed principle. And changing it also introduces weird, unexpected b

[issue2144] os.environ should inherit dict

2008-02-23 Thread Martin v. Löwis
Martin v. Löwis added the comment: > What was the rationale for this decision? To me it looks like a hold- > over from the time when dicts were not subclassable. > > I agree, this is a topic for python-ideas rather than bug-track, but if > you could point me to any prior discussions on this is

[issue2144] os.environ should inherit dict

2008-02-23 Thread Georg Brandl
Georg Brandl added the comment: > What was the rationale for this decision? To me it looks like a hold- > over from the time when dicts were not subclassable. I reckon it's faster this way, and you want basic datatypes like dict to be fast. __ Tracker <[EMAIL PR

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > dict doesn't dynamically bind any calls; to > properly replace the semantics of dict, you > have to implement *all* API. What was the rationale for this decision? To me it looks like a hold- over from the time when dicts were not subclassable. I agree,

[issue2144] os.environ should inherit dict

2008-02-23 Thread Benjamin Peterson
Benjamin Peterson added the comment: And another. Added file: http://bugs.python.org/file9525/environ-modern3.diff __ Tracker <[EMAIL PROTECTED]> __ ___

[issue2144] os.environ should inherit dict

2008-02-23 Thread Georg Brandl
Georg Brandl added the comment: See #1367711 for a discussion whether this is really the way to go. -- nosy: +georg.brandl __ Tracker <[EMAIL PROTECTED]> __ ___

[issue2144] os.environ should inherit dict

2008-02-23 Thread Benjamin Peterson
Benjamin Peterson added the comment: Here's a corrected version. -- keywords: +patch Added file: http://bugs.python.org/file9524/environ-modern2.diff __ Tracker <[EMAIL PROTECTED]> __

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Small comment on the patch: def clear(self): -for key in self.data.keys(): +for key in self.keys(): unsetenv(key) -del self.data[key] +

[issue2144] os.environ should inherit dict

2008-02-20 Thread Virgil Dupras
Virgil Dupras added the comment: The performance gain is rather good: hsoft-dev:python hsoft$ ./python.exe -m "timeit" -s "import os" "os.environ['HOME']" 100 loops, best of 3: 1.16 usec per loop hsoft-dev:python hsoft$ patch -p0 < environ-modern.diff patching file Lib/os.py hsoft-dev:pyth

[issue2144] os.environ should inherit dict

2008-02-20 Thread Benjamin Peterson
Benjamin Peterson added the comment: I know that it doesn't mention inheriting dict specifically, but you asked why, so I was referring to the Rationale: "Modernization options arise when new versions of Python add features that allow improved clarity or higher performance than previously availab

[issue2144] os.environ should inherit dict

2008-02-19 Thread Martin v. Löwis
Martin v. Löwis added the comment: Sorry, it still makes no sense. Up to r56113, PEP 290 doesn't seem to talk about UserDict, os.environ, or inheritance from new-style classes. What section are you specifically referring to? __ Tracker <[EMAIL PROTECTED]>

[issue2144] os.environ should inherit dict

2008-02-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: Forgive me. I meant 290. __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue2144] os.environ should inherit dict

2008-02-19 Thread Martin v. Löwis
Martin v. Löwis added the comment: I still must be missing something. There is no PEP 390, AFAICT. __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list

[issue2144] os.environ should inherit dict

2008-02-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: PEP 390. It's cleaner and faster. __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe:

[issue2144] os.environ should inherit dict

2008-02-19 Thread Martin v. Löwis
Martin v. Löwis added the comment: What's the rationale for this change? -- nosy: +loewis __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list

[issue2144] os.environ should inherit dict

2008-02-19 Thread Benjamin Peterson
New submission from Benjamin Peterson: This patch changes os.environ to inherit builtin dict rather than UserDict. -- files: environ-modern.diff messages: 62571 nosy: gutworth severity: normal status: open title: os.environ should inherit dict type: rfe versions: Python 2.6 Added file: h