Eric V. Smith added the comment:
They are very different. I don’t see how they could be combined. PEP 557 goes
in to some of the differences.
--
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
This sounds like a flask problem, not a python bug.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
I don't think we get enough information from the operating system in order to
generate the message that you'd like to see, unfortunately.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
That seems reasonable to me.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44740>
___
___
Python-bug
Eric V. Smith added the comment:
Also, when dataclasses was originally written, it deliberately did not import
typing, for performance reasons. I don't know if PEP 560 (I think) improved
performance enough to make a difference. But adding this dependency needs to be
looked at.
But if we
Eric V. Smith added the comment:
I’m deferring any action on this until PEP 649 is ruled on.
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issu
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue44674>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
When I originally read this, I read it as frozenset. I agree that there's no
good way of telling if an arbitrary class is immutable, so I'm not sure we can
do anything here.
So I think we should close this as a rejected idea
Eric V. Smith added the comment:
The more I think about this, the less I like it as a dataclasses-specific
solution (if it’s accepted at all, that is). Why dataclasses and not attrs or
NamedTuple? I suggest bringing it up on python-ideas for wider exposure
Eric V. Smith added the comment:
Can you provide a specification of what this class does? You’ve given an
example, but not a description of the behavior.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
It can’t be resolved in fields(): it is still undefined when the fields are
created.
I think the best solution is PEP 649.
--
___
Python tracker
<https://bugs.python.org/issue36
Eric V. Smith added the comment:
The difference is that type(cmd) is doing an exact match on the type, while
isinstance is checking for types or derived types. I don't know if that makes a
difference here, but it's worth noting.
--
nosy: +eric.smith
Eric V. Smith added the comment:
I think we'd be better off adding a doc parameter to dataclasses.field, and
then as @terry.reedy says, modify inspect.getdoc and maybe_finddoc to look in
__dataclass_fields__, if it exists.
--
versions: +Python 3.11 -Python 3.10
Eric V. Smith added the comment:
Yes, this is a "feature" of str.format. If it looks like a number, it's
converted to a number, else it's used as a string. It's generally the most
useful way to interpret subscripts, but as you note it doesn't handle all cases.
--
nosy: +
Eric V. Smith added the comment:
I agree that would be an improvement.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44674>
___
___
Pytho
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue42861>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
With Pablo's changes, the error now reads (in 3.11):
obj.b
^
AttributeError: 'Example' object has no attribute 'b'
Which is a vast improvement!
I'm working on a PR to initialize obj.b in __init__
Eric V. Smith added the comment:
I think a PR with tests would be a good first step.
--
___
Python tracker
<https://bugs.python.org/issue35673>
___
___
Pytho
Change by Eric V. Smith :
--
title: Confusing message with AttributreError when attribute name matches
suggestion -> Confusing message with AttributeError when attribute name matches
suggestion
___
Python tracker
<https://bugs.pyth
Change by Eric V. Smith :
--
title: Confusing message with AttributreError suggestions -> Confusing message
with AttributreError when attribute name matches suggestion
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
Got it. Thanks for jumping on this quickly.
--
title: Confusing error with __slots__ -> Confusing message with AttributreError
suggestions
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
Thanks, Pablo!
--
___
Python tracker
<https://bugs.python.org/issue44655>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
It's obviously not super important, but it would be nicer if the version with
the suggestion were more like the version without the suggestion. Specifically,
mentioning the object type:
>>> class E:
... __slots__=('a')
...
>>> E()
Eric V. Smith added the comment:
Also, the dot after the first 'b' was confusing to me: I thought it had
something to do with an attribute of b. And the quotes around the second 'b'
were also confusing, but that's mostly because the original example initialized
a class variable named 'b
Eric V. Smith added the comment:
I created issue 44655 for the confusing error message.
The problem with dataclasses is that the instance variable 'b' needs to be
initialized, instead of the current dataclasses behavior where it relies on the
class variable when reading 'b
New submission from Eric V. Smith :
This is related to issue 44649. This is the simplest non-dataclasses case I
could come up with.
Given:
class Example:
__slots__ = ('a', 'b')
def __init__(self, a):
self.a = a
obj = Example(42)
print(obj.b)
I get this in 3.10 and main
Change by Eric V. Smith :
--
assignee: -> eric.smith
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44649>
___
___
Python-bugs-list mai
Eric V. Smith added the comment:
Yes, thank you Leonardo!
There are probably places in the stdlib where changing to f-strings would be a
performance improvement. Of course finding those places is the challenge!
--
nosy: +eric.smith
___
Python
Eric V. Smith added the comment:
As the author of PEP 420, I think having test discovery support namespace
packages is a mistake, at least in the sense of pretending every directory is a
namespace package.
--
nosy: +eric.smith
___
Python tracker
Eric V. Smith added the comment:
> As a side note, I think making the install restrictive is more work than
just let it install where user wants to install. The restrictions need to
be coded - don't they? :)
Well at this point, the restrictions already exist! So change it
Eric V. Smith added the comment:
Can you provide a short code example that reproduces this, preferably without
using any third party libraries?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
This is not a bug, but expected floating point behavior. See
https://docs.python.org/3/tutorial/floatingpoint.html
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> resolved
status: open -> closed
type: -&
Eric V. Smith added the comment:
I agree this should be closed (and I'm closing it). I don't see any reason why
this function should do something other than raise TypeError if given bs=None.
If you want that behavior, write a small wrapper function.
The "if not bs" che
Change by Eric V. Smith :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eric V. Smith :
--
components: +Windows
nosy: +eric.smith, paul.moore, steve.dower, tim.golden, zach.ware
title: subprocess.run gets stuck indefinitely -> On Windows, subprocess.run
gets stuck indefinitely
___
Python tracker
<
Eric V. Smith added the comment:
Clarifying the title.
--
nosy: +eric.smith
title: exception is thrown if bs = None -> In Lib/urllib/parse.py
quote_from_bytes, exception is thrown if bs = None
___
Python tracker
<https://bugs.pyth
Change by Eric V. Smith :
--
assignee: -> eric.smith
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue44475>
___
___
Python-bugs-
Eric V. Smith added the comment:
You should bring this up on the python-ideas mailing list if you want some
discussion.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44496>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
I don't think there's any action to be done here, so I'm going to close this.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
Please give a complete example that we can execute.
--
___
Python tracker
<https://bugs.python.org/issue44475>
___
___
Pytho
Eric V. Smith added the comment:
Thanks, Irit.
I'm closing this as "won't fix".
--
resolution: out of date -> wont fix
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bug
Eric V. Smith added the comment:
I tend to agree with Mark: any change would be disruptive, and it doesn't seem
to be causing any real problem.
Irit: did you come across this because it's causing a problem somewhere?
--
___
Python tracker
<ht
Eric V. Smith added the comment:
I'm going to close this. If you can reproduce it with a smaller program that we
can test, please attach the information and re-open this issue.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
type: -&
Change by Eric V. Smith :
--
title: dataclass looks up default on the class, not the class's __dict__ ->
dataclass looks up field default value on the class, not the class's __dict__
___
Python tracker
<https://bugs.python.org/issu
Change by Eric V. Smith :
--
type: -> behavior
___
Python tracker
<https://bugs.python.org/issue3>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
title: dataclass looks up default on the class, not the classes __dict__ ->
dataclass looks up default on the class, not the class's __dict__
___
Python tracker
<https://bugs.python.org/issu
New submission from Eric V. Smith :
Consider:
class FtpHelper(ftplib.FTP):
host: str
baz: str = 'baz default'
>>> FtpHelper.host
''
>>> FtpHelper.baz
'baz default'
>>> getattr(FtpHelper, "host")
''
>>> getattr(FtpHelper, "baz
Eric V. Smith added the comment:
I was thinking about something like:
@dataclass
class FtpHelper(ftplib.FTP):
my_host: str
my_user: str
lookup_password: InitVar[Callable]
def __post_init__(self, lookup_password):
super().__init__(host=self.my_host, user=self.my_user
Eric V. Smith added the comment:
This is probably not a python bug. But if you can demonstrate it without
needing to install the Oracle software, we can take a look at it. You've also
not explained how you're using multiprocessing. We need an complete, short,
working example program
Eric V. Smith added the comment:
I suggest you close it. If you want some broader discussion, you should bring
it up on the python-ideas mailing list, but I don't expect you'll get much
support.
--
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
Changing versions: this could only be added to 3.11.
I think the ship has sailed on this. The old names could never be removed so
we'd have to support both names forever. I think it's not worth the hassle.
--
nosy: +eric.smith
versions: -Python 3.10
Eric V. Smith added the comment:
That's the documented behavior: "A user may need to set the limit higher when
they have a program that requires deep recursion and a platform that supports a
higher limit. This should be done with care, because a too-high limit can lead
to a crash.&qu
Eric V. Smith added the comment:
I'm not sure directly calling __post_init__ is a good pattern. Why would not
calling __init__, like you would with any other class, not be the preferred
thing to do?
--
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
The example was added in https://github.com/python/cpython/pull/25967
When reviewing it, I think I missed the fact that the base class is a
dataclass. The example and text make more sense if Rectangle isn't a dataclass.
Still, I don't like the example at all
Eric V. Smith added the comment:
Agreed that that's not a good (or even workable) example. Thanks for pointing
it out.
I'll come up with something better.
--
assignee: docs@python -> eric.smith
versions: +Python 3.10, Python 3.11, Python
Eric V. Smith added the comment:
See msg395383 for how it's an incompatible change even to .format().
In the 15 years since I implemented .format(), this is the first I've ever
heard of someone being confused by adding extra spaces. I don't think it's
worth changing
Eric V. Smith added the comment:
The problem with this change is that it wouldn't be backward compatible. I'm
not sure how many people it would affect, but probably more than zero.
>>> str.format('{ 0 }', **{' 0 ': 42})
'42'
>>> str.format('{ }', **{' ': 43})
'43'
Does
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44355>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
The code you've attached doesn't generate the error you provided.
--
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
No, I'm sorry that I don't. The example is too large for me (or probably any of
our volunteers) to look through and reason about. I think asking on a forum
like Stack Overflow is your best bet, but even there they will ask for a
simpler example. Or maybe try
Eric V. Smith added the comment:
If you can't provide any more information, we can't help you and I'll have to
close this issue.
--
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
Python 3.6 is no longer supported. Please try to reproduce this with python 3.8
or 3.9.
Without seeing the code that causes the failure, it's not possible for us to
provide any help. Please try to reproduce the code with the smallest possible
example
Eric V. Smith added the comment:
> _uploaded_by: str = dataclasses.field(alias="uploaded_by", default=None,
> init=False)
That's an interesting idea. I'll play around with it. I'm not sure "alias"
feels quite right, as it only applies to __init__ (if I'm u
Eric V. Smith added the comment:
I'm not sure the original version needs improving.
This sounds like a problem understanding how warnings work.
Do you really want to say that for warnings, they're sometimes handled by the
warning machinery and therefore don't get passed along to the calling
Eric V. Smith added the comment:
See https://bugs.python.org/issue25124 for a discussion on why MSI won't be
supported going forward.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
I agree with Raymond: I've never seen this behavior anywhere. In general, I
think being looser with allowed inputs is not a good idea.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
This was reported a few hours ago at
https://github.com/paramiko/paramiko/issues/1856.
I'm closing this as a third party issue.
--
nosy: +eric.smith
resolution: -> third party
stage: -> resolved
status: open -&g
Eric V. Smith added the comment:
> It is a pretty-targeted optimization, so I don't expect it to speed up the
> macro benchmarks. Though that shouldn't be a blocker for small, targeted
> optimizations.
In the past we've rejected optimizations that make the code more complex a
Eric V. Smith added the comment:
The example is correct. The result is sorted by the second item (index=1) of
each tuple:
four
one
three
two
Maybe the text could make it more clear that that's the desired output.
--
nosy: +eric.smith
___
Python
Eric V. Smith added the comment:
To be pedantic, f-strings don't "cast" to a string, they call format(obj) on
the argument. Typically this is the same as str(obj), but it need not be. I
guess if all of the arguments are already exact strings then this distinction
doesn't matte
Eric V. Smith added the comment:
No, iteration is explicitly a non-goal of PEP 557. See the section on
namedtuple for why:
https://www.python.org/dev/peps/pep-0557/#why-not-just-use-namedtuple
--
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
There's no actual code associated with the "else" line, so there's no way to
get the line number. dis.dis(sample_data) might give you some insight.
Since this all works as designed, I'm going to close this issue. You might get
more help on Sta
Eric V. Smith added the comment:
Since this is working as designed, I'm going to close it.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
It's in the AST.
>>> tree.body[0].orelse[0].orelse[0].lineno
7
To see it with dump, use: ast.dump(tree, include_attributes=True)
Which, after some reformatting, gives:
Module(body=[If(test=Compare(left=Name(id='num', ctx=Load(), lineno=2,
col
Eric V. Smith added the comment:
Formatting the result, I get:
Module(body=[If(test=Compare(left=Name(id='num', ctx=Load()),
ops=[Gt()],
comparators=[Constant(value=0, kind=None)]),
body=[Expr(value=Call(func=Name(id
Change by Eric V. Smith :
--
nosy: -eric.smith
___
Python tracker
<https://bugs.python.org/issue44171>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
Please report this to the Cython bug tracker:
https://github.com/cython/cython/issues/
When you do that, you'll want to show the actual code you're having a problem
with. You're using both "//" and "/" here. As Pablo said, you're probab
New submission from Eric V. Smith :
If this is really a Cython issue, you should report it on the Cython bug
tracker. This bug tracker is for CPython.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44
Eric V. Smith added the comment:
Maybe the XXX comment in ceval.c should be removed? If we wouldn't change the
code to use a dictionary, then that comment seems incorrect.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
I agree with Raymond: a more useful example would use dataclasses or
typing.NamedTuple. The use of class variables is unusual, and it took me a
while to understand how it would work.
--
nosy: +eric.smith
Eric V. Smith added the comment:
In the future, if you get an error, please tell us what the error is. It makes
responding to bugs easier.
'{::>10d'.format(5)
Gives me an error with 3.10:
>>> '{::>10d'.format(5)
Traceback (most recent call last):
File "", line 1,
Eric V. Smith added the comment:
"If it ran in 1.98 secs then the new patch would theoretically measure
1.96 (original - 0.22)"
That difference is 0.02 seconds, or about 1%, correct?
I'm just trying to understand what we're meas
Eric V. Smith added the comment:
"there's an increase in speed by 0.22 or something like that"
0.22 what? Seconds? Percent? A factor of 0.22?
What are you measuring, and how are you measuring it?
--
nosy: +eric.smith
___
Python track
Eric V. Smith added the comment:
As you note, some of these likely cannot be improved.
There was talk last year about moving f-string's bespoke lexer/parser/compiler
into the normal Python grammar. But I'm not sure if that ever got anywhere. If
we did make that change, it would be easier
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue43176>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
Thanks, @dhoekstra!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
New changeset f47305aa1fa41c38f744e9a16ae33b74c6fd45e7 by Miss Islington (bot)
in branch '3.10':
bpo-43558: Add note about base class initialization to dataclasses doc
(GH-25967) (GH-26018)
https://github.com/python/cpython/commit
Eric V. Smith added the comment:
New changeset 4d532d3f8f7970493442d7c217220f60312f92e1 by Miss Islington (bot)
in branch '3.9':
bpo-43558: Add note about base class initialization to dataclasses doc
(GH-25967) (GH-26019)
https://github.com/python/cpython/commit
Change by Eric V. Smith :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44083>
___
___
Eric V. Smith added the comment:
Also: How are you executing this code? From IDLE? From the command line?
--
status: pending -> open
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
This is almost certainly not a bug in python. You're probably entering an empty
string for "a".
Try it without using input(). For example, replace lines 2 and 3 with:
a = "3"
b = "4"
--
nosy: +eric
Eric V. Smith added the comment:
The stdlib seems to have settled on lowercase for the noun version, though. My
two cents: no sense not being consist just because lower-case might also work.
--
___
Python tracker
<https://bugs.python.
Eric V. Smith added the comment:
That's exactly the kind of manual check I had in mind. After all "anal
retentive doesn't have a hyphen unless it's used as a compound adjective".
I think we should go with "lowercase" when a noun, and "low
Change by Eric V. Smith :
--
keywords: +3.8regression, 3.9regression -patch
resolution: fixed ->
stage: resolved -> needs patch
status: closed -> open
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
Hmm. I think maybe the intent was that if you're frozen, treat all the fields
as frozen, including ones you inherit, regardless if the base classes are
frozen or not.
--
___
Python tracker
<ht
Eric V. Smith added the comment:
Sure. Take your time! Thank you in advance for your contribution.
--
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
Can you provide a small snippet of code showing the kind of thing that broke?
--
___
Python tracker
<https://bugs.python.org/issue43
New submission from Eric V. Smith :
If you think this is a bug, please attach the text of a stand-alone example
demonstrating the problem. Please do not attach an image or a screen capture,
use text so we can run and reproduce the problem.
That said, it's unlikely this is a bug in Python
401 - 500 of 2689 matches
Mail list logo