[issue1165] Should itertools.count work for arbitrary integers?
Changes by Raymond Hettinger: -- assignee: - rhettinger nosy: +rhettinger __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1165 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10461] Use with statement throughout the docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Do not change the examples in collections.rst. That would interfere with the clarify of what is being demonstrated. For example, the hamlet.txt example is not about file reading, it about counting words. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10461] Use with statement throughout the docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I think the other (non collections patches) are fine. The change doesn't break up the flow of the text. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10461] Use with statement throughout the docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Separate note for Éric: the try/finally examples do not need to change. Those are valid python. Users need to learn both try/finally and the with-statement. -- assignee: d...@python - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9746] All sequence types support .index and .count
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Patch is fine. Go ahead and apply. -- nosy: +rhettinger resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9746 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10476] __iter__ on a byte file object using a method to return an iterator
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: FWIW, an idiom I use in Py2.x is: for block in iter(partial(f.read, BLKSIZ), ''): . . . This works with both single bytes at time and multiple bytes at a time. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10476 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9909] request for calendar.dayofyear() function
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: We already got one, and it's very nice-a ISTM, this should be done with regular date arithmetic in the datetime module. date(1964, 7, 31) - date(1963, 12, 31) datetime.timedelta(213) I don't see why we need a new function for this or why it would be put in the calendar module (where some of its functions have been supplanted by the datetime module). -- nosy: +rhettinger priority: normal - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9909 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Added a comment to the docstring. See r86631. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7770 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7770] sin/cos function in decimal-docs
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7770 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10488] Improve documentation for 'float' built-in.
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: d...@python - mark.dickinson resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1560032] confusing error msg from random.randint
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Sorry, it's time to close this one. The code is not buggy, it is documented as being a bound method and that is a perfectly acceptable python coding style to use bound methods as callables. It's also been around for a *very* long without causing issues beyond Python's usual irritation with the number of arguments messages (that happened when Python became object oriented and that artifact still survives). When it comes to the random module, people are performance sensitive and it would be a total waste to wrap these bound methods in another layer just to get different error message reporting. Anyone whose Monte Carlo simulation run time doubles because of this would be rightfully irritated. -- assignee: - rhettinger nosy: +rhettinger resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1560032 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10461] Use with statement throughout the docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Éric, please apply most of these. In the atexit patch, the first change is wrong. Change it to a try/except/finally or skip it altogether. In the collections patch, only include the change for the tail example; the other two should remain unchanged. Skip the difflib patch entirely. It unnecessarily makes the example confusing and hard to follow. Change the cmd patch to: +with open(arg) as f: +self.cmdqueue.extend(f.read().splitlines()) -- assignee: rhettinger - eric.araujo resolution: - accepted stage: needs patch - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10356] decimal.py: hash of -1
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Committed the ValueError in r86517 (py3k) As discussed on IRC, I've reverted this change. -- resolution: fixed - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10356 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9802] Document 'stability' of builtin min() and max()
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: As discussed with Mark, am closing this one after having applied documentation changes. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9802 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5353] Improve IndexError messages with actual values
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I'm abandoning this one since I couldn't find a way to do it that didn't impair performance. Unlike C++, it is not uncommon in Python to use exceptions such as IndexError for control flow. There was too little added value in building-out this message to warrant the change (the current message is very clear about what the problem is, it just doesn't dump all the variables involved -- this is not uncommon for python error messages). -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5353 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6722] collections.namedtuple: confusing example
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: See r86650 -- resolution: - fixed status: open - closed versions: -Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7212] Retrieve an arbitrary element from a set without removing it
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7212 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: After more thought, am leaving the doc strings as-is. They are succinct and accurate. I have updated the sorting how-to to more thoroughly cover the basics of sorting. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7257 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3292] Position index limit; s.insert(i,x) not same as s[i:i]=[x]
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Added the i,j,k notes Left out the processor word size and C-type specifications in-part because it is an implementation detail subject to change. Another reason is that it doesn't apply to necessarily to all sequences. Slices take arbitrary objects and with applied to an object's __getitem__, the object itself is responsible for handling it. Also, the size limits are already reflected in the maximum sizes for the object (a list can't get bigger that Py_ssize_t, so of course, its indicies are similarly bounded). Adding more text here is leaning towards over-specification of implementation specific details and make the docs harder to read while not adding anything truly helpful. In particular, it is more harmful than helpful to focus on the edge case where s.insert(i, x) is not the same as s[i:i] = [x] when i==sys.maxsize-1. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3292 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3292] Position index limit; s.insert(i,x) not same as s[i:i]=[x]
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: See r3292. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3292 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7049] decimal.py: Three argument power issues
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: +1 for deprecating three-arg pow for the reasons given. A user is much better-off composing well-defined operations than using our short-cut, with our chosen assumptions. Apologies for taking so long to think this one through. -- assignee: rhettinger - mark.dickinson versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10164] Add an assertBytesEqual to unittest and use it for bytes assertEqual
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Rejecting this one for reasons we discussed earlier. The assertEqual() method needs to be the primary interface. Everything else is starting to mix content and presentation (i.e. passing in separators). The existing repr() works fine with bytes and Michael's suggested ascii() cast would be the preferred technique in the common cases. What might be useful is a less specialized patch letting assertEqual() take an argument pointing to some repr or pre-processing function that would be called after an equality test fails but before it is diffed. That would support a clear separation of concerns and be easily extendable by users would need something more than an ascii() cast. -- resolution: later - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10164 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10360] _weakrefset.WeakSet.__contains__ should not propagate TypeErrors
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I don't have any other insights on this one. Assigned by to Antoine who appears to have put some thought into it. -- assignee: rhettinger - pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10360 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7434] general pprint rewrite
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Deferring the general rewrite until 3.3. It would need to have a lot of people look at it and evaluate it. I no longer think there is time for that before the 3.2 beta. -- resolution: - later versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7434 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10366] Remove unneeded '(object)' from 3.x class examples
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: These mostly look good. Do leave the howto documents as-is. They have some value across multiple versions of Python. Also, the descriptor how-to in particular gets some benefit from keeping (object) explicit because it helps remind users which version of __getattribute__ is being run. Other than the how-tos, please go ahead and apply. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10366 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10138] calendar module does not support years outside [1, 9999] range
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Go ahead an remove the word indefinitely. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10138 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5150] IDLE to support reindent.py
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Opened back up for the new patch (posted after the previous close). -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5150 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10461] Use with statement throughout the docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I’m not 100% sure I should change 'r' to 'rb' in logging: It’s unrelated to with, and the rest of the file has not been checked for similar errors. Good catch. This should only be a with-statement transformation. I caught other accidental semantic changes, so be continue to exercise care. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the revisions and timing updates. I'm heartened that the common-case of sorting without a key function isn't negatively impacted. That result is surprising though -- I thought the concept was manipulate the key and value arrays at the same time instead of just the keys -- did you do more than this, perhaps changing the logic or pattern of comparisons? If so, I would be *much* more comfortable if Tim reviewed this. The one part of the current code that would be missed is that it cleanly separates/decouples the key-function logic from the Timsort logic. Now those are heavily intertwined -- I find the code harder to follow. Why did the variable names change, pa/pb to ssa/ssb, etc.? I'm hoping that I'll have a chance to go through the details of the patch in the next couple of weeks. Unfortunately, the patch is huge and it looks like it mixes in a number of optimizations beyond just moving keys and values in parallel, variable names are changing, comment lines are rewrapped, etc. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: If the key parameter was not used, then the values pointer is a null pointer. . . . Since the branch will always be the same throughout any given call to sort(), CPU branch prediction is effective making the branches fairly inexpensive. I see how the branch can be optimized away but not how it gets cheaper than when there was no branch at all (and no lo.keys and lo.values extra layer of direction). How did it get *faster* than the original (in the case with no key-function)? Why did the variable names change, pa/pb to ssa/ssb, etc.? I took pa to mean pointer to array A, but it's now a sortslice structure instead of a pointer. That makes sense. If I can get Rietveld to show each of my local commits, would it be helpful to see the patch in incremental pieces? At this point, it may be best for me to read the patch as-is. Unfortunately, it's a big patch and will likely take a lot of time to read in detail. Is there any chance you can persuade Uncle Timmy to review this? This is all his code and he's likely to have some good insights. Also, is there anyone else who is knowledgeable about Python on less common platforms? ISTM part of the optimization is dependent on the branch-prediction and other nuances that vary from environment to environment. That being said, doing fewer memory allocations is always a win. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10511] heapq docs clarification
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: That looks fine. Perhaps s/trees/binary trees -- assignee: rhettinger - georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10516] Add list.clear() and list.copy()
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Guido approved these both in a thread earlier this year. The reasoning for copy() was the same as for clear(), some folks couldn't cope with: b = a[:] -- nosy: +rhettinger title: Add list.clear() - Add list.clear() and list.copy() ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10516 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10519] setobject.c no-op typo
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10519] setobject.c no-op typo
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Try to match the whitespace convention of the surrounding code. -- assignee: rhettinger - anthonybaxter nosy: +anthonybaxter resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10519] setobject.c no-op typo
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: A few lines later, a similar change can be made for set_discard. -- assignee: anthonybaxter - arigo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10533] defaultdict constructor with a concrete value
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: lukasz.langa - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10533 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10533] defaultdict constructor with a concrete value
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: It would be very handy to allow for concrete values as well. Do you have use cases for a concrete integer value that isn't zero? Since we can currently use defaultdict(int) or defaultdict(tuple), is the purpose just to create a more direct spelling of the same thing? The docs for defaultdict also show a general purpose way to generate any default constant (though that way isn't obvious if you haven't seen it in the docs). I'm reluctant to add yet another variant. We already have __missing__, defaultdict, Counter, dict.get, and dict.setdefault(). The docs for dictionaries need to make clear that Guido has already provided an idiom to be the one obvious way to do it: class MyConst(dict): def __missing__(self, key): return myconst That was really the whole point of adding __missing__ in the first place. The OP's proposal amounts to rejecting Guido's design which provides a very good general purpose solution. -- keywords: -easy type: - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10533 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10533] Need example of using __missing__
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: [Łukasz Langa] __missing__ didn't appear to be the one obvious way to anyone. Two thoughts: * There is part of the Zen that says that way may not be obvious unless your Dutch. In this case, __missing__ was the API designed by Guido to handle the problem. If it isn't obvious, it is up to us to popularize the idiom in talks, in tutorials, in newsgroup discussions, etc. And FWIW, it is not unprecedented -- Lua's dicts have a similar hook and most of the interesting programming in Lua relies on it. * The __missing__ method should not be considered a dark corner of Python. Unlike the copy module, pickling, of weakrefs, it is not tucked away in the library. The missing method is part of the basic API for one of Python's most fundamental objects. If someone is going to be a Python programmer, they must at least learn about dicts, lists, strings, and tuples. then again I've used , [] and set() numerous times. Adding zerodict, stringdict, listdict, setdict is obviously absurd. Looking at those examples, you're probably already aware that the list and set versions are already served by defaultdict(), and that it would be basic (and probably common) mistake to accidentally use [] in your proposed constant dict. A constant version of the defaultdict only makes sense with immutables such as numbers, strings, and tuples. The common case would be the number zero and we have Counter() for that. So, you're left with very few use cases and with a hazard for users who may write: f = fallback_dict([]). 4. I cannot come up with another typical integer value that would be useful FWIW, the Counter class *is* a ZeroDict. It has a few extra methods but is basically a dict with __missing__ set to return zero. ... then I'm +1 on correcting the docs in terms of __missing__ and leaving the implementation as is. Thank you. Will reclassify this as a doc issue. [Éric Araujo] 2) Add examples of giving dict or int to collections.defaultdict to get {} or 0 as default value. Those examples have been there since day one. [Michael Foord] I'm sure the documentation could be improved to highlight __missing__ though. I'll add another example and perhaps include on in the tutorial. It's almost always the case that documentation can be improved. :-) Getting people to read it is another story ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10533 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: michael.foord - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10273] Clean-up Unittest API
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: After discussion with Michael and Guido, am limiting this to: * Fixing assertItemsEqual as described in issue10242 * Moving the docs for type specific equality methods inside the docs for assertEqual to emphasize that those get dispatched automatically and need not be called directly. * Changing assertRegexpMatches to assertRegex -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10273] Clean-up Unittest API
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Yes, all the variants of RegexpMatches -- Regex No, on deprecations. Just add a new alias and note in the docs that the oldname is obsolete. Naming deprecations cause too much trouble for too little benefit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10542] Py_UNICODE_NEXT and other macros for surrogates
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Mark, can you opine on this? -- assignee: belopolsky - lemburg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10542 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Applied in r86828. The output could still be made nicer, perhaps something along the lines of: expected 6, got 4: 'wand of fireballs' expected 2, got 7: 'ring of invisibility' . . . -- priority: high - normal resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10544] yield expression inside generator expression does nothing
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Hmm, what an interesting and unexpected side-effect of the efforts to hide the loop induction variable. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10544 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Attaching possible code for nicer output. -- assignee: rhettinger - michael.foord resolution: fixed - Added file: http://bugs.python.org/file19833/nice_output.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10542] Py_UNICODE_NEXT and other macros for surrogates
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I suggest Py_UNICODE_ADVANCE() to avoid false suggestion that the iterator protocol is being used. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10542 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10565] isinstance(x, collections.Iterator) can return True, when x isn't iterable
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: A possible solution could be in collections.Iterator.__subclasshook__ checking for both required methods. That makes sense. PEP 234 requires iterators to support both methods. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10565 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10544] yield expression inside generator expression does nothing
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This discussion should probably be moved to python-dev. With tools like Twisted's inlineDefer or the Monocle package, there is a growing need to be able to use yield in complex expressions. Yet, that goes against the trend toward making lists comps more like genexps and less like sugar for a simple for-loop accumulator. Guido, do you have any thoughts on the subject? Mark it a documentation issue or try out Benjamin's fix? -- assignee: - gvanrossum nosy: +gvanrossum versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10544 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3243] Support iterable bodies in httplib
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Instead of hasattr(str,'next') consider using isinstance(str, collections.Iterable) Also consider changing the variable name from the now overly type specific, str to something like source to indicate the significance of the data, not its type. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3243 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5150] IDLE to support reindent.py
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: rhettinger - ned.deily nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5150 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10273] Clean-up Unittest API
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Ezio, please do the regexp--regex changes and move the tests under Lib/test. -- assignee: rhettinger - ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10565] isinstance(x, collections.Iterator) can return True, when x isn't iterable
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed in r86857. Needs backport. -- versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10565 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10572] Move unittest test package to Lib/test
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Of those, it makes the most sense to move the json tests to Lib/tests. Bob is not externally maintaining the 3.x version. It's all our now. Also, it looks like importlib is in a maintenance mode now. There is merit to keeping 2to3, ctypes, sqlite tests separate. Currently all of the documentation files are still under Doc so we should keep it that way and not move them under package directory trees. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5863] bz2.BZ2File should accept other file-like objects.
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Without a patch and compelling use cases, this has no chance. Recommend closing. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10565] isinstance(x, collections.Iterator) can return True, when x isn't iterable
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Alexander, do you want to take care of the backport? -- assignee: rhettinger - belopolsky nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10565 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- Removed message: http://bugs.python.org/msg117005 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10323] Final state of underlying sequence in islice
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed in r86874. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10586] Enhanced cache access API for functools.lru_cache
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Okay, go ahead with the second patch. With the following changes: _CacheInfo = namedtuple(CacheInfo, maxsize size hits misses) Change the variable names: cache_hits -- hits cache_misses -- misses Add a with lock: to the cache_info() function. Update the docs. Thanks. -- assignee: rhettinger - ncoghlan resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10586 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10586] Enhanced cache access API for functools.lru_cache
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thx -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10586 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7830] Flatten nested functools.partial
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Alexander, I don't see anything wrong with patch, nor anything compelling about it either. It's your choice whether or not to apply. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7830 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8685] set(range(100000)).difference(set()) is slow
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thx. -- assignee: rhettinger - pitrou resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8685 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: +1 on the basic idea of moving elements in the keys and values arrays at the same time thereby eliminating the fragmented memory overhead of the sortwrapper indirection. I would like the patch to be restricted to just that change. The other tweaks are not convincing (relying on compiler and processor specific optimizations that vary across platforms). Instead, try to minimize the patch, making as few changes as possible to manipulation both arrays. Also, try to follow the C style of the other code in the standard library -- the current patch has a different flavor to say the least ;-) Ideally, the code will have the same look and feel as it does now (so that the Timsort remains recognizable to Tim ;-). This code doesn't just need to run fast, it needs to serve as a readable model for anyone else trying to implement the algorithm. If you still want the other tweaks, I recommend putting them in a separate patch afterwards and consider deferring them to 3.3. It's a little late in the dev cycle to make lots of microscopic changes that may introduce a bug or unexpected behavior or perform weirdly on one of the less used platforms. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8425] a -= b should be fast if a is a small set and b is a large set
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Deferring to 3.3. -- priority: normal - low versions: +Python 3.3 -Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8425 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6422] timeit called from within Python should allow autoranging
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This does not conflict with the other proposed changes to timeit and it is in-line with Guido's desire that to expose useful parts currently buried in the command-line logic. Amaury, you've shown an interest. Would you like to apply it? -- assignee: rhettinger - amaury.forgeotdarc resolution: - accepted versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6422 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6594] json C serializer performance tied to structure depth on some systems
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Antoine, what do you want to do with the one? Without a good test case the OP's original issue is undiagnosable. -- assignee: rhettinger - pitrou versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6594 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8425] a -= b should be fast if a is a small set and b is a large set
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Any new logic should make maximum use of existing tools: def __isub__(self, other) if len(other) len(self)*8: other = self other . . . # rest of isub unchanged -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8425 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Daniel, do you have time to work on this one? If so, go ahead an make setobject.c accept any instance of collections.Set and make the corresponding change to the ABCs: def __or__(self, other): if not isinstance(other, Set): return NotImplemented chain = (e for s in (self, other) for e in s) return self._from_iterable(chain) The code in the attached prelim.patch has working C code isinstance(x, collections.Set), but the rest of the patch that applies is has not been tested. It needs to be applied very carefully and thoughtfully because: * internally, the self and other can get swapped on a binary call * we can't make *any* assumptions about other (that duplicates have actually been eliminated or the the elements are even hashable). The most reliable thing to do for the case where PyAnySet(obj) is False but isinstance(obj, collections.Set) is true is to call the named method such as s.union(other) instead of continuing with s.__or__ which was designed only with real sets in mind. -- assignee: rhettinger - stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8743] set() operators don't work with collections.Set instances
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: No need to rush this for the beta. It's a bug fix and can go in at any time. The important thing is that we don't break the C code. The __ror__ magic method would still need to do the right thing and the C code needs to defend against the interpreter swapping self and other. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10593] LRU Cache with maxsize=None
New submission from Raymond Hettinger rhettin...@users.sourceforge.net: Nick, I may have found a straight-forward way to incorporate your idea for the cache to support maxsize=None. Let me know what you think. -- assignee: ncoghlan components: Library (Lib) files: cache.diff keywords: patch messages: 122967 nosy: ncoghlan, rhettinger priority: low severity: normal status: open title: LRU Cache with maxsize=None type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file19886/cache.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10593 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10593] LRU Cache with maxsize=None
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: Added file: http://bugs.python.org/file19887/cache2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10593 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10593] LRU Cache with maxsize=None
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: Removed file: http://bugs.python.org/file19886/cache.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10593 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7434] general pprint rewrite
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Attaching a rough concept of how to make the existing pprint module extendible without doing a total rewrite. The actual handler is currently bogus (no thought out), so focus on the @guard decorator and the technique for scanning for handlers. -- Added file: http://bugs.python.org/file19888/rdh_pprint.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7434 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10593] LRU Cache with maxsize=None
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Applied in r86911. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10593 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10592] pprint module doesn't work well with OrderedDicts
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I'll discuss with Benjamin. This could be construed as a simple bug fix. The code is already in Py3.1. Line 155: - items = _sorted(object.items()) + items = (list if issubclass(typ, OrderedDict) else _sorted)(object.items()) -- assignee: - benjamin.peterson nosy: +benjamin.peterson, rhettinger stage: committed/rejected - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10592 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10594] Typo in PyList_New doc.
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This is fine. Go ahead and backport if you feel so inclined. -- assignee: d...@python - eli.bendersky nosy: +rhettinger priority: normal - low resolution: - accepted versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10594 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5088] optparse: inconsistent default value for append actions
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Note, the :attr:`~Option.dest` variable is a list which includes default values if any are defined. Options on the command-line are appended to this list. Accordingly, the list may contain both the default value and the value passed on the command-line. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5088 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks. This nice, clean diff is much more reviewable and it looks like what I expected. The use of Py_LOCAL_INLINE is new to me since we usually use #define instead, but this has a cleaner look to it. I am unclear on whether all the our target compilers support an inline keyword. If you're sure it works everywhere, that's great. If not, consider going back to ugly defines -- those reliably work everywhere. Also note that this patch puts a lot of faith in branch prediction. If some target processor doesn't support it, or has limited ability to remember predictions, or mispredicts, then the code will be slower. That being said, I'm happy with the patch. You have a +1 from me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Just for the record, I wanted to highlight how little room there is for optimization here. The sort wrapper is *very* thin: sortwrapper_richcompare(sortwrapperobject *a, sortwrapperobject *b, int op) { if (!PyObject_TypeCheck(b, PySortWrapper_Type)) { PyErr_SetString(PyExc_TypeError, expected a sortwrapperobject); return NULL; } return PyObject_RichCompare(a-key, b-key, op); } When a key function is defined, this is all you can possibly shave off the time for a comparison. When a key function is not defined, there was no overhead at all. With the patch, we're relying on branch prediction to minimize the cost to the regular case and adding a little indirection in the form of lo variables becoming lo.keys, etc. And the number of memmoves is doubled. To me, the main advantage of the patch is that it saves a little memory for each key: typedef struct { PyObject_HEAD PyObject *key; PyObject *value; } sortwrapperobject; Just wanted to post this so there weren't any illusions about the patch being a big win. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9915] speeding up sorting with a key
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: AP: I've already given my blessing to the patch. Just wanted to note what the existing code did. I also trust timings but recognize that they reflect a particular build configuration (compiler/processor/o.s)and the usage pattern for a particular benchmark. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9915 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10562] Change 'j' for imaginary unit into an 'i'
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: If this change were important, the numpy/scipy guys would have requested it long ago. Any possible benefit would be slight and not at all worth the disruption. s.replace('j', 'i') -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10562 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10562] Change 'j' for imaginary unit into an 'i'
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Since we have two distinct user groups (engineers and everyone else), it's clear that we should fork Python. That would let each group work with their on most-natural-representation and it would prevent unnecessary configuration challenges. Benjamin, could you please start a new branch and fork the website into python.i.org and python.j.org. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10562 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10562] Change 'j' for imaginary unit into an 'i'
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Can you now implement the letter 'i' to act as an imaginary unit? Is that possible? Yes, it's possible; however, the developers do not think it is worthwhile. If it's possible in MATLAB, why not have both 'j' and 'i' in Python as well? Python does some things differently that MATLAB. One design choice is to avoid global configurations (such as number of places displayed in a float) because modules written by different people make make different assumptions or may compete for a preferred setting. Let's try to end this thread now. It's a bit of no-win situtation. None of the core devs see enough possible benefit to warrant the disruption it would cause. Years of Python being used in the scientific community has shown that the current use of 'j' has not been a problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10562 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10610] Correct the float(), int() and complex() documentation
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Try not to sprawl this all over the docs. Find the most common root and document it there. No need to garbage-up Fractions, Decimal etc. with something that is of zero interest to 99.9% of users. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10610] Correct the float(), int() and complex() documentation
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Try not to twist yourself in a knot over this. I'll be happy to review in proposed doc patch. -- assignee: d...@python - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10610] Correct the float(), int() and complex() documentation
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- Removed message: http://bugs.python.org/msg123190 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10610] Correct the float(), int() and complex() documentation
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Let me know when you have a proposed doc patch. Ideally, the details should just be in one place and we can refer to it elsewhere. We don't want to add extra info to every function or method in Python that uses int(s) and gets extra unicode digits as an unintended artifact. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10562] Change 'j' for imaginary unit into an 'i'
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- nosy: -rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10562 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10516] Add list.clear() and list.copy()
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger keywords: +easy -patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10516 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6101] SETUP_WITH
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Yes, someone went nuts with renumbering. That is allowed but was probably unnecessary. That being said, users of opcodes should really use the names in opcode.py instead of the numbers themselves. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6101 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10516] Add list.clear() and list.copy()
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Nothing will happen on this until 3.2 is done and the py3k branch starts with 3.3 submissions. -- resolution: - later ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10516 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10648] Extend peepholer to reverse loads or stores instead of build/unpack
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger nosy: +rhettinger priority: normal - low versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10648] Extend peepholer to reverse loads or stores instead of build/unpack
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the patch. I had looked at this long ago when I first added the ROT2 optimization and the ROT3/ROT2 optimization. It wasn't included because it wasn't worth the added complexity in the peepholer logic and because there were concerns about executing internally in a different order than specified by the code. Since LOAD_NAME and LOAD_GLOBAL are subject to user control, changing their order of evaluation causes a visible change in semantics. For example, the following result is different than before the patch. class Dict(dict): ... def __getitem__(self, key): ... print(key) ... return dict.__getitem__(self, key) ... ns = Dict() exec('c=1; d=2; a,b=c,d', globals(), ns) d c For the most part, I'm not too excited about the patch because * it is limited to very simple cases that already have some optimization * it needs to be limited even further to be semantically neutral * it adds complexity to a part of the peepholer that is already a bit too complicated (the more peephole assumptions we make, the harder it is to maintain, especially when opcodes are added, deleted, or changed). * changing order of execution starts to venture into territory that we've stayed away from (on purpose). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7391] Re-title the Using Backslash to Continue Statements anti-idiom
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I'll take that section out. -- assignee: d...@python - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10667] collections.Counter object in C
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the patch. FWIW, I'm attaching some timing code that I've used in the past. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10667] collections.Counter object in C
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: Added file: http://bugs.python.org/file19993/time_counter.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10675] unittest should have an assertChanges context manager
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I concur with David Murray. Usually you care about the specific value changed to, not whether it changed at all. The changed-by variant is even more specialized and you're better of using assertEqual since you know what the new value is supposed to be: assertEqual(thing.attr, x) ... assertEqual(thing.attr, x+by) -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10675] unittest should have an assertChanges context manager
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for submitting the idea though. Perhaps, post it on the ASPN Cookbook or on the newsgroup to see if others are interested. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2690] Precompute range length and enhance range subscript support
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Applied in r87162 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2690 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10667] collections.Counter object in C
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I would like this API to sit and cook for a good while. There are many possible ways to add more methods and most be end-up being YAGNI. Also, my experience with dict.fromkeys() is that a fair number of people get confused by alternative constructors. So, at this point I have zero interest in adding from_items(). Am taking the C optimizations under advisement. In the meantime, there is no need to keep submitting patch variations. The question is less how-to-do-it and more a question of whether-to-do-it. We try not to add an alternate C paths unless a feature is an important building block. There is an on-going maintenance cost and a risk of slightly different behaviors (at a minimum, the tracebacks look different and the code can't be traced through pdb). That being said, there is a nice speed-up to be had, so I'll give that some weight. -- priority: normal - low resolution: - later ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2690] Precompute range length and enhance range subscript support
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Is the in/not-in fast path in 2.7? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2690 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com