[Python-ideas] Re: Standalone bool?

2020-12-22 Thread Jeff Allen
On 22/12/2020 00:52, Christopher Barker wrote: On Mon, Dec 21, 2020 at 3:37 PM Greg Ewing mailto:greg.ew...@canterbury.ac.nz>> wrote: > However, that ship has sailed. I think it would have been minimally > disruptive when True and False were first introduced, It would have been jus

[Python-ideas] Re: Standard tool for iterating over recursive data structures?

2021-01-01 Thread Jeff Allen
ic) structures, which is likewise dependent on special help from the particular built-in type. Can something be founded on |||__getstate__| ? Happy New Year Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an e

[Python-ideas] (Off-topic) Different object, same id

2021-01-01 Thread Jeff Allen
On 01/01/2021 19:00, Jonathan Fine wrote: By the way, this surprised me. Would anyone like to explain this?     >>> id(f()), id(f())     (139927013695536, 139927013695536) That made me think. The result of the first f() has gone out of scope by the time the second call, and so the id (that is,

[Python-ideas] Re: Standard tool for iterating over recursive data structures?

2021-01-01 Thread Jeff Allen
On 01/01/2021 19:36, Richard Damon wrote: On 1/1/21 2:00 PM, Jonathan Fine wrote: Hi Richard You wrote I believe that one solution to detecting the cycles is to create a set of the object IDs you have visited and started to print. If you come across an ID you have already seen,

[Python-ideas] Re: Change the exception type and message raised when _curses is not found

2021-04-05 Thread Jeff Allen
why not addess all three? (It's surely not a PEP.) Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.o

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

2021-05-03 Thread Jeff Allen
roblem: the size and proportions of text look pokey to me. Here the content does not read very well, being crowd-sourced I imagine without much editorial control. (E.g. https://wiki.python.org/moin/BeginnersGuide is unsure of its level: veering from "if you've never programmed b

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

2021-06-12 Thread Jeff Allen
On 10/06/2021 15:46, Ricky Teachey wrote: Makes me wonder if stepping back and thinking, instead, about a way to automatically (optionally?) put the current calling context dictionary(ies) somewhere that a called function can get at it/them, so it can do what it wants with the context. I th

[Python-ideas] Re: Allow modifying message of TypeError from NotImplemented

2021-06-19 Thread Jeff Allen
d might be called do not check for it. -- Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messag

[Python-ideas] Re: NAN handling in statistics functions

2021-08-27 Thread Jeff Allen
our set. An API could offer some filters, or it may be clearer left to the caller. It is no doubt too late to alter the default behaviour of familiar functions, but there could be a "strict" mode. -- Jeff Allen ___ Python-ideas mailin

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-31 Thread Jeff Allen
strikes me as possibly a Python internal DSL, or Django, but what they've done does not take us far from pure Python. Jeff Allen On 31/08/2018 05:07, Guido van Rossum wrote: Hm. YAML is indeed a great, readable alternative to JSON or XML. But the term DSL implies (to me) more than just

Re: [Python-ideas] Add list.join() please

2019-01-29 Thread Jeff Allen
;.join(str(i) for i in range(10)) I learned enough Groovy last year to use Gradle and was so disappointed to find myself having to write:    excludes: exclusions.join(',')    // Yes, it's that way round :o Even Java agrees (since 1.8) with Python. Jeff Allen ___

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Jeff Allen
On 02/02/2019 18:44, MRAB wrote: On 2019-02-02 17:31, Adrien Ricocotam wrote: > I personally would the first option to be the case. But then vectors shouldn't be list-like but more generator like. > OK, here's another one: if you use 'list(...)' on a vector, does it apply to the vector itself

Re: [Python-ideas] New Data Structure - Non Well-Founded Dict

2019-03-18 Thread Jeff Allen
have rightly suggested python-list as a place you could explore how to construct the data structure you need, using existing features of Python. However, I'll just mention that frozenset is worth a look. Jeff Allen On 17/03/2019 16:35, Savant Of Illusions wrote: I am in desperate need of a

Re: [Python-ideas] META: Is a PEP a good place to record Python's core design decisions and coding principles?

2019-03-24 Thread Jeff Allen
s a recurring one (https://eli.thegreenplace.net/2008/06/06/python-impressions). Jeff Allen ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] add an additional dataclasses.asdict option for non-dataclasses

2019-05-11 Thread Jeff Allen
) goes through to the original object, if allowed) or just a way of constructing and filling a new dict. The latter would not fit my imagined use. Jeff Jeff Allen ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman

[Python-ideas] Re: Lists create

2019-06-21 Thread Jeff Allen
od list of places to learn Python: https://docs.python-guide.org/intro/learning/ . Code club (https://codeclubprojects.org/en-GB/python/) might be a good place to start. Jeff Allen On 20/06/2019 10:38, 21ispi...@parklandsacademy.co.uk wrote: How to list

[Python-ideas] Re: addition of "nameof" operator

2020-02-02 Thread Jeff Allen
E treats as identifying a variable name. It would work in comments too. Single quotes do it pretty well, making it a coding standards and IDEs question. Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-28 Thread Jeff Allen
eople to write this educated English. The argument leads to "everyone should be free to write in their own variant of English, with no consideration for readers". It just wasn't pursued this far. Still, the outcome is less good for inclusivity than it might have been, because t

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

2020-07-05 Thread Jeff Allen
Or "limited" possibly? I'm +0 on the idea FWIW. I also find it difficult to read, but I tend to in-line it as ifs, in part for clarity. Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an emai

[Python-ideas] Re: argmax and argmin to python list

2020-08-30 Thread Jeff Allen
for i, e in enumerate(a))[1] 0 I think one would want argmin() and argmax() to work with general iterables, so I wonder if the stdlib would not be a better home than list itself. I half expected it to be an itertools recipe. The advantage of a recipe is that variations such as needing

[Python-ideas] Re: argmax and argmin to python list

2020-08-30 Thread Jeff Allen
On 30/08/2020 09:51, Barry Scott wrote: >>> a.index(max(a)) 1 Barry This has the drawback of passing twice over the list. The following doesn't, but the complexity somewhat makes Filipp's point: >>> min((e, i) for i, e in enumerate(a))[1] 0 That is 4x slower then my code for 1,000,000 i

[Python-ideas] Re: argmax and argmin to python list

2020-08-31 Thread Jeff Allen
On 31/08/2020 01:14, Christopher Barker wrote: On Sun, Aug 30, 2020 at 7:28 AM Barry > wrote: How is it supposed to work with set or dict or other iterables without clear order? see the discussion in another recent thread about making dict indexable --

[Python-ideas] Re: A new suggestion for Python

2020-10-02 Thread Jeff Allen
;, 'ipp') means the same as: >>> ('hello'.replace)('ell', 'ipp') and the same as: >>> getattr('hello', 'replace')('ell', 'ipp') and not: >>> 'hello'.(replace('ell',

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-15 Thread Jeff Allen
ctably" that doesn't include disassembly). Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.o

[Python-ideas] Re: `importlib.resources` access whole directories as resources

2022-05-18 Thread Jeff Allen
this well, but I note thathttps://docs.python.org/3/library/importlib.html#module-importlib.resources talks about resource containers. (Unfortunately, it also only uses filesystem-like examples.) Might that be what is asked for? -- Jeff Allen ___ Python-

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

2023-09-08 Thread Jeff Allen
e Foo a context manager to use like this: with Foo() as foo:     foo.a()     foo.b(42)     foo.c('penguin')     bar = Bar(foo) bar.do_stuff() (Think I got that right. Not tried it.) Now Foo.__exit__ can be made to properly tear down the resources in a foo. -- Jeff Allen _

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

2023-09-15 Thread Jeff Allen
hort of proof, I know) what is being asked is not possible with the information available at run-time. You can't reliable get from the "reference", which is actually an expression, to the text of the expression. The parallel with f-string = is helpful, for which compile-time suppo

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

2023-09-16 Thread Jeff Allen
ying to describe the desired semantics that way leads to nonsensical ideas, I agree. I'm not convinced this feature is widely useful. Here I'm just trying to focus us on the *viable* semantics MRAB identified. -- Jeff Allen ___ Python-id

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

2023-09-16 Thread Jeff Allen
acclamation as a Good Thing. 3. Willigness to implement and maintain. -- Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/pytho