Eric V. Smith added the comment:
That sounds like a good improvement, Raymond.
--
___
Python tracker
<https://bugs.python.org/issue39705>
___
___
Python-bug
Eric V. Smith added the comment:
The code is converting to a set first, then calls sorted() on that set. So
"apple" is removed when the set is created.
I'm not sure the example should throw in creating a set while it's talking
about sorting.
--
nosy: +
Eric V. Smith added the comment:
Okay, then I agree with Serhiy on the change.
And I agree that .format(**locals()) is an anti-pattern, and should use
.format_map(locals()) instead. Not that it's related directly to this issue, I
just like to point it out where I can
Eric V. Smith added the comment:
Is this causing some practical problem? I can't think of any way to reference
non-string kwargs in a format string, but maybe I'm not being creative enough.
And if there is such a way, then changing this wouldn't be backward compatible
Eric V. Smith added the comment:
I'm going to close this. But if you have additional information that points to
this being a bug in python, we can re-open it.
--
resolution: -> not a bug
stage: -> resolved
status: pending -> closed
_
Change by Eric V. Smith :
--
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue39673>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
title: TimeoutError -> Map errno==ETIME to TimeoutError
type: behavior -> enhancement
___
Python tracker
<https://bugs.python.org/i
Eric V. Smith added the comment:
> These are both timeout errors but only `ETIMEDOUT` is accounted for?
Yes, only ETIMEDOUT is accounted for in Objects/exceptions.c. There's precedent
for mapping multiple errnos to the same exception:
ADD_ERRNO(BlockingIOError, EAGAIN);
ADD_ER
Eric V. Smith added the comment:
Ah, I see.
What platform are you on, and what's the value of errno.ETIMEDOUT?
On cygwin I get:
>>> errno.ETIMEDOUT
116
On a native Windows build I get:
>>> errno.ETIMEDOUT
10060
and on Fedora I get:
>>> errno.ETIMEDOUT
110
Eric V. Smith added the comment:
In both examples, what's being printed? It's not clear from your messages.
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
I don't see why it would. You're raising OSError, which is not a subclass of
TimeoutError, so the TimeoutError code is not executing. You don't say, but I
assume this is what you think should happen.
The exception handling machinery does not look inside
Change by Eric V. Smith :
--
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue39662>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
How do you know that isn't what is coming in over the serial port? I don't see
any indication that this is a bug in python.
We can't really help you here with this sort of problem. I suggest you take
this to the python-list mailing list:
https
Eric V. Smith added the comment:
I'd suggest mentioning this on python-dev, if you want to change the policy.
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
PEP 7 says that this is allowed:
Python versions greater than or equal to 3.6 use C89 with several select C99
features:
...
- intermingled declarations
So I don't think these changes should be accepted.
--
nosy: +eric.smith
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue39601>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
But you can't just change it without breaking the code of anyone who's relying
on the current behavior. If we could say "no one relies on that", that's would
let us move forward with such a breaking change. But I don't think we can make
that det
Eric V. Smith added the comment:
I always use datetime for testing such things. Its __format__() returns its
argument, as long as you don't have '%' in it.
I do agree that it's odd that the doubled braces cause the expression to be
evaluated, but are still kept as single braces
Eric V. Smith added the comment:
You can already do this using existing composable tools, including:
>>> list((item, idx) for idx, item in enumerate(lis))
[('a', 0), ('b', 1), ('c', 2), ('d', 3)]
>>>
We won't be adding a parameter to enumerate in order add another way of do
Eric V. Smith added the comment:
I agree that the current changes are an improvement, and should be committed.
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
I've created a PR and requested review from stevendaprano. I think the
backports are correct.
--
___
Python tracker
<https://bugs.python.org/issue39
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +1
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18401
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
That's a good improvement, Steven. I like your wording about errors better than
the wording about encoding, so how about changing the next to last sentence to:
"If errors is specified, encoding defaults to sys.getdefaultencoding()."
-
Eric V. Smith added the comment:
Can I ask how pegen solved this problem? Did you move parsing of f-strings into
the grammar?
I found my patch and I'm working on resolving merge conflicts.
--
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
Well, you asked why commas only work with decimals and I told you.
Adding "_" would require a PEP. See PEP 378 if you want to write something
similar for "_". I think it's a decent idea. You'll have to decide between 4
and 8 bits, and w
Eric V. Smith added the comment:
No one thought it made sense to have a comma every 3 bits. Or for octal or hex,
either.
Do you have some specific use case where it makes sense?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
I'll see if I can dig up the patch today. If I can find it, I'll attach it to
issue 34364.
This is really the first time I've tried to write down all of the issues
related to tokenizing f-strings. It does seem a little daunting, but I'm not
done noodling
Eric V. Smith added the comment:
Yes, my approach is to use the tokenizer to produce the parts of the f-string,
instead of treating it as a normal string and making a second pass to parse out
the pieces. I've been discussing this for a few years, and at last PyCon I
talked to many tool
Eric V. Smith added the comment:
There are a number of bugs about this. See issue 35212 and issue 34364, at
least.
I have a stale patch that tried to fix this, but I was never able to get it
completely correct.
I have another approach that I hope to discuss at the language summit at PyCon
Eric V. Smith added the comment:
I think this would be an improvement, and an good issue for a newcomer.
I'd vote for the r-string, but it doesn't really matter.
--
keywords: +easy, newcomer friendly
nosy: +eric.smith
stage: -> needs pa
Eric V. Smith added the comment:
I don't think so. I don't think the patch even did what I wanted it to do. I'll
close it.
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bug
Eric V. Smith added the comment:
> Should `dataclass.Field.type` become a property that evaluates the annotation
> at runtime much in the same way that `get_type_hints` works?
I think not. But maybe a function that evaluates all of the field types. Or
maybe an @dataclass parameter to
Eric V. Smith added the comment:
Well the type comes from the annotation, so this makes sense to me. If
dataclasses were to call get_type_hints() for every field, it would defeat the
purpose of PEP 563 (at least for dataclasses).
--
___
Python
Eric V. Smith added the comment:
Isn't that the entire point of "from __future__ import annotations"?
Also, please show the traceback when reporting errors so that I can see what's
going on.
--
___
Python tracker
<https://bu
New submission from Eric V. Smith :
What's the reason behind this change? I love UTF-8 and all, but is there some
standard (de facto or de jure) that discusses this?
What does this change fix? What's the implication to existing clients?
I'm not opposed to the change per se, but I'd like
Eric V. Smith added the comment:
Is the lack of this documentation causing some confusion somewhere? This isn't
rhetorical, I'm genuinely curious what problem you're trying to solve.
Is there any mainstream programming language where the basics of what you've
laid out aren't true? It all
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39354>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
Maybe argparse could raise an exception derived from SystemExit, then you could
catch that.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
> Ah, I see, so if I understand correctly the init method for the example given
> would become __init__(self, PARAM: int = 1, ARG: int) since the fields are
> kept in an ordered mapping
Correct.
--
assignee: -> eric.smith
resolution:
Eric V. Smith added the comment:
> During this processing of fields, couldn't you just special case
> property/descriptor objects?
What if you want the field to be a descriptor?
I think the best way of handling this would be to use some sentinel value for
the default, and if found l
Eric V. Smith added the comment:
Please discuss this idea on the python-ideas mailing list first. It would also
certainly require a PEP.
But I don't want to get your hopes up: there's almost no chance that this would
be accepted.
I'm going to close this issue. If the idea gains any
Eric V. Smith added the comment:
Your code basically becomes similar to this:
sentinel = object()
class FileObject:
_uploaded_by: str = None
uploaded_by = None
def __init__(self, uploaded_by=sentinel):
if uploaded_by is sentinel:
self.uploaded_by
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue39247>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
Eric V. Smith added the comment:
Thanks for the PRs.
--
nosy: +eric.smith
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
When creating a bug report, please show the actual errors that you get.
This is not a bug in python. In line 5 you're looking for composer2['third'],
so of course you'd need to define it.
--
components: -Regular Expressions
nosy: +eric.smith
Eric V. Smith added the comment:
On the other hand, this would generate a lot of warnings for users of
libraries, who aren't able to do anything about it. I've got tons of existing
code that uses the names of builtins as locals, to no harm. And as builtins are
added, new warnings would pop
Eric V. Smith added the comment:
Then I'd suggest removing the optimization for "abcde"[2], too. I've never seen
this in real code, and I can't come up with a scenario where it would be
performance critical. Remember, one of the goals for CPython is to be
reasonable readable, not
Eric V. Smith added the comment:
Does this occur often enough that it's worth the added code?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
I agree with Pablo's analysis. And this can't be backported, since it's a new
feature. So I'm closing this issue.
--
resolution: -> fixed
stage: needs patch -> resolved
status: open -> closed
___
Pytho
Eric V. Smith added the comment:
Is dataclasses doing something here that a regular, hand-written class wouldn't
do?
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
Thanks, all!
--
___
Python tracker
<https://bugs.python.org/issue33961>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
New changeset e28aff54d95236ea1b64b648d89a1516e446e621 by Eric V. Smith (Fabio
Sangiovanni) in branch 'master':
bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917)
(GH-17677)
https://github.com/python/cpython/commit
Change by Eric V. Smith :
--
nosy: +eric.smith, mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39096>
___
___
Python-bugs-list mailing list
Unsub
Eric V. Smith added the comment:
I agree with your approach, Mark.
And Michael: thanks for your report on the C behavior. I just wish we'd thought
to look at this 13 years ago when .format() was being discussed.
--
___
Python tracker
<ht
Eric V. Smith added the comment:
This is a duplicate of issue 39079.
I recommend that we don't "fix" this. It is only an issue with 2.7, and hasn't
been a problem for years.
--
nosy: +eric.smith
___
Python tracker
<https://bu
Eric V. Smith added the comment:
.get() is just a regular function call. And like all python functions, all of
the arguments are evaluated before the function is called. There is no
mechanism in python to delay the evaluation of a arguments.
You might want to look at collections.defaultdict
Eric V. Smith added the comment:
I agree that a quick glance in the rear view mirror shows that the design isn't
awesome. But I just don't see how we can change it at this point. It is what it
is.
And it's no surprise that int and float have the same behavior: they share the
same code
Eric V. Smith added the comment:
@Zectbumo: is this causing you any practical problem? Or is it just a curiosity?
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
I'm not sure what you mean by the "pre-width 0". Is that the "0" here:
format_spec ::=
[[fill]align][sign][#][0][width][grouping_option][.precision][type]
?
And now that I write out the question, I'm sure that's what you mean.
PEP 310
Eric V. Smith added the comment:
With 2.7.16 on cygwin, I get:
>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> help(int)
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
But given
Eric V. Smith added the comment:
I guess I could make the default value something like _CALLABLE(dict), but I'm
not sure that would do you any good. But at least you could tell from the repr
what it is.
--
___
Python tracker
<ht
Eric V. Smith added the comment:
The problem is that __init__ has to have a sentinel to know whether or not to
call the default value. If the default were just "dict", should it call it, or
is the passed in value really dict, in which case it doesn't get called?
dataclass()
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39077>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
assignee: -> eric.smith
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39078>
___
___
Python-bugs-list mai
Eric V. Smith added the comment:
Right. If you want the value only calculated once, then just call it once.
You might be interested in collections.defaultdict, which takes a factory
function, and only calls it as needed.
--
nosy: +eric.smith
resolution: -> not a bug
st
Eric V. Smith added the comment:
Agreed on closing this issue.
--
___
Python tracker
<https://bugs.python.org/issue38996>
___
___
Python-bugs-list mailin
Eric V. Smith added the comment:
Is there something that your module can do that typing.NamedTuple can't do?
This won't be added to 2.7: 3.9 would be the first possible version to add a
feature to.
--
assignee: -> rhettinger
nosy: +eric.smith, rhettinger
versions: -Python
Eric V. Smith added the comment:
This is almost certainly not a bug in Python.
The bug tracker isn't for giving help with your code. I suggest you ask on the
python-list mailing list https://mail.python.org/mailman/listinfo/python-list
If you still think this is a bug in Python, you should
Eric V. Smith added the comment:
Yes, moving f-strings to the grammar would be a huge change, and not just for
CPython.
I discussed it at the last PyCon with the authors of various editors (for
syntax highlighting) and other tools that parse python code. No one was hugely
opposed
Eric V. Smith added the comment:
I agree that although the PEP says that's how it behaves, that shouldn't be
prescriptive of the error message. Clearly we can be more helpful here.
I have a large, elaborate re-write of the error generating code that I've been
working on, on and off for over
Change by Eric V. Smith :
--
assignee: -> eric.smith
stage: resolved ->
___
Python tracker
<https://bugs.python.org/issue38964>
___
___
Python-bugs-list
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue38947>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
Your failing test case with 3.7 works for me.
If you don't use activate.bat, but just run the venv's python directly, what do
you see? I get:
>py -m venv fooenv
>fooenv\Scripts\python -V
Python 3.7.0
>fooenv\Scripts\python -q
>>>
Eric V. Smith added the comment:
I agree this doesn't look like a python bug.
However, if the original poster can reproduce it with a short example with no
third party code, we could take another look. If so, please re-open this issue.
And just because the code worked on a different version
Eric V. Smith added the comment:
Yes, this does seem to be a duplicate. I'll close this.
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
Well, the standard says they're case insensitive:
https://tools.ietf.org/html/rfc7230#section-3.2
Forcing the case on the header item seems quite deliberate:
https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L399
I assume
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38670>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
I'm not sure what you're proposing.
--
___
Python tracker
<https://bugs.python.org/issue38758>
___
___
Python-bugs-list mailin
Eric V. Smith added the comment:
The problem is that what you wrote isn't what most people want. Here's your
example without dataclasses. I've added an "append_to_x" method, which does the
obvious thing:
>>> class C:
... def __init__(self, x=[]):
... self.x
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38758>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
resolution: -> not a bug
___
Python tracker
<https://bugs.python.org/issue38740>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
Also: you're statement that bar was initialized to "some value" isn't true: you
didn't use attr1 in your __init__ method, so "some value" was never used.
If you're confused, I suggest you ask on the python-list or tutor mailing
lists. M
Eric V. Smith added the comment:
This isn't a bug, it's how the language works. You're not forced to use the
parameters to a function (in this case __init__), and you can reference any
variable, including a global.
--
components: -asyncio
nosy: +eric.smith
Eric V. Smith added the comment:
I don't think that's necessary. We should just document that parameters are
passed by name to __post_init__. This would have to be a 3.9 feature, since
it's not strictly backward compatible.
--
versions: +Python 3.9 -Python 3.7
Eric V. Smith added the comment:
I think using named parameters in the call to __post_init__ is reasonable. It's
currently positional.
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issu
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38706>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38693>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
title: String format for hexadecimal notation breaks padding with alternative
form -> Clarify numeric padding behavior in string formatting
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
Now that I re-read this, maybe it was a documentation request, not a functional
change? I'd be okay with documenting the existing behavior, so I'll re-open
this and change the type. Patches welcome.
--
components: +Documentation
resolution: rejected
Eric V. Smith added the comment:
int.__format__ inherits this from %-formatting, which inherits it from C's
printf.
There's no way we're going to change this at this point: the breakage would be
too great. So, I'm going to reject this.
--
assignee: -> eric.smith
nosy: +eric.sm
Eric V. Smith added the comment:
> It is a limitation of f-strings, though. We're not allowed to use
> backslashes within the f-string expression in curly braces.
I've considered relaxing these restrictions, although it's very complicated.
The parser would need to become aware of
Eric V. Smith added the comment:
Closed in favor of issue 36661 (which I realize was opened later, but has more
discussion, so I'm using it going forward).
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Pytho
Eric V. Smith added the comment:
I think this is a reasonable request. It would have to be a 3.9 feature.
Perhaps some code (and tests) can be stolen from poplib.
--
nosy: +eric.smith
stage: -> needs patch
versions: -Python 3.5, Python 3.6, Python 3.7, Python
Eric V. Smith added the comment:
Yes, it's always guaranteed to be lowercase. I don't think it would hurt to
mention lowercase briefly (like add just one word!).
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38
Eric V. Smith added the comment:
I'm not sure what can be done with this. The problem is that the decorator
doesn't know what's in the caller's namespace. The type being added is
"typing.Any". If the caller doesn't import typing, then get_type_hints will
fail (as demonst
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue38605>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
This is a duplicate of issue 36661.
--
nosy: +eric.smith
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Missing dataclass decorator import in dataclasses module docs
__
Eric V. Smith added the comment:
Yury: I'm okay with merging. If I recall, you were going to add a comment or
two about the approach (a closure, if I remember correctly).
I think we should backport to 3.8 and 3.7: it's a bug.
--
___
Python
Eric V. Smith added the comment:
This is explicitly mentioned in PEP 572 as being disallowed:
"Due to design constraints in the reference implementation (the symbol table
analyser cannot easily detect when names are re-used between the leftmost
comprehension iterable expression and the
1101 - 1200 of 2689 matches
Mail list logo