[Python-ideas] Re: Allowing non-ASCII bracket and quote characters in source code

2022-01-17 Thread Jonathan Goble
On Mon, Jan 17, 2022 at 3:22 PM John Sturdy wrote: > But it might be handled better in the display in editors and IDEs (perhaps > syntax coloring brackets by their depth). > VSCode already supports this out of the box. Just search "bracket pair" in the settings and check (tick) the box for

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-08 Thread Jonathan Goble
On Wed, Dec 8, 2021 at 11:28 PM Chris Angelico wrote: > On Thu, Dec 9, 2021 at 3:15 PM Jonathan Goble wrote: > > My preferences to resolve this are, in order: > > > > 1. Introduce `from __future__ import late_default`. When present, > argument defaults in that fil

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-08 Thread Jonathan Goble
Let me go back to the top and answer the original questions, then offer a few thoughts that have been germinating in my head through this discussion. Chris Angelico wrote: > I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ > with some additional information about the reference

[Python-ideas] Re: Adding pep-8-casing-compliant aliases for unittest and logging

2021-11-11 Thread Jonathan Goble
On Fri, Nov 12, 2021, 1:39 AM Christopher Barker wrote: > > unittest is the first (and only) testing framework I have ever used, so >> any info is appreciated. > > > Yes, I like Pytest a lot more. > > I should really write this up someday, and I did write a bit about it on > this list not too

[Python-ideas] Re: New 'How to Write a Good Bug Report' Article for Docs

2021-08-16 Thread Jonathan Goble
On Mon, Aug 16, 2021, 10:30 AM Jack DeVries wrote: > Hi All! > > We are trying to replace a link in the official docs which is now > broken, but used to link to this article: > > >

[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-07-05 Thread Jonathan Goble
On Mon, Jul 5, 2021 at 4:12 PM Jim Baker wrote: > in the same way that we don't use l (that's the lower-case letter L if > you're not reading this email with the numeric codepoints) as a variable > Speaking of grit on one's screen, I first thought that was a lowercase "i" because I had actual

[Python-ideas] Re: Changing The Theme of Python Docs Site

2021-05-04 Thread Jonathan Goble
On Tue, May 4, 2021 at 11:05 PM Mike Miller wrote: > One thing that drives me nuts about the current Python docs > theme is > the FULL JUSTIFICATION that adds random spaces into each line to make > the > edges line > up! > > Whatever y'all do, please remove that.

[Python-ideas] Re: TACE16 text encoding for Tamil language

2021-05-02 Thread Jonathan Goble
On Sun, May 2, 2021 at 1:47 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Jonathan Goble writes: > > > I assume the "cpython" part of these paths here is your local clone of > the > > CPython GitHub repo? (Otherwise these local fi

[Python-ideas] Re: TACE16 text encoding for Tamil language

2021-05-01 Thread Jonathan Goble
On Sat, May 1, 2021 at 11:17 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Start here: > /Users/steve/src/Python/cpython/Doc/library/codecs.rst > /Users/steve/src/Python/cpython/Doc/c-api/codec.rst > > To write them in C, follow the code in > Likely needed (forgot where

[Python-ideas] Re: Python Idea - extension of 'with'

2021-04-08 Thread Jonathan Goble
On Thu, Apr 8, 2021, 11:39 AM anthony.flury via Python-ideas < python-ideas@python.org> wrote: > I was wondering whether a worthwhile extension might be to allow the > `with` statement to have an `except` and `else` clauses which would have > the same > > semantics as wrapping the `with` block

[Python-ideas] Re: Reverse polish notation

2021-04-02 Thread Jonathan Goble
On Fri, Apr 2, 2021 at 11:58 AM Richard Damon wrote: > I think python only has 3 unary operations, + - and ~ and only + and - > can also be binary operations. > > unary + has less uses, since it normally just passes its argument, if > valid, unchanged, but can be used to validate that its

[Python-ideas] Re: Implicit line continuation for method chaining

2021-03-12 Thread Jonathan Goble
On Fri, Mar 12, 2021 at 10:41 AM Matt Williams wrote: > > Hi, > > It's becoming more popular in Python to have interfaces which are built > around method chaining as a way of applying operations to data. For example > in pandas is moving more towards a default model where methods do not change

[Python-ideas] Re: [Python-Dev] Have virtual environments led to neglect of the actual environment?

2021-02-23 Thread Jonathan Goble
On Tue, Feb 23, 2021 at 7:48 PM Random832 wrote: > > I was reading a discussion thread > about > various issues with the Debian packaged version of Python, and the following > statement stood out for me as shocking: > > Christian

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Jonathan Goble
On Mon, Feb 15, 2021 at 12:29 PM Ricky Teachey wrote: > f(x,y)=>x+y->str > I can't -1 this enough. How do I read this? Imagine you have never seen this discussion and you come across this code in the wild. You are familiar with type hints, including return type annotations, but aren't familiar

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread Jonathan Goble
On Wed, Aug 5, 2020 at 2:03 PM Ricky Teachey wrote: > > And btw this works: > > >>> class const(int): > ... def __new__(cls, name, val): > ... obj = super().__new__(cls, val) > ... obj.name = name > ... return obj > ... def about(self): > ...

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-19 Thread Jonathan Goble
On Sun, Jul 19, 2020 at 9:53 PM Stephan Hoyer wrote: > On Fri, Jul 17, 2020 at 9:22 PM Ricky Teachey wrote: > >> >>> # The positional arguments aren't part of the KeyObject >> >>> d[a, b:c, d, e=5, f=6] == d.__getitem__((a, b:c, d), KeyObject(e=5, >> f=6)) >> >> This raises a question that

[Python-ideas] Re: Add builtin function for min(max())

2020-07-03 Thread Jonathan Goble
My vote: clamp(+1000, min=-1, max=+1) I've had to do this operation many times in a variety of languages (Python is my playtoy for personal stuff, but work and school rarely give me a choice of language). I always love it when the language has a readily available `clamp()` function for this, and

[Python-ideas] Re: approximate equality operator ("PEP 485 follow-up")

2020-06-23 Thread Jonathan Goble
On Tue, Jun 23, 2020 at 8:44 AM Mathew Elman wrote: > Perhaps a more versatile operator would be to introduce a +- operator that > would return an object with an __eq__ method that checks for equality in > the tolerance i.e > > a == b +- 0.5 > This is already valid syntax, because unary

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Jonathan Goble
On Thu, Jun 18, 2020 at 5:36 AM Jonathan Fine wrote: > Python allows the user to replace fn.__code__ by a different code object. > This is a rarely done dirty trick. > A dirty trick to you maybe, but occasionally useful. For example, it can be used to implement goto:

[Python-ideas] Re: Bringing the print statement back

2020-06-10 Thread Jonathan Goble
After thinking about it for a day, my opinions are: +1 for the limited idea of bringing back the print statement with positional arguments only, as syntactic sugar (and not a replacement) for the print function +0 on a print statement with keyword arguments (again, as syntactic sugar) -1 on

[Python-ideas] Re: Bringing the print statement back

2020-06-09 Thread Jonathan Goble
On Tue, Jun 9, 2020, 9:33 PM Edwin Zimmerman wrote: > On 6/9/2020 9:21 PM, Jonathan Goble wrote: > > On Tue, Jun 9, 2020, 8:47 PM Edwin Zimmerman > wrote: > >> Wouldn't this break backwards compatibility with everything the whole way >> back to 3.0? I fear a futu

[Python-ideas] Re: Bringing the print statement back

2020-06-09 Thread Jonathan Goble
On Tue, Jun 9, 2020, 8:47 PM Edwin Zimmerman wrote: > Wouldn't this break backwards compatibility with everything the whole way > back to 3.0? I fear a future with where I have to run a 2to3 type tool on > third-party dependencies just to get them to work with my 3.7 code base. > My

[Python-ideas] Re: Bringing the print statement back

2020-06-09 Thread Jonathan Goble
On Tue, Jun 9, 2020 at 8:08 PM Guido van Rossum wrote: > I believe there are some other languages that support a similar grammar > (Ruby? R? Raku?) but I haven't investigated. > Lua has a similar feature: a name (including a dotted name or index[ing], which are identical in Lua) immediately

[Python-ideas] Re: Python __main__ function

2020-05-28 Thread Jonathan Goble
On Thu, May 28, 2020 at 9:03 PM Greg Ewing wrote: > On 29/05/20 8:05 am, tritium-l...@sdamon.com wrote: > > > People write main entry points that are not exactly this? > > > > If __name__ == '__main__': > > sys.exit(main(sys.argv[1:])) > > It's not clear that exiting with the return value

[Python-ideas] Re: str.strip: argument maxstrip

2020-05-19 Thread Jonathan Goble
On Tue, May 19, 2020 at 9:00 AM computermaster360 . < computermaster...@gmail.com> wrote: > I often find myself in a need of stripping only a specified amount of > characters from a string (most commonly a single character). I have been > implementing this in an ad-hoc manner, which is quite

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Jonathan Goble
On Sun, May 10, 2020 at 8:08 PM David Mertz wrote: > Why would you use Word? LaTeX exists, and will export to PDF. Heck, the > PDF export from Jupyter is quite good (by way of LaTeX). > > On Sun, May 10, 2020, 7:40 PM Jonathan Goble < > Several of the questions required us to

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Jonathan Goble
On Sun, May 10, 2020 at 4:00 AM Steven D'Aprano wrote: > On Sun, May 10, 2020 at 07:09:15AM +, Steve Barnes wrote about > Unicode dashes and quotes sneaking into code: > > > 2. Tell all users that they need to use a "proper" editor or IDE - > > This seems like adding an additional

[Python-ideas] Re: is a

2020-05-01 Thread Jonathan Goble
On the subject of custom infix operators, there are at least two packages on PyPI that allow you to do this already: https://pypi.org/project/funcoperators/ https://pypi.org/project/infix/ On Sat, May 2, 2020 at 12:51 AM Steven D'Aprano wrote: > On Fri, May 01, 2020 at 07:41:57PM -0700, Andrew

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-04-01 Thread Jonathan Goble
On Wed, Apr 1, 2020 at 2:35 PM Dan Sommers < 2qdxy4rzwzuui...@potatochowder.com> wrote: > On Wed, 01 Apr 2020 10:50:29 -0700 > Brendan Barnwell wrote: > > > ... we must demand that the language itself be renamed to something > > less offensive and more accurate, such as > >

[Python-ideas] Re: Argumenting in favor of first()

2019-12-05 Thread Jonathan Goble
On Fri, Dec 6, 2019, 12:47 AM Steven D'Aprano wrote: > On Thu, Dec 05, 2019 at 05:40:05PM -0400, Juancarlo Añez wrote: > > I just found this code: > > > > def get_product_item(jsonld_items): > > for item in jsonld_items: > > if item['@type'] == 'Product': > > return item

[Python-ideas] Re: Where should we put the python-ideas HOWTO?

2019-12-01 Thread Jonathan Goble
On Sun, Dec 1, 2019, 11:06 AM Ned Batchelder wrote: > On 12/1/19 10:45 AM, C. Titus Brown wrote: > > Hi folks, > > > > sorry, took me more than a few months, but I wrote a draft of a > python-ideas HOWTO here, > > > > https://hackmd.io/@-6xkuCDkTrSFptQEimAdcg/B1noEGh2H > > Thanks so much for

[Python-ideas] Re: Adding fixed-point decimals as an option to replace floating-point

2019-11-14 Thread Jonathan Goble
On Thu, Nov 14, 2019 at 8:49 AM wrote: > > An ideal improvement to python would be the introduction of fixed point > decimals. Maybe make them adjustable with os.system(). To adjust, you would > call os.system with the parameters ‘fixed’, 3, 15 to dictate fixed point > math, three integer

[Python-ideas] Re: Allow Path object instances in subprocess.Popen

2019-11-02 Thread Jonathan Goble
On Sat, Nov 2, 2019 at 9:52 PM MRAB wrote: > > On 2019-11-03 00:38, Chris Angelico wrote: > > On Sun, Nov 3, 2019 at 11:34 AM Eric V. Smith wrote: > >> > >> On 11/2/2019 7:24 PM, Steven D'Aprano wrote: > >> > I see no reason why this shouldn't be allowed. It seems like a > >> > straight-forward

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-27 Thread Jonathan Goble
On Sun, Oct 27, 2019, 10:38 AM Soni L. wrote: > that's a waste of a perfectly good name in the namespace. > > On 2019-10-27 11:27 a.m., Anders Hovmöller wrote: > > Just define a function. And don't be a dick. > > > > > On 27 Oct 2019, at 14:57, Soni L. wrote: > > > > > >

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Jonathan Goble
On Mon, Oct 21, 2019 at 8:21 PM Yonatan Zunger wrote: > > Hey everyone, > > I came across a case which might be a use case for a syntax extension, but > I'm not sure. Wanted to get feedback from the group. [...] > @CronJob('job-name', params...).override('dev', more-params...) > def

[Python-ideas] Re: Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2019-10-04 Thread Jonathan Goble
On Fri, Oct 4, 2019 at 7:41 AM wrote: > [spam removed] Why is this 18-month-old thread in particular attracting spammers? The last four messages to this thread have been three spam links and one complaint about spam. Is there any reason for this thread to be bumped in the future with legitimate

[Python-ideas] Re: for ... except, with ... except

2019-07-30 Thread Jonathan Goble
On Tue, Jul 30, 2019 at 9:32 AM Rhodri James wrote: > I've been trying to come up > with something more like this: > >with something_exceptionable() as f: >do_something_with(f) >except with SomeException as e: >handle_exception_in_setup_or_teardown(e) >except

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-09 Thread Jonathan Goble
On Tue, Jul 9, 2019 at 8:04 PM MRAB wrote: > When you start Python, it reports its version. How discoverable is that > version for the launcher, and for tools in general? `python -V` will print a simple version string and exit, like this example using an executable compiled from the 3.8 git

[Python-ideas] Re: `if-unless` expressions in Python

2019-06-25 Thread Jonathan Goble
*de-lurks* On Wed, Jun 26, 2019 at 1:21 AM Steven D'Aprano wrote: > > On Mon, Jun 24, 2019 at 12:37:48PM -0700, Andrew Barnert wrote: > > > And the one-time hassle of figuring out how to configure your MUA, or > > even switching to a better one > > "Better" is subjective, and just because a

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Jonathan Goble
On Wed, May 15, 2019 at 3:45 AM Anders Hovmöller wrote: > > > On 15 May 2019, at 07:51, Jonathan Goble wrote: > > > > That's not a realistic goal; there are some use cases, including in > > CPython builtins, that cannot be accomplished without positional-only

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-14 Thread Jonathan Goble
On Wed, May 15, 2019 at 1:37 AM Anders Hovmöller wrote: > > > On 15 May 2019, at 03:07, Robert Vanden Eynde wrote: > > > > Currently if one wants to provide positional arguments after keyword > > arguments, it's not possible, one must begin with positional arguments [1] > > or use keyword

Re: [Python-ideas] Break multiple loop levels

2019-05-11 Thread Jonathan Goble
On Sat, May 11, 2019 at 1:22 PM haael wrote: > Python allows for breaking out from a loop through 'break' and > 'continue' keywords. It would be nice if it was possible to break many > loop levels using one command. I'm surprised no one has yet mentioned splitting off the loops into a function

Re: [Python-ideas] Backward-incompatible changes for Python 4

2019-04-01 Thread Jonathan Goble
On Mon, Apr 1, 2019 at 6:12 PM Greg Ewing wrote: > Obviously, removing a whole day from the year will create problems > keeping the calendar in step with the seasons. To compensate, it > will be necessary to add approximately 1.25 days worth of leap > seconds to each year. This works out to

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-21 Thread Jonathan Goble
On Thu, Mar 21, 2019 at 1:54 PM Stefan Behnel wrote: > Steven D'Aprano schrieb am 21.03.19 um 17:21: > > On Thu, Mar 21, 2019 at 09:11:18AM -0700, Guido van Rossum wrote: > > > >> I don't find it easy to understand or remember that d1.update(d2) > modifies > >> d1 in place, while d1.merge(d2)

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-18 Thread Jonathan Goble
On Tue, Sep 18, 2018, 2:00 PM Franklin? Lee wrote: > On Tue, Sep 18, 2018 at 11:02 AM Jonathan Goble > wrote: > > > > On Tue, Sep 18, 2018 at 10:49 AM Robert Vanden Eynde < > robertv...@gmail.com> wrote: > >> > >> About moderation, what's the

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-18 Thread Jonathan Goble
On Tue, Sep 18, 2018 at 10:49 AM Robert Vanden Eynde wrote: > About moderation, what's the problem on the list ? > The biggest moderation issue I see with mailing lists is the inability to lock threads and delete posts (i.e. those that are spam or a Code of Conduct violation). Both of those are

Re: [Python-ideas] Add recordlcass to collections module

2018-09-03 Thread Jonathan Goble
On Mon, Sep 3, 2018 at 3:25 AM Jacco van Dorp wrote: > Also, it's rather clear that namedList is a really bad name for a > Recordclass. It's cleary not intended to be a list. It's a record you can > take out from somewhere, mutate, and push back in. > So call it "namedrecord", perhaps?

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Jonathan Goble
On Sat, Sep 1, 2018 at 1:38 PM Robert Vanden Eynde wrote: > What's the difference between you proposition and dataclasses ? Introduced > in Python 3.7 ? > A named list would allow sequence operations such as iteration. Dataclasses, IIUC, do not support sequence operations.

Re: [Python-ideas] Add recordlcass to collections module

2018-09-01 Thread Jonathan Goble
On Sat, Sep 1, 2018 at 1:08 PM Angus Hollands wrote: > As to the other questions, yes, do we need another module in the standard > library? > Wouldn't need a new module. This would be a perfect fit for the existing collections module where namedtuple already resides. I Googled "pypi

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-30 Thread Jonathan Goble
On Thu, Aug 30, 2018, 2:08 AM Greg Ewing wrote: > Also, Fraction(1) for the second case would be flat-out wrong. > How? Raising something to the 2/3 power means squaring it and then taking the cube root of it. -1 squared is 1, and the cube root of 1 is 1. Or am I having a 2:30am brain fart? >

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-02 Thread Jonathan Goble
On Fri, Mar 2, 2018 at 2:56 PM Robert Vanden Eynde wrote: > @Rhodri, this is what Everybody does because you hit the "reply to all" > button, but, we don't receive two copies on the mail, I don't know why (but > that's a good thing). > > Le 2 mars 2018 20:48, "Rhodri James"

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-31 Thread Jonathan Goble
On Fri, Mar 31, 2017 at 2:49 AM Suresh V. via Python-ideas < python-ideas@python.org> wrote: > On Thursday 30 March 2017 02:48 PM, Markus Meskanen wrote: > > Hi Pythonistas, > > > > yet again today I ended up writing: > > > > d = [[0] * 5 for _ in range(10)] > > > > And wondered, why don't we

Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread Jonathan Goble
On Mon, Feb 20, 2017 at 3:55 PM Ryan Gonzalez wrote: > - Right now, a[b,c] is already valid syntax, since it's just indexing a > with the tuple (b, c). The proposal is to make this a specialization in the > grammar, and also allow stuff like a[b:c, d:e] (like >

Re: [Python-ideas] Smart/Curly Quote Marks and cPython

2016-10-22 Thread Jonathan Goble
Interesting idea. +1 from me; probably can be as simple as just having the tokenizer interpret curly quotes as the ASCII (straight) version of itself (in other words, " and the two curly versions of that would all produce the same token, and same for single quotes, eliminating any need for

Re: [Python-ideas] Proposal for default character representation

2016-10-14 Thread Jonathan Goble
On Fri, Oct 14, 2016 at 1:54 AM, Steven D'Aprano wrote: >> and: >> >> o = ord (c) >> if 100 <= o <= 150: > > Which is clearly not the same thing, and better written as: > > if "d" <= c <= "\x96": > ... Or, if you really want to use ord(), you can use hex literals: o =

Re: [Python-ideas] Optimizing list.sort() by checking type in advance

2016-10-10 Thread Jonathan Goble
On Mon, Oct 10, 2016 at 11:30 PM Elliot Gorokhovsky < elliot.gorokhov...@gmail.com> wrote: > - I expect tuples will also be worth specializing (complex sort keys are > often implemented as tuples). > > I'm not sure what you mean here... I'm looking at the types of lo.keys, > not of saved_ob_item