[issue26809] `string` exposes ChainMap from `collections`

2016-04-20 Thread leewz
leewz added the comment: Why not both? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26809> ___ ___ Python-bugs-list

[issue26809] `string` exposes ChainMap from `collections`

2016-04-20 Thread leewz
leewz added the comment: (Never mind that last bit. I see it now.) > I agree that the namespace pollution is a valid bug. It affects “from string > import *” and dir(string). How do I get this behavior for `dir`? I get '_re' in `dir(

[issue26809] `string` exposes ChainMap from `collections`

2016-04-20 Thread leewz
leewz added the comment: > The fact that ChainMap pollutes namespace when doing star import ("from > string import *"), however, is unfortunate. This is what I meant by "this kind of thing". (IPython also ignores underscored names for autocomplete sug

[issue26809] `string` exposes ChainMap from `collections`

2016-04-20 Thread leewz
New submission from leewz: I don't know if this kind of thing matters, but `from string import ChainMap` works (imports from `collections). It's used internally by `string`. This was done when ChainMap was made official: https://github.com/python/cpython/commit

[issue25956] Unambiguous representation of recursive objects

2015-12-28 Thread leewz
leewz added the comment: Hey, I brought this up last month in the #python channel. I suggested `[ . . . ]`. I agree that there's no great need, though. -- nosy: +leewz ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread leewz
New submission from leewz: Meaning: filter(False, lst) == (x for x in lst if not x) == itertools.filterfalse(None, lst) I understand that it is a very minor enhancement, and with not much benefit. I just happened to think about it, and wondered why it didn't already exist. I

[issue25840] Allow `False` to be passed to `filter`

2015-12-11 Thread leewz
leewz added the comment: ebarry, note that `filter(None, lst)` is equivalent to `filter(bool, lst)`, which is the opposite of `filterfalse(None, lst)`. (Though `filter(True, lst) == filter(bool, lst)` would be a parallel.) -- ___ Python tracker

[issue25428] Have `datetime` understand integer arguments for timezones

2015-11-06 Thread leewz
leewz added the comment: Thanks. Will visit them. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25428> ___ ___ Python-bugs-list

[issue25428] Have `datetime` understand integer arguments for timezones

2015-10-16 Thread leewz
New submission from leewz: Current: If I want to create a datetime object with a particular timezone offset, I have to do this: import datetime mytime = datetime.datetime(2015, 10, 16, 9, 13, 0, tzinfo=datetime.timezone(datetime.timedelta(hours=-7))) Or with imports: from

[issue21227] Decimal class error messages for integer division aren't good

2014-04-16 Thread leewz
leewz added the comment: Fine grained? Do you mean that the error can't be distinguished from other such errors? Or that it's difficult to attach the message to DivisionError? I thought DivisionError was always about precision. I looked up the error in libmpdec: This occurs and signals

[issue21227] Decimal class error messages for integer division aren't good

2014-04-16 Thread leewz
leewz added the comment: Nah. I found it surprising at first, but like I said, it's like the computer is given the first 28 digits of a number and then asked to figure out the 30th digit. What I'm confused about is how it fits the definition of division impossible given by libmpdec's docs

[issue21227] Decimal class error messages for integer division aren't good

2014-04-16 Thread leewz
leewz added the comment: Total list of issues now: - Error message for `DivisionImpossible` is [class 'decimal.DivisionImpossible'] instead of an actual error message. - `decimal.DivisionImpossible.__doc__` is empty. - Calling `help(decimal.DivisionImpossible)` turns up nothing useful

[issue21227] Decimal class error messages for integer division aren't good

2014-04-14 Thread leewz
New submission from leewz: Python's `decimal.Decimal` doesn't seem to like taking modulo or intdiv of large Decimals by integers (where large depends on how many digits are internally stored). from decimal import * getcontext().prec 28 Decimal(10**29)%1 Traceback (most

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-01-28 Thread leewz
New submission from leewz: Compiling a regex with the `re.DEBUG` flag indicates that the user wants to see the debug output. `re.compile` is cached, though, so there is the possibility of no output. Example: import re re.compile('1',re.DEBUG) #expected output re.compile('1',re.DEBUG