leewz added the comment:
Why not both?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26809>
___
___
Python-bugs-list
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(
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
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
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
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
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
leewz added the comment:
Thanks. Will visit them.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25428>
___
___
Python-bugs-list
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
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
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
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
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
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
14 matches
Mail list logo