Eric V. Smith added the comment:
That sounds good to me.
Just to elaborate on my earlier message, since it might have been too terse:
I think it would be misleading to give in error at:
print >>sys.stderr, "message"
and say:
Did you mean 'print("message")'?
si
Eric V. Smith added the comment:
Good question.
It looks like ChainMap does something I wouldn't expect:
>>> for k, v in ChainMap({'a': 0, 'b': 1, 'c': 2}, {'b': 3, 'a': 4}).items():
... print(k, v)
...
b 1
a 0
c 2
Once we define what we'd like the output to look like, I'm sure
Eric V. Smith added the comment:
Correct on the order changed with regular dicts. That's why I'm targeting this
specifically for Python 3.7 and with **kwargs, where order is guaranteed. We
might have to use a structure other than a ChainMap of dicts, like a ChainMap
of OrderDicts
Eric V. Smith added the comment:
Correction: it's implemented in unittest.case._SubTest, specifically in
_subDescription().
--
title: Change unittest's _SubTest to not sort its params -> Change unittest's
_SubTest to not sort its params when printing test failu
Changes by Eric V. Smith <e...@trueblade.com>:
--
pull_requests: +2285
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30682>
___
_
New submission from Eric V. Smith:
>>> eval("f'\\\n'")
python: Python/ast.c:4906: FstringParser_ConcatFstring: Assertion
`!state->last_str || PyUnicode_GET_LENGTH(state->last_str) != 0' failed.
[2]12810 abort (core dumped) ./python
The problem is that some litera
Changes by Eric V. Smith <e...@trueblade.com>:
--
pull_requests: +2277
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30529>
___
_
Eric V. Smith added the comment:
New changeset 2eca5b465f7404cc8484457b7966f828f434ec20 by ericvsmith (Serhiy
Storchaka) in branch '3.6':
[3.6] bpo-30682: Removed a too-strict assertion that failed for certain
f-strings. (GH-2232) (#2242)
https://github.com/python/cpython/commit
Eric V. Smith added the comment:
Terry:
The eval is important. The bug was in evaluating an f-string that consisted of
two bytes: a backslash followed by a newline.
And just as:
eval("'\\\n'") == '' # len == 0
so should
eval("f'\\\n'") == '' # len == 0
It's the second o
New submission from Eric V. Smith:
Now that **kwargs are sorted, it would be better if the error given by a
unittest subTest (as implemented in uniitest._case._SubTest) didn't sort the
parameters when they're printed, but instead printed them out in order.
This might be complicated
Eric V. Smith added the comment:
The Unix "od" command pretty much has all of the possibilities covered.
https://linuxconfig.org/od-1-manual-page
Although "named characters" might be going a bit far. Float, too.
--
___
Eric V. Smith <e...@trueblade.com> added the comment:
I think it's fixed. Closing.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<https://bu
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31684>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
Hi, Francesco.
This isn't the appropriate place to ask for help with your script.
I suggest trying the python-list mailing list.
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> resolved
status: op
Eric V. Smith <e...@trueblade.com> added the comment:
I agree there's no need for tests, since we usually don't guarantee such
messages going forward. Also, I think skipping the news blurb is reasonable for
this change.
--
___
Python tracke
Eric V. Smith added the comment:
See also issue 31140: I'm not sure if that case is covered by this issue.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Eric V. Smith added the comment:
That code is an error in Python 3.6:
>>> f"{eval('bool(0)\
... and True\
... ')}"
File "", line 3
SyntaxError: f-string expression part cannot include a backslash
>>>
I'm not sure it's a good idea that jupyter accepts c
Eric V. Smith added the comment:
New changeset e7c566caf177afe43b57f0b2723e723d880368e8 by ericvsmith (Łukasz
Langa) in branch 'master':
bpo-30465: Fix lineno and col_offset in fstring AST nodes (#1800)
https://github.com/python/cpython/commit/e7c566caf177afe43b57f0b2723e723d880368e8
Eric V. Smith added the comment:
I'm thinking that instead of supporting backslashes in general inside
expressions, I'll just special case strings.
So:
f"{'\n' if foo else ''}"
would be okay, but not:
f"{a\
}"
I think that would address the reason why \ was disallowed, bu
Eric V. Smith added the comment:
New changeset aa1afc72c1ee1f090e6302198d9a0295f1ce1c05 by ericvsmith (Miss
Islington (bot)) in branch '3.6':
bpo-30465: Fix lineno and col_offset in fstring AST nodes (GH-1800) (gh-3409)
https://github.com/python/cpython/commit
Eric V. Smith added the comment:
Yes, due to backward compatibility constraints, the behavior is immutable.
You might be able to argue for another method, say all_hosts(), or something.
Or maybe even a optional parameter to hosts() that defaults to the existing
behavior, but if provided, lets
Eric V. Smith added the comment:
You lost me at "some Windows mentality". I come from a networking background.
Sorry, I don't care enough about this issue to pursue it.
--
___
Python tracker <rep...@bugs.python.org>
<http
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31634>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
This is a daylight savings time folding problem. Without a timezone, those are
in fact the same point in time, at least in my timezone (US Eastern).
If you specify a timezone, you'll see the difference:
datetime.datetime(2014,3,9,2,
Eric V. Smith <e...@trueblade.com> added the comment:
Loïc Le Loarer: Note that your use case isn't possible, anyway. There's no way
to know the number of groups until the input is exhausted, at which point
you've already iterated through all of the data.
--
nosy: +eric
Eric V. Smith added the comment:
Jim: did you forget to attach the z.py script?
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Eric V. Smith added the comment:
I think this is a function of the .pth file causing 'zc' to be in sys.modules.
If I delete the .pth file, the first import of zc.m succeeds.
Note that if the .pth file is in place, then:
% bin/python3
Python 3.6.1 (default, Mar 24 2017, 12:50:34)
[GCC 5.4.0
Eric V. Smith added the comment:
No problem. If you open a pypa issue, can you post a link here? Thanks.
--
resolution: -> not a bug
type: -> behavior
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Eric V. Smith added the comment:
New changeset 06de1aeff94e524bed21d188065c4cd1590fb046 by ericvsmith (Zhiming
Wang) in branch 'master':
bpo-31281: Fix pathlib.Path incompatibility in fileinput (gh-3208)
https://github.com/python/cpython/commit/06de1aeff94e524bed21d188065c4cd1590fb046
Eric V. Smith added the comment:
I did not backport this to 3.6, because it depends on other changes that
themselves have not been backported.
--
assignee: -> eric.smith
resolution: -> fixed
stage: -> resolved
status: open -> closed
versions: -Python 3.4
Changes by Eric V. Smith <e...@trueblade.com>:
--
stage: -> needs patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31140>
___
_
Changes by Eric V. Smith <e...@trueblade.com>:
--
versions: +Python 3.7
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31140>
___
Eric V. Smith <e...@trueblade.com> added the comment:
Removing versions 3.4 and 3.8.
Attaching a reproducing script. Run it with a parameter of the number of
arguments to add. The behavior changes between 7 and 8, although I'm not sure
either is wrong, just different. This is from W
Eric V. Smith <e...@trueblade.com> added the comment:
Good point.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31768>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
A library implementing this should definitely go on PyPI first to shake out
design issues. Then we'd need a PEP.
As someone who has a simplistic version of this code around, and who's done a
bit of string formatting, I can assu
Eric V. Smith <e...@trueblade.com> added the comment:
I don't have clr installed in order to test this. It would be good if you could
produce it without us having to install additional software.
Could you please copy the entire stack traceback you get when this error occurs?
Does this
Eric V. Smith <e...@trueblade.com> added the comment:
It does seem like overkill for something that's rarely used. I'm -0 on the
structseq version.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
dict.update() returns None, so this is expected. Maybe you want:
>>> x = {"X":123}
>>> x.update({"abc":123})
>>> x
{'X': 123, 'abc': 123}
>>>
--
nosy: +eric.smith
resolu
Eric V. Smith <e...@trueblade.com> added the comment:
The heap invariant is also required in order to even meet the documented
behavior of returning the smallest item.
>>> import heapq
>>> li = [5, 7, 9, 1, 4, 3]
>>> heapq.heapify(li)
>>> li
[1, 4, 3
Eric V. Smith <e...@trueblade.com> added the comment:
By "sorted" I meant "sorted by the heap functions so as to maintain their
invariants".
I don't have any suggestion for the actual specific language to use.
--
_
Eric V. Smith <e...@trueblade.com> added the comment:
No problem. Welcome to Python!
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
This is defined behavior. Try searching for "mutable default parameter". For
example, here's an old post on it:
http://www.effbot.org/zone/default-values.htm
This isn't related to class vs. instance attributes, but ra
Eric V. Smith <e...@trueblade.com> added the comment:
dict makes no guarantees on ordering, so I think the example is fine. There is
no "correct" ordering.
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
&l
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch
pull_requests: +4616
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
New submission from Eric V. Smith <e...@trueblade.com>:
PR to follow. Development was at https://github.com/ericvsmith/dataclasses
--
assignee: eric.smith
components: Library (Lib)
messages: 307596
nosy: eric.smith, ned.deily
priority: normal
severity: normal
status: open
Eric V. Smith <e...@trueblade.com> added the comment:
New changeset f0db54a0a1823534606ed5ce5a772365ba694c41 by Eric V. Smith in
branch 'master':
bpo-32214: Implement PEP 557: Data Classes (#4704)
https://github.com/python/cpython/commit/f0db54a0a1823534606ed5ce5a772365ba
Change by Eric V. Smith <e...@trueblade.com>:
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<https://bu
New submission from Eric V. Smith <e...@trueblade.com>:
The documentation needs to be added.
--
assignee: docs@python
components: Documentation
messages: 307614
nosy: docs@python, eric.smith
priority: high
severity: normal
status: open
title: Document PEP 557 Data Classes
ve
Eric V. Smith <e...@trueblade.com> added the comment:
The PR looks okay to me. I'm also not sure it's worth the change, though.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
I'm going to use "typing.Any" (as a string) if the type information is omitted
in the call to make_dataclass(). That way I don't need to import typing.
--
___
Pyt
Eric V. Smith <e...@trueblade.com> added the comment:
Yes, this is a real problem. I think there's already an issue for this, but I
can't find it.
Unfortunately, to fix it requires a bit of refactoring on how line numbers and
errors are tracked. It's on my list of things
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32303>
___
_
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32305>
___
_
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31554>
___
_
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32297>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
The example above (msg289501) has been fixed. I think it was in #30465.
It also fixes some of these other cases, but I haven't reviewed them all.
--
___
Python tracker <rep...@bugs.p
Eric V. Smith <e...@trueblade.com> added the comment:
Can you reproduce this with a much smaller example?
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
That's too much code for me to run without analyzing it first. If I have time,
I'll look at it.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
Despite the fact that as of now (or 6+ years ago!) the only way to trigger the
malloc() is via VT_LPSTR, I still think the way the free() call is written is
bad. What if another type is added?
If that were fixed, I still think the
Change by Eric V. Smith <e...@trueblade.com>:
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32018>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
I cannot imagine this ever happening, for performance reasons.
You should write your own wrapper around items, if you want this behavior.
--
nosy: +eric.smith
___
Python tracke
Eric V. Smith <e...@trueblade.com> added the comment:
Guido's suggestion in
https://mail.python.org/pipermail/python-dev/2017-October/150055.html is to not
change anything.
Assuming we do that, it's still an open issue as to if/how we should document
and test the current behavio
Change by Eric V. Smith <e...@trueblade.com>:
--
resolution: fixed -> not a bug
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
New submission from Eric V. Smith <e...@trueblade.com>:
Make the typing information optional.
>From Raymond Hettinger:
The make_dataclass() factory function in the dataclasses module currently
requires type declarations. It would be nice if the type declarations were
optional.
Wi
New submission from Eric V. Smith <e...@trueblade.com>:
make_dataclass() should take optional keyword only arguments and pass them to
@dataclass() when it uses it after it creates a new class.
The parameters are:
init=True, repr=True, eq=True, order=False, hash=None, frozen=False
Obv
Eric V. Smith <e...@trueblade.com> added the comment:
The error message is correct, but I'm sorry it's confusing.
Here's an equivalent error:
a, b = 3
You'll get the error "TypeError: 'int' object is not iterable". That's because
Python sees 2 items to the left of the assignm
Eric V. Smith <e...@trueblade.com> added the comment:
I agree with David. And since the PR says "not other", then it makes even less
sense, since it's checking for any False-y object.
I recommend closing this as "not a bug".
--
Eric V. Smith <e...@trueblade.com> added the comment:
How would you distinguish this from the case where an actually missing
attribute was given?
>>> "{0.ctimex}".format(d)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'datetim
New submission from Eric V. Smith <e...@trueblade.com>:
This is especially true for the "type" member, since it might be a string that
looks like a type name (depending on how #33453 is resolved). But repr should
be used for all Field members.
--
assignee: eric.
New submission from Eric V. Smith <e...@trueblade.com>:
I've had several requests for keyword-only arguments. This is a placeholder to
remind me to work on it. I have not decided if it's a good idea or not.
I propose adding a keyword_only argument to field(), defaulting to False.
I'm th
Change by Eric V. Smith <e...@trueblade.com>:
--
pull_requests: -6490
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33494>
___
Eric V. Smith <e...@trueblade.com> added the comment:
Followup from our meeting at the sprints: we're going to go with inspecting the
type annotation string and use heuristics to determine if the type is a
ClassVar or InitVar. I'll follow up with more specifics on the ap
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch
pull_requests: +6483
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Change by Eric V. Smith <e...@trueblade.com>:
--
pull_requests: +6492
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33494>
___
_
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch
pull_requests: +6491
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Change by Eric V. Smith <e...@trueblade.com>:
--
pull_requests: -6483
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33494>
___
Eric V. Smith <e...@trueblade.com> added the comment:
New changeset 3059042410dce69806b94be72d5c8055d616f3a3 by Eric V. Smith in
branch 'master':
bpo-33502: dataclass._Dataclassparams repr: use repr of each member. (GH-6812)
https://github.com/python/cpython/
New submission from Eric V. Smith <e...@trueblade.com>:
This is mostly a debugging aid, but if you need it, it's very handy.
--
assignee: eric.smith
components: Library (Lib)
messages: 316542
nosy: eric.smith, ned.deily
priority: release blocker
severity: normal
status: open
Change by Eric V. Smith <e...@trueblade.com>:
--
priority: release blocker ->
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch
pull_requests: +6498
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Eric V. Smith <e...@trueblade.com> added the comment:
Note that the documentation should make the implications of #33453 very clear.
In short, if an annotation "looks like" a ClassVar or InitVar, it will be
treated as such. This is true even if it's specified as a string, or i
Change by Eric V. Smith <e...@trueblade.com>:
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<https://bu
Eric V. Smith <e...@trueblade.com> added the comment:
Like #33463, it will require a deprecation cycle. I'm not sure it's worth the
hassle, but I wouldn't oppose it if someone wanted to do the work. 3.8 would be
the first version where it could be added.
--
nosy: +eric.smith
ve
Change by Eric V. Smith <e...@trueblade.com>:
--
priority: release blocker ->
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<https:/
Eric V. Smith <e...@trueblade.com> added the comment:
I'm okay with the concept, but I don't know how to implement it. You need to
not only know if a class has a __init__, but also if it's expected to be called.
For example, these don't normally get called, but if you inherit fro
Change by Eric V. Smith <e...@trueblade.com>:
--
assignee: -> eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33452>
___
_
Eric V. Smith <e...@trueblade.com> added the comment:
This is a known issue, but it wasn't being tracked here. So, thanks for opening
the issue.
https://github.com/ericvsmith/dataclasses/issues/92#issuecomment-382473127
Not to put Łukasz on the spot (he's sitting behind me even as we
Eric V. Smith <e...@trueblade.com> added the comment:
I see that https://github.com/python/typing/issues/508 is also referenced in
https://github.com/python-attrs/attrs/issues/361, where it contributed to attrs
using string insp
Eric V. Smith <e...@trueblade.com> added the comment:
See also [2]_ for a brief discussion of forward references, which makes
get_type_hints() undesirable in this case.
> This is why attrs went with the fast way which covers most (but not all)
> bases in this case. If th
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch, patch
pull_requests: +6455, 6456
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Change by Eric V. Smith <e...@trueblade.com>:
--
keywords: +patch
pull_requests: +6456
stage: -> patch review
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Eric V. Smith <e...@trueblade.com> added the comment:
Can you explain your use case for this?
Also, how do you envision this working with the existing frozen, hashing, and
equality behavior? There are a lot of interactions there, and we'd want to do
something that makes sense holist
Eric V. Smith <e...@trueblade.com> added the comment:
At this stage in the release cycle, if you really feel strongly about this, you
should take it up with Guido directly.
--
assignee: -> eric.smith
___
Python tracker <rep...@bug
Eric V. Smith <e...@trueblade.com> added the comment:
After locale.setlocale(locale.LC_ALL, ''), what does local.localeconv() return?
--
nosy: +eric.smith
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Eric V. Smith <e...@trueblade.com> added the comment:
There have been comments on the PR, but I'd like to focus the higher level
issue back here. Specifically, see my comment
https://github.com/python/cpython/pull/6768#discussion_r187813919
To summarize: I still think string inspe
Eric V. Smith <e...@trueblade.com> added the comment:
We can't break the API at this point in the release cycle. But I am open to
what string prefixes we should allow.
--
___
Python tracker <rep...@bugs.python.org>
<https://
Eric V. Smith <e...@trueblade.com> added the comment:
The more I think about this, the more I think Łukasz is correct that just
checking for strings starting with "ClassVar", "typing.ClassVar", or
"t.ClassVar" is the correct thing to do. This is the change h
Eric V. Smith <e...@trueblade.com> added the comment:
It's not clear to me what you're typing to get the output in the first message.
Can you clarify? Is this at the interactive prompt?
--
___
Python tracker <rep...@bugs.python.or
Change by Eric V. Smith <e...@trueblade.com>:
--
priority: release blocker ->
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8
___
Python tracker <rep...@bugs.python.org>
New submission from Eric V. Smith <e...@trueblade.com>:
There's an unnecessary test for "if typing" in _is_classvar. I added this
function yesterday, and due to some refactoring it picked up some superfluous
text. I'm going to remove it.
--
assignee: eric.smith
com
801 - 900 of 2689 matches
Mail list logo