[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Change by Eric V. Smith : -- title: := breaks f-strings -> f-strings do not support top-level := ___ Python tracker <https://bugs.python.org/issue36798> ___ _

[issue36774] f-strings: Add a !d conversion for ease of debugging

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

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Eric V. Smith added the comment: Because of the backward compatibility issues, I'm not going to change the f-string parser for this. We'll just need to document the requirements for using parens if you want to use :=. This is similar to the existing documentation about lambdas and

[issue36798] f-strings do not support top-level :=

2019-05-05 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Serhiy about the need to update PEP 572 to mention this. -- keywords: +easy stage: -> needs patch ___ Python tracker <https://bugs.python.org/issu

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2019-05-06 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this. Either this problem is going to be addressed independently of this issue, or it's never going to be fixed. Either way, we don't need this issue to be open in order to come to a resolution. -- resolution: -&g

[issue36817] Add = to f-strings for easier debugging.

2019-05-06 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +13035 ___ Python tracker <https://bugs.python.org/issue36817> ___ ___ Python-bugs-list mailin

[issue36817] Add = to f-strings for easier debugging.

2019-05-06 Thread Eric V. Smith
Change by Eric V. Smith : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue36817> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue36817] Add = to f-strings for easier debugging.

2019-05-06 Thread Eric V. Smith
New submission from Eric V. Smith : This is an alternative proposal to issue36774. We (Eric V. Smith and Larry Hastings) propose a minor language change. This level of change doesn't require a PEP, so in this post-BDFL world what we need is "a consensus among core developers".

[issue36817] Add = to f-strings for easier debugging.

2019-05-06 Thread Eric V. Smith
Change by Eric V. Smith : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue36817> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue36774] f-strings: Add a !d conversion for ease of debugging

2019-05-06 Thread Eric V. Smith
Eric V. Smith added the comment: See issue36817 for an alternative proposal. -- ___ Python tracker <https://bugs.python.org/issue36774> ___ ___ Python-bug

[issue24939] Remove unicode_format.h from stringlib

2019-05-06 Thread Eric V. Smith
Eric V. Smith added the comment: I think I meant things like PyFieldNameIter_Type, but it would require some analysis. -- versions: +Python 3.8 -Python 3.6 ___ Python tracker <https://bugs.python.org/issue24

[issue36817] Add = to f-strings for easier debugging.

2019-05-07 Thread Eric V. Smith
Eric V. Smith added the comment: > Except that I think that !f is not needed. You can use repr by default only > when no format spec is specified, and add explicit !r if you want to use repr > with the format spec. If you want to format the value without repr and the >

[issue36817] Add = to f-strings for easier debugging.

2019-05-07 Thread Eric V. Smith
Eric V. Smith added the comment: > In you example the format spec is applied to both the value and the literal > representation of the expression. Is it an error? I do not think this is an > expected behavior. No, you're misreading it. I admit that my example wasn't

[issue36826] ast_unparser.c doesn't handle := expressions

2019-05-07 Thread Eric V. Smith
New submission from Eric V. Smith : If either of these lines are added to test_annotations() in Lib/test/test_future.py, a SystemError will be raised: eq("(x:=10)") eq("f'{(x:=10):=10}'") Traceback (most recent call last): File "/Users

[issue36774] f-strings: Add a !d conversion for ease of debugging

2019-05-07 Thread Eric V. Smith
Eric V. Smith added the comment: After discussing this with Guido, we're going to go with a tweaked version of the '=' version of this in issue36817. So, I'm going to close this and continue the discussion there. -- resolution: -> rejected stage: patch re

[issue36817] Add = to f-strings for easier debugging.

2019-05-07 Thread Eric V. Smith
Eric V. Smith added the comment: After discussing this with Guido and Larry, we're going to go with the "implicit format mode", as outlined by Serhiy, and drop the !f feature. So the rules are: {x=} -> "x="+repr(x) {x=:.2f} -> "x="+format(x, &qu

[issue36817] Add = to f-strings for easier debugging.

2019-05-07 Thread Eric V. Smith
Eric V. Smith added the comment: The most recent version of the PR 0ec4daead4d5b3c42613bd210a51da60932035f3 has the behavior without !f and auto-selecting what used to be !f. It's ready for a final review before I commit it. -- ___ Python tr

[issue36817] Add = to f-strings for easier debugging.

2019-05-07 Thread Eric V. Smith
Change by Eric V. Smith : -- pull_requests: +13079 ___ Python tracker <https://bugs.python.org/issue36817> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36817] Add = to f-strings for easier debugging.

2019-05-08 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 9a4135e939bc223f592045a38e0f927ba170da32 by Eric V. Smith in branch 'master': bpo-36817: Add f-string debugging using '='. (GH-13123) https://github.com/python/cpython/commit/9a4135e939bc223f5920

[issue36817] Add = to f-strings for easier debugging.

2019-05-08 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue36858] f-string '=' debugging output needs to be documented

2019-05-08 Thread Eric V. Smith
New submission from Eric V. Smith : There are two problems here: what to call this feature, and where to put it. The current f-string documentation is in Doc/reference/lexical_analysis.rst, which I'm not sure is the best place to add discussion about how this feature works. This featu

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks for adding me, Toshio. foo = f'{_(f"{first}, bar, and {last}")}' Wow, that's extremely creative. I agree that this isn't the best we can do. PEP 501 has some ideas, but it might be too general purpose and powerful fo

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: I was going to say "use eval()", but maybe we need some sort of "eval_fstring()" that basically only understood f-strings and produced a callable that captured all of the variables (like a closure), ma

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: Of course, this wouldn't be any safer than eval'ing arbitrary user provided code. -- ___ Python tracker <https://bugs.python.o

[issue36897] shlex doesn't differentiate escaped characters in output

2019-05-13 Thread Eric V. Smith
Eric V. Smith added the comment: The goal is to match posix shell semantics. Can you provide a concrete example where shlex.shlex does something different from a posix-compliant shell? With all the escaping, it's going to be tough. Note also that your code raises a DeprecationWarning i

[issue36897] shlex doesn't differentiate escaped characters in output

2019-05-13 Thread Eric V. Smith
Eric V. Smith added the comment: Run 3.7 with -Wd: $ python3 -Wd Python 3.7.3 (default, Mar 29 2019, 13:03:53) [GCC 7.4.0] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> 'a \; b' :1: Deprec

[issue36911] ast.parse outputs ast.Strs which do not differentiate between the ASCII codepoint 12 (literal new line) and the ASCII codepoints 134 and 156 ("\n")

2019-05-14 Thread Eric V. Smith
Eric V. Smith added the comment: The existing behavior is what I'd expect. Using python3: >>> import ast >>> s = open('file.py', 'rb').read() >>> s b'"""\nHello \\n blah.\n"""\n' >>> ast.d

[issue36911] ast.parse outputs ast.Strs which do not differentiate between the ASCII codepoint 12 (literal new line) and the ASCII codepoints 134 and 156 ("\n")

2019-05-14 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Mark: the string is being correctly interpreted by the AST parser, per Python's tokenizer rules. You might want to look at lib2to3, which I think is also used by black. It's also possible that mypy or another static analyzer would be

[issue32546] Unusual TypeError with dataclass decorator

2018-01-13 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks. I'm going to be changing the errors as part of #32513, but I'll make sure to cover this case better. -- ___ Python tracker <https://bugs.python.o

[issue32546] Unusual TypeError with dataclass decorator

2018-01-13 Thread Eric V. Smith
Eric V. Smith added the comment: No matter what happens with #32513, I think the right thing to do in this case is to not error if trying to set __hash__ to None, if it already is None in __dict__. -- ___ Python tracker <https://bugs.python.

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-15 Thread Eric V. Smith
Eric V. Smith added the comment: Another case to consider is that if a class defines __eq__, Python will automatically set hash=False before the decorator gets involved. NOte to self: be sure to add a test case for this. -- ___ Python tracker

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-15 Thread Eric V. Smith
Eric V. Smith added the comment: See #32546 for the hash=None problem. -- ___ Python tracker <https://bugs.python.org/issue32513> ___ ___ Python-bugs-list mailin

[issue32575] IDLE cannot locate certain SyntaxErrors raised by f-string expressions

2018-01-16 Thread Eric V. Smith
Eric V. Smith added the comment: This is not an IDLE bug, per se. There's a known problem with f-strings not producing the correct line numbers. See issue #29051. Unless Terry thinks there's something IDLE-specific here, I suggest closing this as a duplicate. -- nosy: +

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith
Eric V. Smith added the comment: Here is my proposal for making it easier for the user to supply dunder methods that dataclasses would otherwise automatically add to the class. For all of these cases, when I talk about init=, repr=, eq=, order=, hash=, or frozen=, I'm referring t

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith
Eric V. Smith added the comment: Only hash has the tri-state True/False/None behavior, defaulting to None. It's this way because None is the "do what's rational, based on eq and frozen" behavior. None of the other parameters work this way. There's a long iss

[issue32617] dict.update does not concat/replace if same key

2018-01-21 Thread Eric V. Smith
Eric V. Smith added the comment: I'm sorry the name is confusing to you, but this behavior is correct, and how dict.update is defined: https://docs.python.org/3.6/library/stdtypes.html#dict.update As such, it cannot be changed. If you want a function that merges values, you'll nee

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-21 Thread Eric V. Smith
Eric V. Smith added the comment: Oops, that should have been: if init is MISSING: init = True -- ___ Python tracker <https://bugs.python.org/issue32

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-22 Thread Eric V. Smith
Eric V. Smith added the comment: The discussion on python-dev was that your ??? box would be "no": if the user supplied __repr__, they obviously meant for dataclass() to not provide one. I can't see why the user would say repr=True ("I want dataclass() to add __repr__&q

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-22 Thread Eric V. Smith
Eric V. Smith added the comment: Rather than re-implementing (and maintaining) functools.total_ordering semantics, I'd rather advise them to specify order=False and just use functools.total_ordering. It's an odd use case for dataclass

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-24 Thread Eric V. Smith
Eric V. Smith added the comment: I'm working on a patch before beta 1. The only issue is whether to raise in the case that order=True and the user specifies one of the 4 ordering dunders. I think raising is okay, especially since order=False is the default: you'd have to go out o

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-25 Thread Eric V. Smith
Eric V. Smith added the comment: I'll look at the hash question later today. It's sufficiently complex that I really want to sit down and work through all of the cases. -- ___ Python tracker <https://bugs.python.o

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-26 Thread Eric V. Smith
Eric V. Smith added the comment: Here's where I am on what methods are added under which circumstances. Hopefully these tables don't get mangled. The more I think about what to do with hash and raising exceptions, the more I think that the right answer is to not raise any excep

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-26 Thread Eric V. Smith
Eric V. Smith added the comment: I'm working on a better formulation of the __hash__ issue, so don't invest much time in this until I post my next message. I'm going to re-organize the various tables to make them easier to read. -- ___

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-26 Thread Eric V. Smith
Eric V. Smith added the comment: I apologize for the length of this, but I want to be as precise as possible. I've no doubt made some mistakes, so corrections and discussion are welcomed. I'm adding the commented text at the end of this message to dataclasses.py. I'm repeat

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-27 Thread Eric V. Smith
Eric V. Smith added the comment: I'm completely burned out on it, too. I'll get the code checked in today, then update the PEP later. I don't really want to add all of this reasoning to the PEP, but I guess I should. I think the gist of it is correct, in any event. We can

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-27 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5209 ___ Python tracker <https://bugs.python.org/issue32513> ___ ___ Python-bugs-list mailin

[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-27 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset ea8fc52e75363276db23c6a8d7a689f79efce4f9 by Eric V. Smith in branch 'master': bpo-32513: Make it easier to override dunders in dataclasses. (GH-5366) https://github.com/python/cpython/commit/ea8fc52e75363276db23c6a8d7a689

[issue32513] dataclasses: make it easier to use user-supplied special methods

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

[issue32546] Unusual TypeError with dataclass decorator

2018-01-27 Thread Eric V. Smith
Eric V. Smith added the comment: This has been fixed as part of #32513. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32697] Guarantee that Python preserves the order of kwonly parameters

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

[issue32704] Tracking

2018-01-29 Thread Eric V. Smith
Eric V. Smith added the comment: This list is for the development of python, not for help with using python. I suggest you ask your question on the python-list mailing list: https://mail.python.org/mailman/listinfo/python-list -- nosy: +eric.smith resolution: -> not a bug st

[issue32216] Document PEP 557 Data Classes (dataclasses module)

2018-02-02 Thread Eric V. Smith
Eric V. Smith added the comment: I was hoping a volunteer would step up to write the documentation, as it's definitely not my forte. Raymond has also volunteered to help. -- ___ Python tracker <https://bugs.python.org/is

[issue32820] Add bits method to ipaddress

2018-02-11 Thread Eric V. Smith
Eric V. Smith added the comment: Without commenting on how useful or desirable this would be, I'll point out the string can be computed as: return f'{int(self):#0{IPV4LENGTH+2}b}' -- nosy: +eric.smith ___ Python tracker <https

[issue32820] Add bits method to ipaddress

2018-02-13 Thread Eric V. Smith
Eric V. Smith added the comment: If you don't recognize the format string, you want to fall back to: return super().__format__(fmt) Since that will call object.__format__, it will generate an error if fmt is not the empty string, which is what it does currently for IP addresses. As f

[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Eric V. Smith
Eric V. Smith added the comment: This is the expected behavior, fortunately or not. "math" is not builtin in the sense that is used in that paragraph. -- nosy: +eric.smith ___ Python tracker <https://bugs.python.o

[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Eric V. Smith
Eric V. Smith added the comment: Removing macOS since this isn't Mac specific. -- components: +Interpreter Core -macOS ___ Python tracker <https://bugs.python.org/is

[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith components: +Library (Lib) type: crash -> behavior ___ Python tracker <https://bugs.python.org/i

[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith
Eric V. Smith added the comment: That's a great bug report. Thanks for the tiny code to replicate it. It turns out the code isn't quite doing what I thought. I'll have to give some thought to exactly how I'm going to handle this without breaking other cases, but I shoul

[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +ned.deily priority: normal -> release blocker ___ Python tracker <https://bugs.python.org/issue32896> ___ ___ Python-

[issue32923] Typo in documentation of unittest: whilst instead of while

2018-02-23 Thread Eric V. Smith
Eric V. Smith added the comment: Agree with Marietta: it's valid, but lets change it to make it more approachable to non-native speakers. -- nosy: +eric.smith ___ Python tracker <https://bugs.python.org/is

[issue32820] Add __format__ method to ipaddress

2018-02-23 Thread Eric V. Smith
Eric V. Smith added the comment: I'd like 's' to be supported, and just be passed to format(str(self), fmt) (or some alternate spelling for the same thing). My use case is to format tables including addresses: print(f'

[issue32820] Add __format__ method to ipaddress

2018-02-23 Thread Eric V. Smith
Eric V. Smith added the comment: True enough. You'd think that I (of all people!) would know that. Nevermind. -- ___ Python tracker <https://bugs.python.org/is

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-23 Thread Eric V. Smith
New submission from Eric V. Smith : See https://mail.python.org/pipermail/python-dev/2018-February/152150.html for a discussion. This will remove the @dataclass hash= tri-state parameter, and replace it with an unsafe_hash= boolean-only parameter. >From that thread: """ I

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-23 Thread Eric V. Smith
Eric V. Smith added the comment: That's a quote from Guido. There weren't any better ideas on the python-dev thread. -- nosy: +gvanrossum ___ Python tracker <https://bugs.python.o

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-24 Thread Eric V. Smith
Eric V. Smith added the comment: Note that this class (from the test suite) will now raise an exception: @dataclass(unsafe_hash=True) class C: i: int def __eq__(self, other): return self.i == other.i That's because it has a __h

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: Here's the simplest way I can describe this, and it's also the table used inside the code. The column "has-explicit-hash?" is trying to answer the question "is there a __hash__ function defined in this class?". It is set t

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: if unsafe_hash: # If there's already a __hash__, raise TypeError, otherwise add __hash__. if has_explicit_hash: hash_action = 'exception' else: hash_action = 'add' else: #

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5663 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32929> ___ ___ Py

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: I've been focused on getting the code fix in for the next beta release on 2018-02-26, and leaving the possible parameter name change for later. I don't feel strongly about the parameter name. Right now it's unsafe_hash, per Guido'

[issue32953] Dataclasses: frozen should not be inherited

2018-02-25 Thread Eric V. Smith
New submission from Eric V. Smith : Reported by Raymond Hettinger: When working on the docs for dataclasses, something unexpected came up. If a dataclass is specified to be frozen, that characteristic is inherited by subclasses which prevents them from assigning additional attributes

[issue32953] Dataclasses: frozen should not be inherited

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: A related issue is that dataclasses derived from frozen dataclasses are automatically "promoted" to being frozen. >>> @dataclass(frozen=True) ... class A: ... i: int ... >>> @dataclass ... class B(A): ... j: int ...

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset dbf9cff48a4ad0fd58e1c623ce1f36c3dd3d5f38 by Eric V. Smith in branch 'master': bpo-32929: Dataclasses: Change the tri-state hash parameter to the boolean unsafe_hash. (#5891) https://github.com/python/cpyt

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-25 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this. Steven: if you gain support for a parameter name change, please open another issue. -- priority: release blocker -> normal resolution: -> fixed stage: patch review -> resolved status: open -> closed vers

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 4cffe2f66b581fa7538f6de884d54a5c7364d8e0 by Eric V. Smith (Miss Islington (bot)) in branch '3.7': bpo-32929: Dataclasses: Change the tri-state hash parameter to the boolean unsafe_hash. (GH-5891) (GH-5902) https://github.com/pyth

[issue32954] Lazy Literal String Interpolation (PEP-498-based fl-strings)

2018-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: See also PEP 501. -- nosy: +eric.smith, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue32954> ___ ___ Pytho

[issue32954] Lazy Literal String Interpolation (PEP-498-based fl-strings)

2018-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: Arcadiy: Somehow you're dropping Serhiy and me from the nosy list. I've re-added us. -- nosy: +eric.smith, serhiy.storchaka ___ Python tracker <https://bugs.python.o

[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-26 Thread Eric V. Smith
Change by Eric V. Smith : -- priority: release blocker -> deferred blocker ___ Python tracker <https://bugs.python.org/issue32896> ___ ___ Python-bugs-list mai

[issue32960] dataclasses: disallow inheritance between frozen and non-frozen classes

2018-02-26 Thread Eric V. Smith
New submission from Eric V. Smith : This is a temporary measure until we can better define how frozen inheritance should work. In the meantime, disallow: - frozen inherited from non-frozen - non-frozen inherited from frozen -- assignee: eric.smith components: Library (Lib) messages

[issue32960] dataclasses: disallow inheritance between frozen and non-frozen classes

2018-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: See issue 32953 for a larger discussion and the ultimate resolution of this. -- ___ Python tracker <https://bugs.python.org/issue32

[issue32960] dataclasses: disallow inheritance between frozen and non-frozen classes

2018-02-26 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5690 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32960> ___ ___ Py

[issue32960] dataclasses: disallow inheritance between frozen and non-frozen classes

2018-02-26 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset a93e3dc236279692eaf50b91d358da5983983b14 by Eric V. Smith (Miss Islington (bot)) in branch '3.7': bpo-32960: For dataclasses, disallow inheriting frozen from non-frozen classes and vice-versa, (GH-5919) (GH-5920) https://github.

[issue32961] namedtuple displaying the internal code

2018-02-27 Thread Eric V. Smith
Eric V. Smith added the comment: See https://docs.python.org/2/library/collections.html#collections.namedtuple namedtuple is called as: collections.namedtuple(typename, field_names[, verbose=False][, rename=False]) So you are passing in typename = 'Name' field_names = 'a'

[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-02-28 Thread Eric V. Smith
Eric V. Smith added the comment: See https://mail.python.org/pipermail/python-dev/2018-February/152320.html for a discussion. -- title: Dataclasses: frozen should not be inherited -> Dataclasses: frozen should not be inherited for non-dataclass derived clas

[issue32977] added acts_like decorator to dataclasses module

2018-03-01 Thread Eric V. Smith
Eric V. Smith added the comment: Since this has to wait until 3.8 and I'm swamped with 3.7, this is going to have to wait for me to look at it. Is there a reason it needs to be part of dataclasses itself? I'd suggest separating it out, putting it on PyPI, and getting some trac

[issue33013] Underscore in str.format with x option

2018-03-06 Thread Eric V. Smith
Eric V. Smith added the comment: The format specifier (here, 'x') always goes last. >>> '{0:_x}'.format(123456789) '75b_cd15' See https://docs.python.org/3/library/string.html#formatstrings for the details. Serhiy is correct that it's often easier

[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

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

[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Eric V. Smith
Eric V. Smith added the comment: I once thought of building NamedTuple functionality into dataclasses, either as a parameter to @dataclass or as a new decorator. But it didn't get very far. It would have to return a different class, like NamedTuple does, and this didn't fit in wel

[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith
Eric V. Smith added the comment: Although having said that, we probably can't make that change for 2.7. And maybe it's even too big a change for 3.8. -- ___ Python tracker <https://bugs.python.o

[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith
Eric V. Smith added the comment: Wouldn't we be better off to catch this error at parse time, instead of just improve the error message when .port is called? I'm not sure why port is a property and not just computed. Maybe the least intrusive way of doing this would be to jus

[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, you're right, it can't be changed. And .port is documented as raising ValueError, so it's all working correctly. I think improving the ValueError message, as the PR does, is as good as we can do. -- ___

[issue33086] pip: IndexError

2018-03-16 Thread Eric V. Smith
Eric V. Smith added the comment: You did not provide enough information for us to reproduce this problem. To see the kind of information we need, see for example https://leantesting.com/write-good-bug-report/ And if you already have determined this is a problem with pip, they have their own

[issue33086] pip: IndexError

2018-03-16 Thread Eric V. Smith
Change by Eric V. Smith : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue33086> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: For backward comparability, option C would have to default to not raising an exception. Which would limit it's usefulness, but that's the way it goes. -- ___ Python tracker <https://bugs.python.o

[issue33092] The bytecode for f-string formatting is inefficient.

2018-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: Would this change really have a performance impact? Not saying it wouldn't, but if we're going to add bytecodes we should know the answer in advance. -- nosy: +eric.smith ___ Python tracker <https://bu

[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-03-18 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5905 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32953> ___ ___ Py

[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-03-18 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset f199bc655eb50c28e94010714629b376bbbd077b by Eric V. Smith in branch 'master': bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass derived classes (#6147) https://github.com/python/cpyt

[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-03-18 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 45648312e540cda3b10109b6a808cbf6955c84eb by Eric V. Smith (Miss Islington (bot)) in branch '3.7': bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass derived classes (GH-6147) (GH-6148) https://github.com/pyth

[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-03-18 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue33094] dataclasses: ClassVar attributes are not working properly

2018-03-18 Thread Eric V. Smith
Eric V. Smith added the comment: There are a couple of problems here. You're using ClassVar incorrectly. It should be: >>> @dataclass ... class C: ... __slots__=() ... x: ClassVar[int] = field(default=3) ... >>> C() C() >>> C.x 3 And you cannot have a

[issue33094] dataclasses: ClassVar attributes are not working properly

2018-03-18 Thread Eric V. Smith
Change by Eric V. Smith : -- versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue33094> ___ ___ Python-bugs-list mailing list Unsubscribe:

<    12   13   14   15   16   17   18   19   20   21   >