[issue39705] Tutorial, 5.6 Looping Techniques, sorted() example

2020-02-21 Thread Eric V. Smith
Eric V. Smith added the comment: That sounds like a good improvement, Raymond. -- ___ Python tracker <https://bugs.python.org/issue39705> ___ ___ Python-bug

[issue39705] Tutorial, 5.6 Looping Techniques, sorted() example

2020-02-21 Thread Eric V. Smith
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: +

[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Eric V. Smith
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

[issue39694] Incorrect dictionary unpacking when calling str.format

2020-02-20 Thread Eric V. Smith
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

[issue39662] Characters are garbled when displaying Byte data

2020-02-18 Thread Eric V. Smith
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 _

[issue39673] Map errno==ETIME to TimeoutError

2020-02-18 Thread Eric V. Smith
Change by Eric V. Smith : -- stage: -> needs patch ___ Python tracker <https://bugs.python.org/issue39673> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue39673] Map errno==ETIME to TimeoutError

2020-02-18 Thread Eric V. Smith
Change by Eric V. Smith : -- title: TimeoutError -> Map errno==ETIME to TimeoutError type: behavior -> enhancement ___ Python tracker <https://bugs.python.org/i

[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith
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

[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith
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

[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith
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

[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith
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

[issue39662] Characters are garbled when displaying Byte data

2020-02-17 Thread Eric V. Smith
Change by Eric V. Smith : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue39662> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue39662] Characters are garbled when displaying Byte data

2020-02-17 Thread Eric V. Smith
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

[issue39615] cpython/abstract.h not compatible with C90

2020-02-12 Thread Eric V. Smith
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

[issue39615] cpython/abstract.h not compatible with C90

2020-02-12 Thread Eric V. Smith
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

[issue39601] brace escapes are not working in formatted string literal format specifications

2020-02-11 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker <https://bugs.python.org/issue39601> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue39601] brace escapes are not working in formatted string literal format specifications

2020-02-11 Thread Eric V. Smith
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

[issue39601] brace escapes are not working in formatted string literal format specifications

2020-02-10 Thread Eric V. Smith
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

[issue39596] reverse parameter for enumerate()

2020-02-10 Thread Eric V. Smith
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

[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith
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

[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith
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

[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith
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

[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith
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()." -

[issue39564] Parsed expression has wrong col_offset when concatenating f-strings

2020-02-06 Thread Eric V. Smith
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.

[issue39568] FORMATTING grouping_option ValueError: Cannot specify ', ' with ...

2020-02-06 Thread Eric V. Smith
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

[issue39568] FORMATTING grouping_option ValueError: Cannot specify ', ' with ...

2020-02-06 Thread Eric V. Smith
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.

[issue39564] Parsed expression has wrong col_offset when concatenating f-strings

2020-02-06 Thread Eric V. Smith
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

[issue39564] Parsed expression has wrong col_offset when concatenating f-strings

2020-02-05 Thread Eric V. Smith
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

[issue39564] Parsed expression has wrong col_offset when concatenating f-strings

2020-02-05 Thread Eric V. Smith
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

[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-02 Thread Eric V. Smith
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

[issue14715] test.support.DirsOnSysPath should be replaced by importlib.test.util.import_state

2020-01-28 Thread Eric V. Smith
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

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-24 Thread Eric V. Smith
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

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-24 Thread Eric V. Smith
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

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-24 Thread Eric V. Smith
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

[issue39380] ftplib uses latin-1 as default encoding

2020-01-23 Thread Eric V. Smith
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

[issue39416] Document default numeric string formats

2020-01-21 Thread Eric V. Smith
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

[issue39354] collections.UserString format and format_map return a string

2020-01-16 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue39354> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39333] argparse should offer an alternative to SystemExit in case a parse fails

2020-01-14 Thread Eric V. Smith
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

[issue39300] dataclasses non-default argument follows default argument

2020-01-11 Thread Eric V. Smith
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:

[issue39247] dataclass defaults and property don't work together

2020-01-10 Thread Eric V. Smith
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

[issue39284] Flexible indentation

2020-01-10 Thread Eric V. Smith
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

[issue39247] dataclass defaults and property don't work together

2020-01-07 Thread Eric V. Smith
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

[issue39247] dataclass defaults and property don't work together

2020-01-07 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker <https://bugs.python.org/issue39247> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue38209] Simplify dataclasses.InitVar by using __class_getitem__()

2020-01-07 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior ___ Python tracker <https://bugs.python

[issue39234] `enum.auto()` incrementation value not specified.

2020-01-06 Thread Eric V. Smith
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

[issue39240] keyerror in string format

2020-01-06 Thread Eric V. Smith
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

[issue39225] Python should warn when a global/local has the same name as a builtin

2020-01-05 Thread Eric V. 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

[issue39223] Fold constant slicing with slices

2020-01-05 Thread Eric V. Smith
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

[issue39223] Fold constant slicing with slices

2020-01-05 Thread Eric V. Smith
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

[issue35143] `from __future__ import annotations` has no effect inside `ast.parse`

2019-12-28 Thread Eric V. Smith
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

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-26 Thread Eric V. Smith
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

[issue33961] Inconsistency in exceptions for dataclasses.dataclass documentation

2019-12-25 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks, all! -- ___ Python tracker <https://bugs.python.org/issue33961> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33961] Inconsistency in exceptions for dataclasses.dataclass documentation

2019-12-25 Thread Eric V. Smith
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

[issue39096] Description of "Format Specification Mini-Language" not accurate for Decimal

2019-12-19 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith, mark.dickinson ___ Python tracker <https://bugs.python.org/issue39096> ___ ___ Python-bugs-list mailing list Unsub

[issue39077] Numeric formatting inconsistent between int, float and Decimal

2019-12-18 Thread Eric V. Smith
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

[issue39084] string.letters is flipped after setlocale is called

2019-12-17 Thread Eric V. Smith
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

[issue39083] Dictionary get(key, default-expression) not short circuit behavior

2019-12-17 Thread Eric V. Smith
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

[issue39077] Numeric formatting inconsistent between int, float and Decimal

2019-12-17 Thread Eric V. Smith
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

[issue39079] help() modifies the string module

2019-12-17 Thread Eric V. Smith
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

[issue39077] Numeric formatting inconsistent between int, float and Decimal

2019-12-17 Thread Eric V. Smith
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

[issue39079] help() modifies the string module

2019-12-17 Thread Eric V. Smith
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

[issue39078] __function.__defaults__ breaks for __init__ of dataclasses with default factory

2019-12-17 Thread Eric V. Smith
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

[issue39078] __function.__defaults__ breaks for __init__ of dataclasses with default factory

2019-12-17 Thread Eric V. Smith
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()

[issue39077] Numeric formatting inconsistent between int, float and Decimal

2019-12-17 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue39077> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39078] __function.__defaults__ breaks for __init__ of dataclasses with default factory

2019-12-17 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue39078> ___ ___ Python-bugs-list mai

[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread Eric V. Smith
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

[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Eric V. Smith
Eric V. Smith added the comment: Agreed on closing this issue. -- ___ Python tracker <https://bugs.python.org/issue38996> ___ ___ Python-bugs-list mailin

[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Eric V. Smith
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

[issue38984] Value add to the wrong key in a dictionary

2019-12-05 Thread Eric V. Smith
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

[issue38964] Output of syntax error in f-string contains wrong filename

2019-12-04 Thread Eric V. Smith
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

[issue38964] Output of syntax error in f-string contains wrong filename

2019-12-04 Thread Eric V. Smith
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

[issue38964] Output of syntax error in f-string contains wrong filename

2019-12-04 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith stage: resolved -> ___ Python tracker <https://bugs.python.org/issue38964> ___ ___ Python-bugs-list

[issue38947] dataclass defaults behave inconsistently for init=True/init=False when default is a descriptor

2019-12-01 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker <https://bugs.python.org/issue38947> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue38905] venv python reports wrong sys.executable in a subprocess on Windows

2019-11-24 Thread Eric V. Smith
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 >>>

[issue38889] Segmentation fault when using EPF Importer

2019-11-21 Thread Eric V. Smith
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

[issue38831] urllib.request header characters being changed to lowercase

2019-11-17 Thread Eric V. Smith
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

[issue38831] urllib.request header characters being changed to lowercase

2019-11-17 Thread Eric V. Smith
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

[issue38670] can we accept os.PathLike objects within the subprocess args= list?

2019-11-14 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue38670> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38758] @dataclass defaults

2019-11-13 Thread Eric V. Smith
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

[issue38758] @dataclass defaults

2019-11-13 Thread Eric V. Smith
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

[issue38758] @dataclass defaults

2019-11-09 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue38758> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38740] Line count mismatch between open() vs sys.stdin api calls

2019-11-09 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> not a bug ___ Python tracker <https://bugs.python.org/issue38740> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith
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

[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith
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

[issue38719] Surprising and possibly incorrect passing of InitVar to __post_init__ method of data classes

2019-11-06 Thread Eric V. 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

[issue38719] Surprising and possibly incorrect passing of InitVar to __post_init__ method of data classes

2019-11-06 Thread Eric V. Smith
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

[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-06 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue38706> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38693] Use f-strings instead of str.format within importlib

2019-11-05 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue38693> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38657] Clarify numeric padding behavior in string formatting

2019-11-03 Thread Eric V. Smith
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

[issue38657] String format for hexadecimal notation breaks padding with alternative form

2019-11-01 Thread Eric V. Smith
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

[issue38657] String format for hexadecimal notation breaks padding with alternative form

2019-11-01 Thread Eric V. Smith
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

[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-29 Thread Eric V. Smith
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

[issue35745] Add import statement in dataclass code snippet

2019-10-29 Thread Eric V. Smith
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

[issue38615] imaplib has no timeout setting

2019-10-28 Thread Eric V. Smith
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

[issue38619] [Doc] UUID.hex is lowercase

2019-10-28 Thread Eric V. Smith
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

[issue37948] get_type_hints fails if there are un-annotated fields in a dataclass

2019-10-28 Thread Eric V. Smith
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

[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default before Python 4.0

2019-10-27 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/issue38605> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38574] Dataclasses documentation should show the necessary imports

2019-10-24 Thread Eric V. Smith
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 __

[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread Eric V. Smith
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

[issue38556] Walrus operator in list comprehensions [Python 3.8.0]

2019-10-22 Thread Eric V. Smith
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

<    7   8   9   10   11   12   13   14   15   16   >