[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-02 Thread Rob Cliffe via Python-ideas
probably too high for this feature. But what if python lifted the newline requirement for blocks that contain compound statements? That is, statements that end in a ':' can be followed by other statements that end in a ':' on the same line. AFAICT there would be no ambiguity

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-02 Thread Rob Cliffe via Python-ideas
.  That's no reason not to have the choice. Of course, this has to be weighed against the cost of the change. Best wishes Rob Cliffe Let's just keep Python readable rather than see how much we can cram on a line. On Wed, Mar 2, 2022, 2:56 PM Jeremiah Paige wrote: I have on a few

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-02 Thread Rob Cliffe via Python-ideas
be a subjective one.  That's no reason not to have the choice. Of course, this has to be weighed against the cost of the proposed change.  I'm +0.5 for it. Best wishes Rob Cliffe Let's just keep Python readable rather than see how much we can cram on a line. On Wed, Mar 2

[Python-ideas] Re: shutil.copyfileobj to return number of bytes copied

2022-03-06 Thread Davis, Matthew via Python-ideas
data to another file-like object and counts it would be a feasible solution. Thanks. Regards, Matt From: Barry Date: Thursday, 3 March 2022 at 2:48 am To: Davis, Matthew Cc: [email protected] Subject: Re: [Python-ideas] shutil.copyfileobj to return number of bytes copied You don't

[Python-ideas] Re: Add a replace method to tuples

2022-03-10 Thread Rob Cliffe via Python-ideas
demonstrate.  So there is no strong need for a new method for it. Best wishes Rob Cliffe On 10/03/2022 03:42, wfdc via Python-ideas wrote: Add a "replace" method to tuples that returnsa new tuple with the element at a given index replaced with a given value. Example implementation: d

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread Rob Cliffe via Python-ideas
This is a common scenario on python-list or python-ideas: Someone has an idea that they think is the greatest thing since sliced bread.  They propose it, and feel hurt / rejected when they get pushback instead of everyone jumping up and down and saying how brilliant it is. Sometimes they are

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread Rob Cliffe via Python-ideas
iner, but not "index". I suggest it's harder than you think. (Try it!) How much harder? Can you post your candidate? It was you that said it could be a 1-liner. The burden of proof is on you, if you still want to argue the point. Rob Cliffe ____

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread Rob Cliffe via Python-ideas
rden of proof is on you, if you still want to argue the point. Rob Cliffe___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread Rob Cliffe via Python-ideas
h a function should be part of the standard library. Well, you are 1 user.  Have you evidence that there are (many) others? Best wishes Rob Cliffe --- Original Message --- On Thursday, March 10th, 2022 at 8:38 PM, Rob Cliffe via Python-ideas wrote: This could cause confusion because st

[Python-ideas] Giving Decimal a global context was a mistake?

2022-04-06 Thread Mark Dickinson via Python-ideas
would that precision information come from? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https:

[Python-ideas] Re: Custom literals, a la C++

2022-04-10 Thread Ronald Oussoren via Python-ideas
ace, I don’t have a strong opinion about that because I don’t have a use case for this feature myself. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ ___ Python-ideas mailing list -- [email protected] To unsub

[Python-ideas] Re: Custom literals, a la C++

2022-04-11 Thread Ronald Oussoren via Python-ideas
> On 10 Apr 2022, at 11:20, Chris Angelico wrote: > > On Sun, 10 Apr 2022 at 18:44, Ronald Oussoren via Python-ideas > mailto:[email protected]>> wrote: >> >> >> >> On 8 Apr 2022, at 16:33, Steven D'Aprano wrote: >> >> On

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Ronald Oussoren via Python-ideas
his at runtime, or as a lint tool. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pyt

[Python-ideas] Re: Time to relax some restrictions on the walrus operator?

2022-05-09 Thread Rob Cliffe via Python-ideas
itor service health while Response(status=200, json={"stats": stats}) := health_check(): print(stats) time.sleep(5) See above - shouldn't try to assign to a literal. Best wishes, Rob Cliffe ___ Python-ideas mailing

[Python-ideas] Re: Time to relax some restrictions on the walrus operator?

2022-05-15 Thread Rob Cliffe via Python-ideas
a sub-expression, and it Just Works if you use the assignment statement instead. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/p

[Python-ideas] Opt-in “iter def” and/or “gen def” syntax for generator functions

2022-05-31 Thread Aaron L via Python-ideas
urrent type checker regime, I thought it might be worth discussing. Apologies if I missed any more recent discussions.) Thanks, Aaron [1] https://mail.python.org/archives/list/[email protected]/thread/OVIHVRKFUN4KMDTVSIAAN2CGR7VXFGQS/#GE6RDNWTR4PPKSMKSGMCFBFUJ4

[Python-ideas] Re: Opt-in “iter def” and/or “gen def” syntax for generator functions

2022-05-31 Thread Aaron L via Python-ideas
tax proposed > in the PEP is exactly right - not too hot, not too cold. But, like the Oracle > at Delphi in Greek mythology, it doesn’t tell me why, so I don’t have a > rebuttal for the arguments against the PEP syntax. - Aaron ___ Python-ideas m

[Python-ideas] Re: Opt-in “iter def” and/or “gen def” syntax for generator functions

2022-05-31 Thread Aaron L via Python-ideas
quot; anyway. I do appreciate the responses and discussion! Thanks, Aaron _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pyth

[Python-ideas] Re: default as a keyword argument for dict.get and dict.pop

2022-06-08 Thread Rob Cliffe via Python-ideas
On 07/06/2022 15:28, [email protected] wrote: I think ``` d.get(key, default=3) ``` way more readable than ``` d.get(key, 3) I completely agree. Best wishes Rob Cliffe ___ Python-ideas mailing list -- [email protected] To

[Python-ideas] Re: default as a keyword argument for dict.get and dict.pop

2022-06-08 Thread Rob Cliffe via Python-ideas
On 08/06/2022 15:40, Eric V. Smith via Python-ideas wrote: On 6/7/2022 4:59 PM, Chris Angelico wrote: On Wed, 8 Jun 2022 at 00:36, wrote: Hello! Do you know if there has been discussions around why is the default argument is positional only in the dict methods get and pop? I think

[Python-ideas] Re: Null wildcard in de-structuring to ignore remainder and stop iterating

2022-06-09 Thread Rob Cliffe via Python-ideas
; type(mygen()) Best wishes Rob Cliffe ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mai

[Python-ideas] Re: Null wildcard in de-structuring to ignore remainder and stop iterating

2022-06-10 Thread Rob Cliffe via Python-ideas
ng could be added piecemeal to iterators such as open() according to demand. Of course, for non-reusable iterators it would be forbidden to go backwards (or even remain in the same place):     agen[42]     agen[41] ValueError: Generator has been used up past the slice point. (Better wordi

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

2022-06-14 Thread Rob Cliffe via Python-ideas
I think that its meaning is less clear if one doesn't already know what the syntax means. I think the code would be easier to skim, however, using that option after one does know its meaning. My favorite options are '@' or '?=' (tied), followed by ':=' followed

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

2022-06-15 Thread Rob Cliffe via Python-ideas
d version might bridge that gap by introducing "later" or "defer" or "delay" in a narrow context, but not foreclosing its later use more broadly. On Wed, Jun 15, 2022 at 8:38 AM Steven D'Aprano wrote: On Tue, Jun 14, 2022 at 11:59:44AM +0100, Rob Cliffe v

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

2022-06-16 Thread Rob Cliffe via Python-ideas
, but perhaps a slim majority of the small number who have commented (5 vs 3, I think). On Thu, Jun 16, 2022, 10:38 PM Steve Jorgensen wrote: Is there anything that I can do, as a random Python user to help move this to the next stage? I'm happy to go along with whatever the p

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

2022-06-16 Thread Rob Cliffe via Python-ideas
On 15/06/2022 23:01, Steven D'Aprano wrote: On Wed, Jun 15, 2022 at 01:58:28PM +0100, Rob Cliffe via Python-ideas wrote: Please.  This has been many times by several people already.  No-one is going to change their mind on this by now.  There's no point in rehashing it and adding no

[Python-ideas] Type checking for **kwargs based on its use

2022-06-17 Thread Mauricio Villegas via Python-ideas
sed for automatically creating complex parsers based on signatures (https://jsonargparse.readthedocs.io/en/stable/#classes-methods-and-functions). I do plan to support identifying what **kwargs accepts based on its use. See all the cases currently supported https://jsonargparse.readthedocs.io/en/latest/

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

2022-06-18 Thread Rob Cliffe via Python-ideas
On 18/06/2022 03:28, Steven D'Aprano wrote: On Fri, Jun 17, 2022 at 06:32:36AM +0100, Rob Cliffe wrote: The bar for adding a new hard keyword to Python is very high. Likewise for new syntax. I would suggest less so, provided that it was previously illegal, because it's backward-

[Python-ideas] Re: Null wildcard in de-structuring to ignore remainder and stop iterating

2022-06-18 Thread Rob Cliffe via Python-ideas
tter than implicit in this case. You could argue that islice should be made a builtin, but I don't know that it's used enough to justify that. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-idea

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

2022-06-18 Thread Rob Cliffe via Python-ideas
Sorry, but I think all this talk about lazy evaluation is a big red herring:     (1) Python is not Haskell or Dask.     (2) Lazy evaluation is something Python doesn't have, and would be a HUGE amount of work for Chris (or anyone) to implement (much more, I would think, than he has alread

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

2022-06-20 Thread Rob Cliffe via Python-ideas
osts on the lines of "Why doesn't this work [as I expected]?"  I don't think that anyone, including Chris, would say that it allows you to do something that you can't do already (though I might be wrong, but I believe Python is already Turing-complete 😁).  The virtue of th

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

2022-06-20 Thread Rob Cliffe via Python-ideas
e to it in the PEP but removed it because it was unhelpful. Rob Cliffe___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived

[Python-ideas] Re: Null wildcard in de-structuring to ignore remainder and stop iterating

2022-06-20 Thread Rob Cliffe via Python-ideas
On 20/06/2022 17:39, Jeremiah Paige wrote: On Sat, Jun 18, 2022 at 5:42 PM Rob Cliffe via Python-ideas wrote: To me, the natural implementation of slicing on a non-reusable iterator (such as a generator) would be that you are not allowed to go backwards or even stand

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

2022-06-20 Thread Rob Cliffe via Python-ideas
tentially useful. *ABSOLUTELY*.  I don't think anyone would deny that.  Certainly not I. Let's call "I want late-bound defaults and Python doesn't have them" Problem A. Let's call "I want my default value not to be evaluated until needed" Problem B. (Of co

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
dubious to me. As I understand it this would >> require some fairly deep changes to how evaluation works in Python. >> Right now in an expression like `type(blah)`, there isn't any way for >> the evaluation of `blah` to depend on the fact that it happens to occur >> as an arg

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
On Tue, Jun 21, 2022 at 4:28 PM Chris Angelico wrote: > On Wed, 22 Jun 2022 at 08:21, Carl Meyer via Python-ideas > wrote: > > > > > > > > On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. < > [email protected]> wrote: > >> > >>

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
e same thing. :-) > I’m not sure what you mean. I don’t think there’s any way PEP 690 can introduce dynamic scoping like this. Can you give an example? Carl _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-id

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-22 Thread Rob Cliffe via Python-ideas
would probably stick with the sentinel idiom which is explicit.  I think "n=n" is confusing to an inexperienced Python user. You may not think this is important.  My opinion is that late-bound defaults are important. (We may have to agree to differ.)  Apart from anything else: Python

[Python-ideas] Re: Void type

2022-07-25 Thread Anthony Flury via Python-ideas
n a function parameter it is not > processed: > > func(Void) == func() == "default" > _______ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > ht

[Python-ideas] Allow more flexibility for describing bytes objects.

2022-11-23 Thread Ronald Hoogenboom via Python-ideas
Refer to PEP 3137 and PEP 358. Bytes objects are for conveying binary data (or encoded strings). Such binary data is customary specified in hex-dump or base64 format in source files. It would be nice to introduce a way in python to do that 'natively' (at lexical analysis time) using

[Python-ideas] Re: Enhancing variable scope control

2022-12-04 Thread Rob Cliffe via Python-ideas
exited.  Again, this would be unexpected. Best wishes Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message

[Python-ideas] Re: Enhancing variable scope control

2022-12-04 Thread Rob Cliffe via Python-ideas
On 04/12/2022 17:08, Chris Angelico wrote: On Mon, 5 Dec 2022 at 04:07, Rob Cliffe via Python-ideas wrote: On 30/11/2022 20:27, Anony Mous wrote: Danceswithmice wrote: The idea is that YOU write "local:", and the interpreter, without you ever seeing it, promotes that int

[Python-ideas] Re: [Feature Request] Add attribute font_path to the class tkinter.font.Font

2022-12-14 Thread Ronald Oussoren via Python-ideas
mentation. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/m

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-22 Thread Rob Cliffe via Python-ideas
On 17/12/2022 16:07, [email protected] wrote: Python's currently supported string types are just single letter, so the suggestion is to require tagged strings to be at least two letters. Er, no: Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-22 Thread Rob Cliffe via Python-ideas
rn mystr(str(self).upper()) s = mystr("hello") print(s.method())  # prints 1234 print(s.upper())   # prints HELLO print(s.upper().method())  # prints 1234 Best wishes Rob Cliffe_______ Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-23 Thread Rob Cliffe via Python-ideas
at: If you were subclassing str, you would probably want __str__ and __repr__ (if you were not overriding them) to return plain strings. Best wishes Rob Cliffe ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-l

[Python-ideas] Multiple arguments to str.partition and bytes.partition

2023-01-07 Thread James Addison via Python-ideas
.partition('@', ':') Beneficially for the caller, the number of tuple elements can be determined based on the number of positional arguments. For n arguments, a tuple of length 2n + 1 will be returned. Thank you for any and all feedback. James [1] - https://docs.python.org/3/li

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-08 Thread James Addison via Python-ideas
("?", "#")'? would it return a tuple of length five?) ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archi

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-08 Thread James Addison via Python-ideas
(rationale: that would allow either proposal to advance without delaying the other -- bearing in mind a hopefully-unlikely chance of merge conflicts if they reach release-readiness implementation status in parallel) _______ Python-ideas mailing list

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-08 Thread James Addison via Python-ideas
tand it, limited to at-most-one wildcard pattern per match (by sensible design). > I would prefer "one bite per call" partition > to a partition at multiple points. That does seem clearer - and clearer is, generally, probably better. I suppose an analysis (that I don'

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-09 Thread James Addison via Python-ideas
exactly-once while the input is scanned (also iterated) exactly-once ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: Combinations of keywords

2023-02-21 Thread James Addison via Python-ideas
port A_UNIX_MODULE on ImportError >>> try value = int(x[2]) but value = 0 on IndexError, ValueError ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/ma

[Python-ideas] Re: Proposal: -X importcache to supplement -X importtime for loaded modules

2023-02-27 Thread James Addison via Python-ideas
gards, James ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python

[Python-ideas] Ampersand operator for strings

2023-03-05 Thread Rob Cliffe via Python-ideas
tructing     human-readable output (e.g. log output, debug/error messages, on-screen labels). Cognitive burden:     This would of course be one more thing to learn.     But I suggest that it is fairly intuitive that     s1 + s2     s1 & s2     both suggest that two strings are being c

[Python-ideas] Re: Ampersand operator for strings

2023-03-06 Thread Rob Cliffe via Python-ideas
typing.  Just sayin'. Best wishes Rob Cliffe I admit that I use M-SPC (aka just-one-space) lot in Emacsen, but I can't recall wanting it in a program in any language. ___ Python-ideas mailing list -- [email protected] To unsubscribe send

[Python-ideas] Re: Ampersand operator for strings

2023-03-07 Thread Rob Cliffe via Python-ideas
it, as Mr Berlier helpfully informs us, less efficient 😁). But I can imagine cases where the leftmost string starts with indentation to start a paragraph (or to correctly indent Python code), which you want to preserve. Or perhaps even to make it start in the correct column of a table, ha-ha. As

[Python-ideas] Re: Ampersand operator for strings

2023-03-07 Thread Rob Cliffe via Python-ideas
You make a very powerful point, Bruce.  Much more so IMO than anyone else has so far. Unless anyone else can find a convincing rebuttal, I withdraw my proposal. Best wishes Rob Cliffe On 07/03/2023 21:49, Bruce Leban wrote: On Sun, Mar 5, 2023 at 7:39 PM Rob Cliffe via Python-ideas wrote

[Python-ideas] join() could add separators at start or end

2023-03-08 Thread Rob Cliffe via Python-ideas
27;\n' +     b''.join(self.lineBuffer)) Lib\site-packages\twisted\conch\client\knownhosts.py:547-549:     hostsFileObj.write(     b"\n".join([entry.toString() for entry in self._added]) +     b"\n") Lib\site-packag

[Python-ideas] Re: Ampersand operator for strings

2023-03-08 Thread Rob Cliffe via Python-ideas
;ascii') + b' ' + message]     lines = [b"HTTP/1.0" & str(code).encode('ascii') & message] There are many examples (too many to list) where '&' could be used but would not add a great deal of value and its use or non-use would be l

[Python-ideas] Re: join() could add separators at start or end

2023-03-09 Thread Rob Cliffe via Python-ideas
On 09/03/2023 05:25, Bruce Leban wrote: On Wed, Mar 8, 2023 at 4:34 PM Rob Cliffe via Python-ideas wrote: It seems to me that it would be useful to be able to make the str.join() function put separators, not only between the items of its operand, but also optionally at

[Python-ideas] Re: Ampersand operator for strings

2023-03-11 Thread Rob Cliffe via Python-ideas
it is trickier still. As it is so easy to get these things wrong, perhaps having it built in is not such a terrible idea?😁 Best wishes Rob Cliffe In any case I recommend reaching out for a library like Rich (https://github.com/Textualize/rich) if you care about formatting the output

[Python-ideas] Re: Ampersand operator for strings

2023-03-12 Thread Rob Cliffe via Python-ideas
or s in middle), last.lstrip())) What is harder is to be sure that this would be the expected behaviour when using a `&` operator on strings. Why `'   a' & 'b'` would produce `'a b'` and `'   ' & 'b'` produce `' b'` for exam

[Python-ideas] Re: join() could add separators at start or end

2023-03-14 Thread Rob Cliffe via Python-ideas
uivalent solution is easier to understand and to write, and will lead to way less confusion about what join() actually does. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail

[Python-ideas] Re: An interface for `mro` methods similar to the interface for `iter`, `getattr`, etc...

2023-03-24 Thread Rob Cliffe via Python-ideas
t; object.__mro__ (,) Best wishes Rob Cliffe_______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived

[Python-ideas] Re: len(Enum) should raise TypeError

2023-04-04 Thread James Addison via Python-ideas
Hi Richard, On Tue, 4 Apr 2023 at 12:49, Richard Hajek wrote: > > I encountered that Enum having a len hid a mistake on my part. If len(Enum) > raised, my mistake would be immediately apparent, however at the end of the > day, my mistake was easily found. Can any Python linting to

[Python-ideas] Python should add "__name__" and "__doc__" attributes to "functools.partial"

2023-04-17 Thread Matteo Raso via Python-ideas
should make it much easier to use "partial" in the future. Thanks for your consideration. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3

[Python-ideas] new PEP: implementation independent native code invocation and data exchange ABI standard (not sure if accurate)

2023-04-23 Thread Evan Greenup via Python-ideas
Dear All Python is a "glue" language, its dynamic nature has programming advantage and performance disadvantage. The best way to use Python is write Python code for high-level stuff and use native programming language like C, Rust, Zig, V for low level stuff. Currently, there is li

[Python-ideas] Re: Allowing `str.format` to format one or more parameters instead of all parameters

2023-04-25 Thread Rob Cliffe via Python-ideas
parameter `color` Is there any reason you can't write pfr =r"\mathjax{{color}}{{text}}".replace("{color}", "blue") result =r"\mathjax{{color}}{{text}}".replace("{text}", "Spanish") Best wishes Rob Cliffe

[Python-ideas] Re: Make ellipsis an indicator of missing implementation

2023-05-03 Thread Rob Cliffe via Python-ideas
Sorry, -1. Is this really worth the hassle when you can write (more explicitly) def my_fun():    raise NotImplementedError # todo Python has grown steadily more complicated in its lifetime.  Usually for good reasons.  But each additional feature adds to the learning curve and the maintenance

[Python-ideas] Re: Warn when iterating over an already exhausted generator

2023-06-12 Thread Rob Cliffe via Python-ideas
On 12/06/2023 21:11, Barry wrote: On 12 Jun 2023, at 16:55, BoppreH via Python-ideas wrote: Then the empty list creates hard-to-track bugs. I'm familiar with the iterator protocol and why the behavior above happens, but couldn't it be prevented? I don’t think so. It is not al

[Python-ideas] Re: Undefined type

2023-06-12 Thread Rob Cliffe via Python-ideas
ou do, seems like a good solution.  It means *you* control what meaning it has in the contexts where it appears. Best wishes Rob Cliffe On 07/06/2023 17:43, Dom Grigonis wrote: This has been bugging me for a long time. It seems that python doesn’t have a convention for “Undefined” type. When I st

[Python-ideas] Re: "Curated" package repo?

2023-07-05 Thread James Addison via Python-ideas
topic, and I don't *think* I ever wrote "someone > should", and I certainly didn't write "PyPa should". > > But whatever I or anyone else wrote, my intention was to discuss what > might be done to address what I think is a real problem/limitation in the >

[Python-ideas] Re: "Curated" package repo?

2023-07-06 Thread James Addison via Python-ideas
On Wed, Jul 5, 2023, 19:06 Chris Angelico wrote: > On Thu, 6 Jul 2023 at 03:57, James Addison via Python-ideas > wrote: > > I also agree with a later reply about avoiding the murkier side of > blockchains / etc. That said, it seems to me (again, sample size one > anecdata) th

[Python-ideas] Re: "Curated" package repo?

2023-07-06 Thread James Addison via Python-ideas
ty use cases. > > I don’t want to load a hash table to load a third party module on a UEFI > interface. > > On Thu, Jul 6, 2023 at 9:11 AM James Addison via Python-ideas < > [email protected]> wrote: > >> On Wed, Jul 5, 2023, 19:06 Chris Angelico wrote: >>

[Python-ideas] Re: "Curated" package repo?

2023-07-06 Thread James Addison via Python-ideas
hird party module on a UEFI >> interface. >> >> On Thu, Jul 6, 2023 at 9:11 AM James Addison via Python-ideas < >> [email protected]> wrote: >> >>> On Wed, Jul 5, 2023, 19:06 Chris Angelico wrote: >>> >>>> On Thu, 6 Jul 2023

[Python-ideas] Re: "Curated" package repo?

2023-07-09 Thread James Addison via Python-ideas
gnore their (apparent) gaming of the > ratings but not good for a swarm of robots. Hi Cameron, That sounds to me like the basis of a distributed trust network, and could be useful. Some thoughts from experience working with Python (and other ecosystem) packages: after getting to know the usern

[Python-ideas] Re: "Curated" package repo?

2023-07-09 Thread James Addison via Python-ideas
On Sun, Jul 9, 2023, 09:13 Chris Angelico wrote: > On Sun, 9 Jul 2023 at 18:06, James Addison via Python-ideas > wrote: > > > > On Sun, 9 Jul 2023 at 02:11, Cameron Simpson wrote: > > > I have always thought that any community scoring system should allow > > &g

[Python-ideas] Re: "Curated" package repo?

2023-07-09 Thread James Addison via Python-ideas
On Sun, Jul 9, 2023, 15:52 Stephen J. Turnbull < [email protected]> wrote: > James Addison via Python-ideas writes: > > > The implementation of such a system could either be centralized or > > distributed; the trust signals that human users infer from

[Python-ideas] Re: "Curated" package repo?

2023-07-09 Thread James Addison via Python-ideas
I didn't really address your point there; indirectly mine was to reaffirm a sense that not all participants may want to read the opinions of others while learning technologies, and that's why I am skeptical of the suggestions to include subjective user ratings of any kind within Python

[Python-ideas] Re: "Curated" package repo?

2023-07-09 Thread James Addison via Python-ideas
On Sun, Jul 9, 2023, 16:25 Paul Moore wrote: > > > On Sun, 9 Jul 2023 at 15:56, Stephen J. Turnbull < > [email protected]> wrote: > >> James Addison via Python-ideas writes: >> >> > The implementation of such a system could either be c

[Python-ideas] Re: Proposal for get_or function in Python dictionaries

2023-07-19 Thread Rob Cliffe via Python-ideas
solutions to several proposals. Well, default is only evaluated if needed; bar is always evaluated. What is wrong with the Python equivalent result = default if bar is None else bar or if you prefer result = bar if bar is not None else default Perhaps you didn't know about this construction? It

[Python-ideas] Re: Proposal for get_or function in Python dictionaries

2023-07-19 Thread James Addison via Python-ideas
On Thu, Jul 20, 2023, 01:19 Rob Cliffe via Python-ideas < [email protected]> wrote: > > > On 15/07/2023 21:08, Dom Grigonis wrote: > > Just to add. I haven’t thought about evaluation. Thus, to prevent > evaluation of unnecessary code, introduction of C-style expres

[Python-ideas] Re: "Curated" package repo?

2023-07-24 Thread James Addison via Python-ideas
On Sun, Jul 9, 2023, 23:35 Christopher Barker wrote: > On Sun, Jul 9, 2023 at 8:37 AM James Addison via Python-ideas < > [email protected]> wrote: > >> ISTM the primary use cases advanced here have been for "naive" users. >>>> Likely they won'

[Python-ideas] Re: else without except

2023-08-01 Thread Ronald Oussoren via Python-ideas
how a new feature would improve realistic code patterns helps to defend to proposal. Ronald — Twitter / micro.blog: @ronaldoussoren Mastodon: @[email protected]. Blog: https://blog.ronaldoussoren.net/ _______ Python-ideas mailing list -- pyt

[Python-ideas] Re: while(tt--)

2023-08-04 Thread Niktar Lirik via Python-ideas
Hi Daniil. Yes, you can do almost same:     tt = 5     while tt := tt - 1:     print(tt) 04.08.2023 9:18, [email protected] пишет: Currently in Python we have construction like this: tt = 5 while t: # do something tt -= 1 It would be great if in Python we have

[Python-ideas] Re: Conditional 1-line expression in python

2023-08-05 Thread Rob Cliffe via Python-ideas
r 3-question poll. https://q5yitzu62.supersurvey.com Would be interesting to see if my preference is an outlier or not really. Kind regards, D. Grigonis ___ Python-ideas mailing list [email protected] To unsubscribe send an email topy

[Python-ideas] Re: while(tt--)

2023-08-11 Thread Rob Cliffe via Python-ideas
On 04/08/2023 14:02, Niktar Lirik via Python-ideas wrote: Hi Daniil. Yes, you can do almost same:     tt = 5     while tt := tt - 1:     print(tt) "almost" is right.  The OP's version, as far as I can tell, wants to do post-decrement (test tt, then decrement it)

[Python-ideas] Re: factory for sentinel objects

2023-08-31 Thread Tim Hoffmann via Python-ideas
}) return cls() > Tim Hoffmann hat am 31.08.2023 10:44 CEST > geschrieben: > > > The standard pattern to create a sentinel in Python is > > >>> Unset = object() > > While this is often good enough, it has some shortcomings: > > - repr(Uns

[Python-ideas] factory for sentinel objects

2023-08-31 Thread Tim Hoffmann via Python-ideas
The standard pattern to create a sentinel in Python is >>> Unset = object() While this is often good enough, it has some shortcomings: - repr(Unset) is unhelpful: - copy/deepcopy create a copy of the sentinel object, which can lead to surprising results such as: >>>

[Python-ideas] Re: factory for sentinel objects

2023-08-31 Thread Tim Hoffmann via Python-ideas
ch in the right direction. Will continue discussing in this context. > Matthias Görgens hat am 31.08.2023 11:29 CEST > geschrieben: > > > Seems nice. Just write a library and upload it to one of the usual places? > ___________ Py

[Python-ideas] Re: Have del return a value

2023-09-11 Thread Rob Cliffe via Python-ideas
large memory footprint that is only needed temporarily. Best wishes Rob Cliffe PS Ooh, not quite true.  I have used it to delete a variable that should no longer be needed to detect accidental illegitimate use of said variable. RC___ Python-ideas

[Python-ideas] Re: Have del return a value

2023-09-11 Thread Rob Cliffe via Python-ideas
large memory footprint that is only needed temporarily. Best wishes Rob Cliffe___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Rob Cliffe via Python-ideas
710     variable_names = [k for k, v in locals().items() if v is 710] Depending on the Python implementation, variable_names may be ['var1', 'var2'] or it may be empty (depending on whether 710 is interned).  It could also in theory contain one of 'var1', 'var2&#x

[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Rob Cliffe via Python-ideas
nt("Your variable name is "+ variable_name) it does "work", but it doesn't make much sense with Python's semantics.  You could have two identifiers bound to the same object; which one you got hold of would be essentially random. Puzzled. Rob Cliffe__

[Python-ideas] Reconstructing datetime from microsecond timestamp

2023-09-24 Thread Samuel Freilich via Python-ideas
on that supports. Peace, -Sam _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/p

[Python-ideas] Re: Reconstructing datetime from microsecond timestamp

2023-09-25 Thread Samuel Freilich via Python-ideas
*puts on contributor hat* Well all right then! Filed https://github.com/python/cpython/issues/109849, recapping this and asking some questions about the specifics. I'll try to put together a PR. On Mon, Sep 25, 2023 at 3:49 AM Stephen J. Turnbull < [email protected]

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-10 Thread Rob Cliffe via Python-ideas
ent. As Stephen says, Python often adds new features conservatively, then extends them later if/when it seems desirable.  This happened with the '@' decorater: originally it came with all manner of restrictions, but eventually they were removed.  IMO this was a good thing because it made

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: On 12/21/2023 4:38 PM, Steve Jorgensen wrote: I am finding that it would be useful to be able to define a dataclass that is an abstract base class and define some of its field as abstract. As I am typing this, I realize that I could

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
not the best tool for the job!) * web.refs of possible interest: https://docs.python.org/3/library/abc.html [noting the >=v3.3 use of properties (cf "field") https://stackoverflow.com/questions/51079503/dataclasses-and-property-decorator https://florimond.dev/en/posts/2018/10/reconciling-da

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
On 12/23/23 09:51, Chris Angelico wrote: On Sat, 23 Dec 2023 at 07:13, DL Neil via Python-ideas wrote: On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: On 12/21/2023 4:38 PM, Steve Jorgensen wrote: I am finding that it would be useful to be able to define a dataclass that is an

<    11   12   13   14   15   16   17   >