Change by Eric V. Smith :
--
assignee: -> eric.smith
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39078>
___
___
Python-bugs-list mai
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39077>
___
___
Python-bugs-list mailing list
Unsubscribe:
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?
datacla
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
&
Eric V. Smith added the comment:
With 2.7.16 on cygwin, I get:
>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> help(int)
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx
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
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 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 th
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:
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
<
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
&
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:
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/cpyt
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:
Is dataclasses doing something here that a regular, hand-written class wouldn't
do?
--
___
Python tracker
<https://bugs.python.org/is
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
_
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/is
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
reasonabl
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
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 Expressio
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
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue39247>
___
___
Python-bugs-list mailing list
Unsubscrib
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
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
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 fo
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:
Maybe argparse could raise an exception derived from SystemExit, then you could
catch that.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39
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:
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
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,
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
<
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:
> 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:
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
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: ->
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:
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
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 n
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:
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 b
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.py
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()."
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:
I've created a PR and requested review from stevendaprano. I think the
backports are correct.
--
___
Python tracker
<https://bugs.python.org/is
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:
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 paramete
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
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 w
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:
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.
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/is
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 maili
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:
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 no
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.o
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
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);
A
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:
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
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 back
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
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.
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:
This sounds like an issue with PyScripter. I suggest you ask them for guidance
on how to debug it.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
I'm going to close this. If you have more information that shows it's a bug in
Python, we can re-open it.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Pyt
Eric V. Smith added the comment:
I agree that could probably be simplified, if the format_spec is constant
(which it need not be).
>>> ast.dump(ast.parse('f"is {x:d}"'))
"Module(body=[Expr(value=JoinedStr(values=[Str(s='is '),
FormattedValue(v
Eric V. Smith added the comment:
> FYI you can use ast CLI:
I did not know that. That's awesome, thanks for pointing it out.
--
___
Python tracker
<https://bugs.python.org
Eric V. Smith added the comment:
I strongly disagree. Even if I thought it was a good idea (I don't), we'd break
too much code by making this change now.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.o
Eric V. Smith added the comment:
Can you give us some information about your operating system? Did you build
this version of python yourself? Assuming so, how did you build it? Please show
us the header you see when starting this version of python. How are you
invoking this test
Eric V. Smith added the comment:
This is by design. See
https://eli.thegreenplace.net/2011/05/15/understanding-unboundlocalerror-in-python
for a good explanation.
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> resolved
status: open -&g
Eric V. Smith added the comment:
I suggest closing this issue. If the REPL is going to be improved, it won't be
done one-feature-at-a-time on the bug tracker. It will need to have a holistic
design that takes into account desired features and the architecture of the
systems that it nee
Eric V. Smith added the comment:
Yes, this is a known issue.
See https://docs.python.org/3/reference/compound_stmts.html#the-try-statement,
in particular the sentence "When an exception has been assigned using as
target, it is cleared at the end of the except clause" and the foll
Eric V. Smith added the comment:
That behavior is consistent with other exceptions. It's a helpful piece of
information if you were to see it in a traceback, without any other context. So
this is by design.
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> reso
Eric V. Smith added the comment:
Reasonable people can disagree. If someone else thinks this can be done
piecemeal, then I'm not stopping anyone. I just think that's a mistake and will
lead to much frustration.
--
___
Python track
Eric V. Smith added the comment:
Do you have some concrete use case for this, or is this a speculative feature
request?
This will do what you want, although it uses some undocumented internals of the
_string module. I've only tested it a little, and I've done especially little
t
Eric V. Smith added the comment:
I suggest using the version I posted here and see if it meets your needs. It
uses the str.format parser to break the string into pieces, so it should be
accurate as far as that goes.
--
___
Python tracker
<ht
Eric V. Smith added the comment:
Well, I'm the one who made them private, I can make them public if they're
useful. But I won't do that if you're not willing to look at it.
--
___
Python tracker
<https://bug
Eric V. Smith added the comment:
This looks like a network problem on your end, not a python bug. The bug
tracker is not the place to get help for such an issue. You might try the
python-list mailing list, although your best bet is to find someone locally who
can help you debug your network
Eric V. Smith added the comment:
I believe this is by design, as is the same restriction on statement-level
assignment expressions. And if requiring parens discourages the use of
assignment expressions in asserts, I think that's a good thing.
Why not just use the workaround you'
Eric V. Smith added the comment:
I'm going to close this, since I can't imagine this restriction being relaxed.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs
Eric V. Smith added the comment:
I know it's of limited use, but for me, this code works (returns True) on
Cygwin versions 3.8.0b4 and 3.7.4.
On a native Windows build 3.8.0a0, I get the exception the OP shows.
I'll try and install comparable versions when I'm at a locat
Eric V. Smith added the comment:
I think it's too late to change this. Is this a documentation issue?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/is
Eric V. Smith added the comment:
This is the python bug tracker. What you are reporting is almost certainly not
a bug in python. If you think it is a bug in python, please reproduce it in the
smallest possible code fragment, and with no third party libraries installed.
If you're se
Eric V. Smith added the comment:
Hi, Sandeep. For information see
https://mail.python.org/mailman/listinfo/python-list
--
___
Python tracker
<https://bugs.python.org/issue39
Eric V. Smith added the comment:
Agreed it's a duplicate, so I'm closing this. For any further discussion,
please use issue39291, or better yet, do as it suggests and discuss this on
python-dev.
--
resolution: -> duplicate
stage: patch review -> resolved
status
Eric V. Smith added the comment:
The asdict API was a mistake, because it's not possible for it to know how to
create all possible sub-objects. I can't decide what to do about it. I might
just "abandon it in place", by documenting its problems and suggesting it not
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39939>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue39940>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
I think the missing closing quote is supposed to be your visual clue that it's
truncated. Although I'll grant you that it's pretty subtle.
--
nosy: +eric.smith
versions: +Python 3.9
___
Python
Eric V. Smith added the comment:
tell() is opaque when opening a text file: you can't interpret the output, its
only use is for input to seek().
>From the docs
>https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects:
"f.tell() returns an integer giving t
Eric V. Smith added the comment:
> That can big problem when I use serialization if f.tell() is "cookie".
I'm sorry, but that's the way it is with text files. You'll need to find some
other way to accomplish what you're trying to achieve.
Since this isn
Eric V. Smith added the comment:
I don't think that was meant to be a literal example. I think that "..." here
means "and other strings".
--
nosy: +eric.smith
___
Python tracker
<https:
Eric V. Smith added the comment:
For what it's worth (which might not be much), here is what black produces:
Module(
body=[
Expr(
value=Call(
func=Name(id="spam", ctx=Load()),
args=[Name(id="eggs", ctx=Loa
Eric V. Smith added the comment:
Note that 2.7 is no longer supported.
If you think you found a bug in 3.7, then please:
- Reformat your code so that we can understand it.
- Show us what output you actually get.
- Show us what output you expect, and why.
--
nosy: +eric.smith
Eric V. Smith added the comment:
Can you see if the patch in issue27307 solves your problem?
--
___
Python tracker
<https://bugs.python.org/issue39985>
___
___
Eric V. Smith added the comment:
In fact, this is a duplicate of issue27307, so I'm going to close this.
--
resolution: -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder: -> string.Formatter does not support key/attribute access on
Change by Eric V. Smith :
--
nosy: +tekknolagi
___
Python tracker
<https://bugs.python.org/issue27307>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.5, Python 3.6
___
Python tracker
<https://bugs.python.org/issue27
801 - 900 of 2699 matches
Mail list logo