Raymond Hettinger added the comment:
I'll work on improving the docs to make this classmethod more discoverable in
docs, but the API is going to stay the same.
--
resolution: - rejected
___
Python tracker rep...@bugs.python.org
Changes by bruno Piguet bruno.pig...@gmail.com:
--
versions: +Python 3.2
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14984
___
___
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +giampaolo.rodola
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14984
___
___
Python-bugs-list
Roundup Robot added the comment:
New changeset fa1fa88b685b by Raymond Hettinger in branch 'default':
Issue 18752: Make chain.from_iterable() more visible in the documentation.
http://hg.python.org/cpython/rev/fa1fa88b685b
--
nosy: +python-dev
___
paul j3 added the comment:
At the very least the `is not action.default` needs to be changed. Else where
in argparse `is` is only used with `None` or constant like `SUPPRESS`. So
using it with a user defined parameter is definitely not a good idea.
Possible variations on how `is` behaves
Roundup Robot added the comment:
New changeset 0e05b07a6f84 by Ethan Furman in branch 'default':
Close #18980: Enum doc fixes. Patch from Elazar Gershuni.
http://hg.python.org/cpython/rev/0e05b07a6f84
--
nosy: +python-dev
resolution: - fixed
stage: - committed/rejected
status: open -
Roundup Robot added the comment:
New changeset 29fa1f418796 by Raymond Hettinger in branch '3.3':
Issue 18301: The classmethod decorator didn't fit well with the
rough-equivalent example code.
http://hg.python.org/cpython/rev/29fa1f418796
--
nosy: +python-dev
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18301
___
Roundup Robot added the comment:
New changeset 23f77dc58979 by Raymond Hettinger in branch '3.3':
Issue 18752: Make chain.from_iterable() more visible in the documentation.
http://hg.python.org/cpython/rev/23f77dc58979
--
___
Python tracker
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18752
___
___
Raymond Hettinger added the comment:
All of the proposed variants have their own issues.
For example, the keyword-argument variant behaves badly if the user leaves off
the keyword:
list(repeatfunc(ord, 'A', times=3))
[65, 65, 65]
list(repeatfunc(ord, 'A', 3))
Traceback (most
Raymond Hettinger added the comment:
This is a pretty interesting idea.
Ideally, it would be great if it could be a published as a recipe somewhere so
that people could experiment with the API and try out variations. If there
were good uptake by users, it would help justify a proposal to be
Antoine Pitrou added the comment:
So, even though __members__ does show up in dir(Color),
classify_class_attrs incorrectly assigns its class.
[...]
So if getmembers() correctly reports it because it shows up in dir(),
then classify_class_attrs should correctly identify it as well.
Ok,
Changes by Stefan Krah stefan-use...@bytereef.org:
--
nosy: +skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18606
___
___
Python-bugs-list
Nicola Palumbo added the comment:
Hi all,
I've fixed the infinite recursion in `reset_mock()`. It has been solved by
tracking a set of visited ids as suggested.
from unittest import mock
a = mock.mock_open()
a.reset_mock()
a
MagicMock name='open' spec='builtin_function_or_method'
New submission from Vajrasky Kok:
The attached patch fixed typos and improved the documentation to improve the
clarity in Modules/fcntlmodule.c.
Please see the attached patch and feel free to disagree with the improvement.
--
assignee: docs@python
components: Documentation
files:
New submission from Antoine Pitrou:
This is a very common need when implementing network protocols. You want to
match keys case-insensitively but also preserve the original casing (e.g. for
presentation).
When searching on the Web, you see many people reimplementing their own variant
(often
Changes by Thomas Heller thel...@ctypes.org:
--
nosy: +theller
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
___
___
Python-bugs-list
Matthew Barnett added the comment:
Surely a case-insensitive dict should use str.casefold, not str.lower?
--
nosy: +mrabarnett
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
___
Antoine Pitrou added the comment:
Surely a case-insensitive dict should use str.casefold, not
str.lower?
Perhaps. Network protocols will usually only allow ASCII in parts
where case is insensitive (e.g. header names), so it shouldn't make a
difference.
Implementing the generic pattern means
New submission from Sam Ferencik:
distutils.util.get_platform() semantically differs on (a) Windows and OS X, and
on (b) Linux.
Windows/OS X: the return value is derived from the architecture of the
*interpreter*, hence for 32-bit Python running on a 64-bit system,
get_platform() =
Antoine Pitrou added the comment:
For the record, I have my own implementation here:
https://bitbucket.org/optiflowsrd/obelus/src/tip/obelus/casedict.py?at=default
https://bitbucket.org/optiflowsrd/obelus/src/tip/obelus/test/test_casedict.py?at=default
--
New submission from Howitzer21:
In the IDLE program for Python 3.3.2, I've run across a situation where the tab
key is not working. I have attached a file that shows everything in IDLE's
console. At the very end of the file, you can see where I have typed in the
word queue in IDLE without
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
___
___
Python-bugs-list
Changes by Vlad Shcherbina vlad.shcherb...@gmail.com:
--
keywords: +patch
Added file: http://bugs.python.org/file31697/tempfile_collision_tests.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18945
R. David Murray added the comment:
For the record, email is not a good argument for this, since email could not
use this data structure (its data structure is *not* a dict, but a list with
dict-like features grafted on).
I do think this would be useful, and the generic version (analogous to
Stefan Behnel added the comment:
Looks like we missed the alpha2 release for the close() API fix. I recommend
not letting yet another deadline go by.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17741
Changes by Charles-François Natali cf.nat...@gmail.com:
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18934
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +kbk, roger.serwy, terry.reedy
versions: +Python 2.7, Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18988
___
Antoine Pitrou added the comment:
Ok, let's bikeshed this a bit. What should be the name?
- projectdict?
- normalizedict?
- normdict?
- derivedict?
- transformdict?
- any ideas?
--
___
Python tracker rep...@bugs.python.org
Ethan Furman added the comment:
I would say
- transformkeydict
Too bad we can't just add an extra 'transform_key' keyword to defaultdict.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Roger Serwy added the comment:
LGTM. I manually tested it by assigning a = 1 and then pressing tab at
after a, aa, aaa, and a, and then pressing tab afterwards. Tab
works to complete the name, and then afterwards when it has been replaced with
a.
--
Serhiy Storchaka added the comment:
I think this patch should fix the bug.
--
keywords: +patch
nosy: +serhiy.storchaka
stage: - patch review
Added file: http://bugs.python.org/file31698/idle_autocomplete_nochange.patch
___
Python tracker
New submission from Ethan Furman:
Consider:
==
--from enum import Enum
--class Color(Enum):
... red = 1
... green = 2
... blue = 3
... red = 4
...
Traceback (most recent call last):
File stdin, line 1,
Eric V. Smith added the comment:
It would be nice to combine the behaviors that defaultdict and the
case-insensitive comparisons.
--
nosy: +eric.smith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Eric V. Smith added the comment:
Just today I was using a defaultdict where the keys are stock symbols. They're
case insensitive (at least for this particular application).
In this case I just str.upper everything, but it would be a nice feature to
case-preserve the keys that I pre-populate.
Antoine Pitrou added the comment:
In this case I just str.upper everything, but it would be a nice
feature to case-preserve the keys that I pre-populate. I care less
about the keys from user data.
Well, stock symbols are what I would call user data :-)
--
Tim Peters added the comment:
Antoine, could I bother you to try the attached cleanup.patch? It looks
harmless to me, but when I checked it in the Unix-y buildbots failed the
thread+fork tests again :-( Two examples:
Antoine Pitrou added the comment:
Revised version of the patch: catches RuntimeError instead of
skipping the first frame; adds versionadded tag; adds entry to NEWS
and whatsnew files.
Looks good to me, thank you.
--
___
Python tracker
Eric V. Smith added the comment:
True enough!
I was trying to distinguish keys that I populate with initial values (mostly
stock indexes) versus those where I just read values from a user-supplied file.
When I populate the index values, I'd like to preserve the case I initially
used. When I
Antoine Pitrou added the comment:
It would be nice to combine the behaviors that defaultdict and the
case-insensitive comparisons.
Any use case? In my experience they are used in completely different
situations. defaultdict mostly to use the writing of some (internal)
algorithms, a
Serhiy Storchaka added the comment:
There is simpler test case. Just enter flo and press TAB. Twice.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18988
___
Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:
--
nosy: +jkloth
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18987
___
___
Ethan Furman added the comment:
To the point, however, Eric's example would make use of both the defaultdict
portion and the transformkey portion in a single dict.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Matthew Barnett added the comment:
mappeddict?
Re defaultdict, you could write a dict that does all of these things, called
superdict! :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Antoine Pitrou added the comment:
I suppose we can close this issue now?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18984
___
___
R. David Murray added the comment:
As I recall this was discussed at length and we decided that this was the
behavior we wanted. I could be wrong, of course; it was a long discussion.
--
nosy: +r.david.murray
___
Python tracker
R. David Murray added the comment:
coercekeydict
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
___
___
Python-bugs-list mailing list
Antoine Pitrou added the comment:
I would like to shorten the proposals to transformdict and coercedict.
(after all, transforming the values would have little sense: you can do it
yourself trivially)
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
FYI os.environ uses something similar: keys and values are encoded and decoded
using functions. So any transformation is supported.
http://hg.python.org/cpython/file/eac63e7ceb03/Lib/os.py#l636
On UNIX, the encoder and decoder are os.fsencode() and
Eli Bendersky added the comment:
+1 For the general idea
+1 For the more generic approach of which lowercase is just one special case
+10 to make this a PEP so that more people have a chance to express their
opinion (currently only those who noticed it on the issues mailing list). I
find the
Antoine Pitrou added the comment:
Here is a fixed patch (works here, at least :-)).
--
Added file: http://bugs.python.org/file31701/cleanup2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18984
Antoine Pitrou added the comment:
FYI os.environ uses something similar: keys and values are encoded and
decoded using functions. So any transformation is supported.
I don't think this is the same situation. os.environ has bijective
transformations, which don't pose any implementation
Changes by Tim Peters t...@python.org:
--
stage: commit review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18808
___
Tim Peters added the comment:
Yes - and I just closed 18808 :-)
--
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18984
___
New submission from Stefan Behnel:
The .close() method of the new XMLPullParser (see issue17741) in Py3.4 shows an
unnecessarily complicated behaviour that is inconsistent with the .close()
method of the existing XMLParser.
The attached patch removes some code to fix this.
--
Antoine Pitrou added the comment:
+10 to make this a PEP so that more people have a chance to express
their opinion (currently only those who noticed it on the issues
mailing list). I find the issue tracker a very bad medium for any kind
of brain-storming or bikeshedding.
Well, I don't
Tim Peters added the comment:
Well - I remain baffled, but am grateful for the patch - thanks :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18984
___
Changes by Stefan Behnel sco...@users.sourceforge.net:
--
nosy: +eli.bendersky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18990
___
___
Stefan Behnel added the comment:
Created separate issue18990 to keep this one closed as is.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17741
___
STINNER Victor added the comment:
I tried to implement the feature as a new traceback.clear_frames() method. I
tried to follow the chain of frame objects (using frame.f_back), but it does
not work as expected. The method needs to follow the chain of traceback objects
(tb.tb_next). So it makes
Changes by STINNER Victor victor.stin...@gmail.com:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18904
___
Antoine Pitrou added the comment:
Do you want to upload a patch?
--
nosy: +pitrou
versions: +Python 2.7, Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18987
___
Serhiy Storchaka added the comment:
See also discussion on a topic:
http://comments.gmane.org/gmane.comp.python.ideas/18469 .
Proposed names: custom_dict, KeyedDictionary, Dictionary.
It will be confused if this dict will not be compatible with PyDict API. It is
possible to add such feature
Antoine Pitrou added the comment:
- The documentation is wrong: frame.clear() does not guarantee to
clear *all* locals, but only *most* locals:
F.clear(): clear most references held by the frame);
Actually, the documentation is right: references != locals ;-)
--
R. David Murray added the comment:
Indeed. Although there was apparently some call for it, it doesn't sound from
a quick google like defaultdict was deemed to require a PEP. Presumably the
informed audience should be wider than this issue, though.
I also note that defaultdict is implemented
Ethan Furman added the comment:
Precisely what I was thinking. :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
___
___
Python-bugs-list
Antoine Pitrou added the comment:
I also note that defaultdict is implemented via a special method on
dict itself (__missing__), and if this one was implemented the same
way it would be easy to combine the features.
It's not that simple: to remember the original casing you need either a
Antoine Pitrou added the comment:
(as a sidenote, you might want a case-insensitive OrderedDict as well, I see no
reason to make a special case for defaultdict here)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Antoine Pitrou added the comment:
Proposed names: custom_dict, KeyedDictionary, Dictionary.
Sounds much too vague and un-specific.
It will be confused if this dict will not be compatible with PyDict
API.
Why? Many custom dict-like classes aren't.
It is possible to add such feature
New submission from Davi Post:
class MyOrderedDict(OrderedDict):
def __getitem__(self, key):
OrderedDict.__getitem__(self, key)
After setting a key, getting it returns None. See attached.
Am I missing something?
Discovered this when trying to use the dict_type parameter of
Serhiy Storchaka added the comment:
Why? Many custom dict-like classes aren't.
And this is weird (issue10977).
Can you explain how?
By patching Objects/dictobject.c of course. I suppose it should require
changing about 400 lines of code, a little more than for IdentityDict. When you
Antoine Pitrou added the comment:
By patching Objects/dictobject.c of course.
Am I stupid :-)
I suppose it should require changing about 400 lines of code, a little
more than for IdentityDict. When you provides the specification
perhaps I will provide a patch.
Well, take a look at the
Alex Gaynor added the comment:
Your __getitem__ never returns the result of OrderedDict.__getitem__
--
nosy: +alex
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18991
Davi Post added the comment:
Oops. Thanks. :-{
On Mon, Sep 9, 2013 at 4:56 PM, Alex Gaynor rep...@bugs.python.org wrote:
Alex Gaynor added the comment:
Your __getitem__ never returns the result of OrderedDict.__getitem__
--
nosy: +alex
resolution: - invalid
status: open -
Terry J. Reedy added the comment:
I am not currently seeing the problem I reported, so closing. If I type past /
and hit ^space, I sometimes get an empty listbox, but I do not yet have a
consistent failing case. Will open a new issue if/when I get one.
--
resolution: - fixed
stage:
Serhiy Storchaka added the comment:
I'm curious to know how you'll integrate it in dictobject.c without slowing
down normal dict objects, and without making them bigger.
It of course will make a size of source file bigger, but shouldn't affect a
size or performance of normal dicts. A dict
Antoine Pitrou added the comment:
It of course will make a size of source file bigger, but shouldn't
affect a size or performance of normal dicts. A dict object contains
dk_lookup.
You need to keep both the original keys and the transformed keys. It's not only
about transforming keys on
Antoine Pitrou added the comment:
It will be good if your provide complete test suite.
... Again, take a look at the code I've posted above ...
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18986
Nick Coghlan added the comment:
I don't recall this *particular* wrinkle being discussed. Silently failing
to define one of the requested enum members seems quite dubious.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18989
paul j3 added the comment:
This patch uses a narrow criteria - if `_get_values()` sets the value to
`action.default`, then argument counts as 'not present'. I am setting a
`using_default` flag in `_get_values`, and return it for use by `take_action`.
In effect, the only change from previous
New submission from Tim Peters:
Don't know whether this is new. Found it running the test suite under a
3.4.0a2 freshly installed from the python.org .msi installer:
== CPython 3.4.0a2 (v3.4.0a2:9265a2168e2c+, Sep 8 2013, 19:41:05) [MSC v.1600
32 bit (Intel)]
== Windows-Vista-6.0.6002-SP2
Ned Deily added the comment:
Martin builds the Windows installers.
--
nosy: +loewis, ned.deily
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18992
___
Ethan Furman added the comment:
Cool. Latest patch has a slight doc fix for getmembers.
Will commit on Friday if no other pertinent feedback.
--
assignee: - ethan.furman
stage: - patch review
Added file: http://bugs.python.org/file31706/issue18929.stoneleaf.04.patch
Roundup Robot added the comment:
New changeset fe5c03fb0ff6 by Senthil Kumaran in branch '3.3':
Document Fraction's numerator and denominator properties.
http://hg.python.org/cpython/rev/fe5c03fb0ff6
New changeset 5fb700ca3fd5 by Senthil Kumaran in branch 'default':
merge from 3.3
Senthil Kumaran added the comment:
Fixed in applicable versions 3.3 and 3.4.
--
resolution: - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: -Python 2.7
___
Python tracker rep...@bugs.python.org
Changes by Jesús Cea Avión j...@jcea.es:
--
nosy: +benjamin.peterson
priority: normal - release blocker
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18734
___
Changes by Ethan Furman et...@stoneleaf.us:
--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file31707/issue18281.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18281
Ethan Furman added the comment:
Interestingly enough, the two constants that are used are prefixed with `stat`.
Patch attached.
Adios!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18281
Senthil Kumaran added the comment:
Couple of strategies I thought for tacking this problem.
1) Documenting the resolution of NEWS specific merge conflict.
Observing/recording when those arises and when it was there was no-conflict
will be helpful. This could help us in organizing NEWS file
Roundup Robot added the comment:
New changeset 443d12b61e5b by Senthil Kumaran in branch '2.7':
Clarify mmap.close method behavior. Addresses issue #18815
http://hg.python.org/cpython/rev/443d12b61e5b
New changeset 373907ca13e0 by Senthil Kumaran in branch '3.3':
Clarify mmap.close method
Senthil Kumaran added the comment:
This is addressed. Thanks for the patch, Anoop.
--
nosy: +orsenthil
resolution: - fixed
stage: - committed/rejected
status: open - closed
type: - behavior
___
Python tracker rep...@bugs.python.org
92 matches
Mail list logo