[Python-Dev] Re: Minor inconvenience: f-string not recognized as docstring
On Wed, Jan 12, 2022 at 2:58 AM Neil Muller wrote: > Having something that looks like it sets the docstring, but silently > doesn't is very surprising, though. Linters can warn about this, but > linters are not a universal fix, and this is something that > superficially looks entirely reasonable. > While f-strings in class scope could theoretically be valid docstrings a lot of the time, the equivalent situation for function docstrings is much less positive. A function like this the one below obviously problematic, since the f-string value is not a compile-time constant: def foo(x): f"is this a docstring? x is {x}" I'm pretty sure f-strings cannot be used as docstrings in other contexts because of how broken they'd be in functions. -- Steven Barker ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PQMAQIQR65OF3EDQYNWAHTWU44WKBE5A/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Switching to Discourse
On Mon, Jul 18, 2022 at 6:28 AM Petr Viktorin wrote: > On 16. 07. 22 8:48, Miro Hrončok wrote: > > On 15. 07. 22 13:18, Petr Viktorin wrote: > >> - You can use discuss.python.org's “mailing list mode” (which > >> subscribes you to all new posts), possibly with filtering and/or > >> categorizing messages locally. > [...] > > What would be a good resource to read about this - where do I learn how > > to use discuss.python.org's in the “mailing list mode” > > Is this note enough? > > https://devguide.python.org/developer-workflow/communication-channels/?highlight=discourse#enabling-mailing-list-mode > [...] So last night I tried activating mailing list mode, and I'm not remotely satisfied with the experience so far. Where mailing lists are concerned, I'm *only *subscribed to python-dev. Not python-users, not -ideas, not -packaging (if that's still a thing). But Discourse's mailing list mode sends me messages for all of those things in such a volume that it drowns out any discussions on topics that would have shown up on python-dev (I think one PEP discussion message came in overnight, compared to 20+ posts on other tags). After the first two -users messages came in almost immediately, I tried telling discourse to mute the tags I don't care about, but it seems not to work at all. The page with the mailing list mode toggle warns that it overrides other email settings, so I think I just get everything regardless of other settings. If my only option is to be subscribed to a firehose of stuff I don't care about, I'm going to disable mailing list mode and if python-dev dies, I'll pretty much quit following Python's development. Now, I'm not a very important Python developer, I'm not a core dev, and my contributions are a few bug reports and a few patches over many years. But if there's no way to lurk on a modest-volume mailing list and contribute only occasionally, you're not going to get nearly as many people paying attention. I'm sure I could set up a whole suite of filters on my own end (e.g. discard any email with a subject starting with "[py] [Users]"), but that's an absurd and unnecessary burden, and it will only get worse the more categories you add to discourse (and I think the ease of adding categories is supposed to be a *feature*). This plan is going to drive developers like me away. For discourse mailing list mode to be a reasonable substitute for python-dev, it needs filtering on the sending end to work. Ideally there would be a way to subscribe only to the things I care about. Maybe that exists, but it's buried in menus I don't understand (or which mailing list mode overrides). Rather than comparing the number of posters on discourse vs python-dev, have we compared stats for how many people receive the messages? ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/6QAP5NCX4NODNLKTIFYW5FO33757L3AK/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Switching to Discourse
On Thu, Jul 21, 2022 at 3:42 PM Steven Barker wrote: > So last night I tried activating mailing list mode [...] > To follow up on my own post, here's an update. I figured out that I'd done something incorrectly the first time I tried muting certain categories of posts on Discourse. I think I just failed to save my choices in the settings screen, and I got it right the second time I tried. The firehose was tamed to a reasonable rate of flow. I do still think that experience is much worse than signing up for just the python-dev mailing list. While excluding the Users (now Python Help), Ideas and Packaging categories has cut out most of the stuff I don't care about, there are a lot of low-volume categories that I probably don't care about either, but I don't know enough about them to tell. I'd rather be able to opt-in to categories I want instead of opting out to everything I don't want. I have low confidence in my understanding of Discourse settings, but I don't currently believe that setting a category as Watched does the same thing as mailing list mode, for that category only, but I could be wrong (I've not tried it). I don't want summary emails, and that seems to be the only thing on offer. And there isn't a generalized Dev category that covers the range of topics that the python-dev mailing list does. So to give my final takeaway: It might be possible for Discourse to replace Python-dev, even for those who wish to get their messages by email. But the user experience of signing up is vastly worse, and will need much more than a single paragraph in the dev-guide for most people to have a satisfying experience with mailing list mode (or some other mode that I don't yet know how to use). ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/MWZ3475A26UP35HQ5CSM7UAXVPVDLC3B/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup
On Sun, Jun 28, 2020 at 8:44 AM Jim J. Jewett wrote: > I actually like that it looks like instantiation; it seems to be saying > "Do we have the sort of object we would get from this instantiation?" > > Unfortunately, this does aggravate the confusion over whether a variable > is being used as a filter, vs binding to something from the matched object. > The constructor-like syntax for class patterns is the part I like least about this proposal. It seems to expect that there is a one-to-one correspondence between constructor arguments and instance attributes. While that might be common, especially for DataClass-like types, it's certainly not always the case. Some attributes might be computed from multiple arguments (or looked up elsewhere), and some arguments may never be saved in their original form. I fear it will be extremely confusing if an attribute being matched by a class pattern doesn't correspond at all to an argument in a valid constructor call. For example, this class would make things very confusing: class Foo: def __init__(self, a, b): self.c = a + b You could match an instance of the class with `case Foo(c=x)` and it would work, but that might come as a surprise to anyone familiar with the class constructor's argument names. Even when attributes and constructor arguments do line up, the class pattern syntax also seems a bit awkward when you are not required to match against all of the non-optional constructor arguments. I imagine `case datetime.datetime(year=2020):` would be a valid (and even useful!) class pattern, but you can't construct a datetime instance in that way since the class has three required arguments. To sum up, I feel like using constructor and keyword-argument syntax to access attributes is an abuse of notation. I'd much prefer a new syntax for matching classes and their attributes that was not so likely to be confusing due to imperfect parallels with class construction. ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/7LXFWX5LPLJBRVUK7OEPB3KGJQNB3AO6/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Function suggestion: itertools.one()
A single-name unpacking assignment can do exactly what you want, albeit with slightly less helpful exception messages: jack, = (p for p in people if p.id == '1234') # note comma after the name jack If no value is yielded by the generator expression, you'll get "ValueError: not enough values to unpack (expected 1, got 0)". If multiple values are yielded, you'll instead get "ValueError: too many values to unpack (expected 1)". ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/Y6HFE3HIPX67UCFSLO6WMH4CKVAEJYJO/ Code of Conduct: http://python.org/psf/codeofconduct/