[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
I really appreciate the pointers, thank you. I will look into them. ___ 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: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
Makes sense, will do so. ___ 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

[Python-ideas] Native support of YAML in Python STDLIB

2023-03-13 Thread scott.fields--- via Python-ideas
supporting YAML, I would think it time for Python to formally adopt this technology in the core foundation. Is there still a reason why this isn't being pursued as native infrastructure in Python? ___ Python-ideas mailing list -- python-

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

2023-06-12 Thread BoppreH via Python-ideas
when calling `__iter__` on an exhausted generator? _______ 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

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

2023-06-12 Thread BoppreH via Python-ideas
empty list. BoppreH On Mon, Jun 12, 2023, at 10:11 PM, 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

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

2023-06-13 Thread BoppreH via Python-ideas
via Python-ideas wrote: > > Also the OP's request was for generators, not for any iterator. > > IMO it would be a bad idea to make generators behave differently > from other iterators in this regard. And it's far too late to > redefine the iterator protocol in general, becaus

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

2023-06-13 Thread BoppreH via Python-ideas
would already be helpful, like Go's race condition detector. -- BoppreH_______ 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 http

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

2023-06-13 Thread BoppreH via Python-ideas
ed numbers. > 2. If I wanted unmodified list and if it was modified then it is an error, > your solution doesn’t work either. > 3. If sorting is ok only on non-empty iterator, then just `assert sorted` > after sorting. > > If you could give a full real-life scenario, then i

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

2023-06-13 Thread BoppreH via Python-ideas
Sorry, I'm new to the list and was not aware the burden of proof was so high. Can you point me to one or two successful posts in Python-ideas where I can learn how to show there's a real need for a feature? On Tue, Jun 13, 2023, at 11:25 PM, Chris Angelico wrote: > On Wed, 14 Jun

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

2023-06-13 Thread BoppreH via Python-ideas
____ 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/[email protected]/message/KAF

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

2023-07-24 Thread anthony.flury via Python-ideas
nd invoked once. -- Original Message -- From: "Rob Cliffe via Python-ideas" To: "Dom Grigonis" ; "Jothir Adithyan" Cc: [email protected] Sent: Monday, 17 Jul, 23 At 16:09 Subject: [Python-ideas] Re: Proposal for get_or function in Python dictionari

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-18 Thread dn via Python-ideas
/datamodel.html#descriptors -- Regards, =dn _______ 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: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread dn via Python-ideas
to make use of them in our application code... (YMMV!) -- Regards, =dn _______ 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: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread dn via Python-ideas
On 19/10/2023 20.43, Dom Grigonis wrote: On 19 Oct 2023, at 10:27, dn via Python-ideas wrote: On 19/10/2023 19.50, Dom Grigonis wrote: Thank you, Good information, thank you. Was not aware of __set_name__. IIRC that was one of the updates/improvements. Thanks to whomsoever...! The

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

2023-11-08 Thread anthony.flury via Python-ideas
o the user_name variable will only have the name 'person_name', but not user_name, as the field objects need to know their names on the model (and their names on the views/forms). -- Original Message -- From: "Rene Nejsum" To: [email protected] Sent: Saturday,

[Python-ideas] PEP 533 Redux?

2020-12-31 Thread Paul Bryan via Python-ideas
dress this issue? ___ 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

[Python-ideas] Re: PEP 533 Redux?

2020-12-31 Thread Paul Bryan via Python-ideas
> From: Paul Bryan via Python-ideas > Sent: Thursday, December 31, 2020 12:06 PM > To: [email protected] > Subject: [EXTERNAL] [Python-ideas] PEP 533 Redux?  > I've now encountered an issue I believe that PEP 533 was intended to > address: > > When

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

2021-01-01 Thread Samuel Freilich via Python-ideas
structures, which > > is likewise dependent on special help from the particular built-in type. > > Can something be founded on |||__getstate__| ? > > I don't think so. All the logic for dealing with cycles is buried > inside pickle -- __getstate__ just gets info about on

[Python-ideas] Re: Python with braces formal proposal?

2021-01-05 Thread Ronald Oussoren via Python-ideas
guage designers is about this. IMHO it is highly unlikely that any proposal about adding braces to Python would be accepted. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ ___ Python-ideas mailing list -- [email protected] To

[Python-ideas] Re: Python with braces formal proposal?

2021-01-05 Thread Ronald Oussoren via Python-ideas
uot;acceptance", and accepted it themselves. >>> >>> The problem? There's high duplication of effort in that area, and >>> the same implementation bugs are repeated again and again. So the >>> question is whether someone who did it, tried to spec out what

[Python-ideas] Re: Add a "closed for" loop (was "PEP 533 Redux?")

2021-01-06 Thread Paul Bryan via Python-ideas
re would be no backwards incompatibility. > > If we want to get really crazy we can also allow an "open for" loop > and kick off a very long deprecation process where eventually an > unadorned for loop would become "closed" by default. > > Thanks, > B

[Python-ideas] dataclass: __init__ kwargs and Optional[type]

2021-01-24 Thread Paul Bryan via Python-ideas
dataclass decorator parameter like "init_kwonly" (default=False to provide backward compatibility) that if True would implement this behavior. Thoughts? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-id

[Python-ideas] Re: dataclass: __init__ kwargs and Optional[type]

2021-01-24 Thread Paul Bryan via Python-ideas
The main benefits of this proposal: - the order of fields (those with defaults, those without) is irrelevant - don't need to pedantically add default = None for Optional values On Sun, 2021-01-24 at 19:46 +, Paul Bryan via Python-ideas wrote: > I've created a helper class in m

[Python-ideas] Re: dataclass: __init__ kwargs and Optional[type]

2021-01-25 Thread Paul Bryan via Python-ideas
Eric > On 1/24/2021 3:07 PM, Paul Bryan via Python-ideas wrote: > > The main benefits of this proposal: > > - the order of fields (those with defaults, those without) is > irrelevant > - don't need to pedantically add default = None for Optional values > &

[Python-ideas] Re: Conditional with statements

2021-02-12 Thread Rob Cliffe via Python-ideas
#we do not do a 'return' here, so that area.ResumeTimer() will be called at the end of this function. # For keys that cause user interaction (e.g. popping up a form), #we 'return' here, so that the timer will not be restarted yet. _______

[Python-ideas] Re: Conditional with statements

2021-02-14 Thread Rob Cliffe via Python-ideas
re treated similarly*.  This is just an amorphous mass of code that I find much harder to grok. (YMMV but I find it hard to imagine.) Rules are all very well, but "A Foolish Consistency is the Hobgoblin of Little Minds" [PEP 8] Best wishes Rob PS Can anyone shed any light on why Alt-R d

[Python-ideas] Re: Conditional with statements

2021-02-15 Thread Rob Cliffe via Python-ideas
d. PS Can anyone shed any light on why Alt-R doesn't always "work" on Windows 10?  I believe there's some bit of installed software that has hijacked it, but I'm not sure what. I'm hopeless there -Chris B -- Christopher Barker, PhD (Chris) Python Language Consulting

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Rob Cliffe via Python-ideas
I'd like '->' much better than '=>'. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Me

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Rob Cliffe via Python-ideas
mind Python loosening slightly to use the keyword it probably should have in the beginning. -Mike _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/py

[Python-ideas] Re: Conditional with statements

2021-02-16 Thread Rob Cliffe via Python-ideas
ching   - Scientific Software Development   - Desktop GUI and Web Development   - wxPython, numpy, scipy, Cython ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pytho

[Python-ideas] Re: SimpleNamespace vs object

2021-02-22 Thread Rob Cliffe via Python-ideas
  None of the other names IMO convey the intended/suggested use nearly as well. Rob Cliffe ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/pyth

[Python-ideas] Re: Arrow functions polyfill

2021-02-23 Thread Rob Cliffe via Python-ideas
rt allowing 'def' as an alternative to 'lambda' (allowing 'def' to ultimately become the recommended usage). (I'm -0.5 on adding an alternative arrow syntax, but that's a purely subjective opinion.) Rob Cliffe _

[Python-ideas] Re: Arrow functions polyfill

2021-03-11 Thread Rob Cliffe via Python-ideas
On 24/02/2021 14:04, Random832 wrote: On Tue, Feb 23, 2021, at 17:01, Rob Cliffe via Python-ideas wrote: As far as I know, there is no case of valid syntax using 'lambda' where replacing 'lambda' by 'def' results in valid syntax. Can anyone provide a counter-ex

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

2021-03-12 Thread Rob Cliffe via Python-ideas
ot;) .split(":")[0] .lower() i.e., not requiring an explicit line continuation character in the case where the next line starts with a period. I've had a search through the archives and I couldn't see this discussion before. Feel free to point me to it if I&#x

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-15 Thread Rob Cliffe via Python-ideas
away with the C portions). An emphatic +1. Rob Cliffe What would be the benefits of locking down modules in this way? -- ~Ethan~ ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected]

[Python-ideas] Itertools generator injection

2021-03-19 Thread Alastair Stanley via Python-ideas
for a in f1(): for b in f2(): yield (a, b) ``` Would others find this useful? Are there any drawbacks I'm missing? Best, Alastair _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-id

[Python-ideas] Re: Improve the textual representation of IPv4-mapped IPv6 addresses

2021-03-25 Thread Ronald Oussoren via Python-ideas
ke a reasonable request (as someone that’s not the ipaddr maintainer and doesn’t really use IPv6). Could you file an issue about this? Ronald ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...

[Python-ideas] Re: On function signature mismatch, include candidate function in traceback

2021-04-20 Thread Rob Cliffe via Python-ideas
d be less helpful. Rob Cliffe There are situations (e.g. monkey patch) where this is not obvious. Would be great detail to include that in the traceback, I think. Best Pol _______ Python-ideas mailing list -- [email protected] To unsubscribe se

[Python-ideas] Re: Support more conversions in format string

2021-04-21 Thread Rob Cliffe via Python-ideas
x27;{x} is {x!lc} in lowercase' just by registering 'lc' as a conversion from my code. Chaining then per Serhiy's other suggestion would bring a fair amount of power. Cheers, Cameron Simpson _______ Python-ideas mailing list -- python-idea

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

2021-04-30 Thread Rob Cliffe via Python-ideas
wanted to use a stronger expression) is an SaaS? I'd never heard of it. OK, Google told we what it stood for, but I don't feel any the wiser. Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pyt

[Python-ideas] Re: String comprehension

2021-04-30 Thread Rob Cliffe via Python-ideas
rest is simple literals. For readability, reuse and testing I think it often helps to have a function (whose name is meaningful). We can get this via    as_list_int_literal = gensep(',', '[', ']') It would also be nice to allow as_list_int

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

2021-05-02 Thread Rob Cliffe via Python-ideas
On 02/05/2021 20:07, Abdur-Rahmaan Janhangeer wrote: Oh seems like you are a dinosaur needing some carbon dating. Thanks for the insult. Rob Cliffe ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python

[Python-ideas] Re: Namespaces!

2021-05-04 Thread Rob Cliffe via Python-ideas
ully understand the proposal and how it would be implemented, but IMO adding an overhead (not to mention more complicated semantics) to *every* chained attribute lookup is enough to kill the proposal, given that it seems to have relatively slight benefits. Best wishes Rob Cliffe __

[Python-ideas] Re: Add a mechanism so that multiple exceptions can be caught using `except E1, E2, E3:`

2021-05-10 Thread Rob Cliffe via Python-ideas
" means, either to the interpreter or to another programmer? Every objection has been based on the confusion of "except TypeError, ValueError as e:", and I agree with that. +0.9.  A practical solution, although it makes the language definition more complicated.  Practicality beatin

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-14 Thread Rob Cliffe via Python-ideas
F(1,2) ? 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://mail.python.org/archives/list/[email protected]/message/46U4V4PPFBDL

[Python-ideas] Re: New Idea: A safe keyword to execute the following statement in a failsafe mode.

2021-05-23 Thread Ricky Teachey via Python-ideas
try: >element = some_list[index]/divisor >except ZeroDivisionError: >element = 0 # It will make element zero if divisor is zero, > but it will not except IndexError in case index is out of range for > some_list > *Can be rewritten as:* >e

[Python-ideas] Re: New Idea: A safe keyword to execute the following statement in a failsafe mode.

2021-05-23 Thread Irit Katriel via Python-ideas
On Sunday, May 23, 2021, 02:23:05 PM GMT+1, Shivam Saini wrote: >> Like the first example in which I am sending an log, which isn't important.  If the log is not important, then why are you sending it? _______ Python-ideas m

[Python-ideas] Re: Introduce constants in Python (constant name binding)

2021-05-25 Thread Rob Cliffe via Python-ideas
high. But then on the other hand, who would ever want to change the value of pi? Surely you recall the Indiana Pi Bill? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected]

[Python-ideas] Re: Introduce constants in Python (constant name binding)

2021-05-26 Thread Rob Cliffe via Python-ideas
s.python.org/3/library/sys.html#sys.__stdin__ _______________ 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/

[Python-ideas] Re: Add static variable storage in functions

2021-05-27 Thread Ronald Oussoren via Python-ideas
__`` method can be used as well and can hide state (with the “consulting adults” caveat, the state is hidden, not inaccessible). Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ ___________ Python-ideas mailing list -- p

[Python-ideas] Re: Introduce constants in Python (constant name binding)

2021-05-27 Thread Rob Cliffe via Python-ideas
like A, B, ID, BA (as in "Bachelor of Arts"), UN, US, HCF, WHO, NASA, UNICEF? Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/li

[Python-ideas] Re: Add static variable storage in functions

2021-05-27 Thread Ronald Oussoren via Python-ideas
ck by caching values in the VM. 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: Add static variable storage in functions

2021-05-27 Thread Ronald Oussoren via Python-ideas
> On 27 May 2021, at 11:42, Chris Angelico wrote: > > On Thu, May 27, 2021 at 7:20 PM Ronald Oussoren via Python-ideas > wrote: >> On 27 May 2021, at 09:56, Shreyan Avigyan wrote: >> >>> Static should behave much like Python's for loop variable

[Python-ideas] Re: Add static variable storage in functions

2021-05-28 Thread Ronald Oussoren via Python-ideas
ne will consider adding it to the language. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@pyth

[Python-ideas] Re: Add static variable storage in functions

2021-05-28 Thread Ronald Oussoren via Python-ideas
> On 27 May 2021, at 18:15, Steven D'Aprano wrote: > > On Thu, May 27, 2021 at 04:53:17PM +0200, Ronald Oussoren via Python-ideas > wrote: > >> Statics are still hidden global state > > How are they *global* state when they are specific to an individual >

[Python-ideas] Re: A __decoration_call__ method for Callable objects (WAS: Decorators on variables)

2021-05-28 Thread Rob Cliffe via Python-ideas
will be better received by more if the type hint is required?). Please, please, please, don't ever make type hints *required*!  Some of us are perfectly happy not using them (and not having to learn them)! Rob Cliffe _______ Python-ideas mailing list

[Python-ideas] Re: Cleaner tracebacks from Python code

2021-05-29 Thread Irit Katriel via Python-ideas
ame, thus reproducing what we see when using the C code in this example.For library writers, this would be easily reverted when attempting to debug.For end users, this would result in much more readable tracebacks, unencumbered by extra lines of code that are outside of their control. André Rob

[Python-ideas] Re: A __decoration_call__ method for Callable objects (WAS: Decorators on variables)

2021-05-29 Thread Rob Cliffe via Python-ideas
; spam # No problem Rob Cliffe But this is introducing a new multiline syntax, and it makes no more sense to take away the second line and expect a naked decorator to be valid than it does remove the decorator and expect the naked identifier to be valid. ______

[Python-ideas] Re: Cleaner tracebacks from Python code

2021-05-29 Thread Irit Katriel via Python-ideas
ré Roberge wrote: What I am interested in is having a project-agnostic standardised Python way to specify what to show to an end-user when an exception is raised. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email

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

2021-06-10 Thread Rob Cliffe via Python-ideas
;#id13> TODO Open Issues <#id14> TODO References <#id15> [1] <#id1> FrOW, "HTML Fragments Over the Wire". Frameworks like Unpoly, Hotwire or htmx. [2] <#id3> https://docs.djangoproject.com/en/3.2/ref/utils/#django.utils.html.conditional_escape <https://d

[Python-ideas] Re: Deprecate sum of lists

2021-06-16 Thread Rob Cliffe via Python-ideas
nti-pattern and how to correct it. So I propose moving (eventually) to the same system with lists as for strings. Or else removing the performance trip-hazard from the sum function with lists. Best regards, Oliver _______ Python-ideas mailing lis

[Python-ideas] Re: Deprecate sum of lists

2021-06-18 Thread Rob Cliffe via Python-ideas
On 18/06/2021 16:42, Mathew Elman wrote: I don't see how allowing [x, y for x in a] follows from allowing [*chunk for chunk in list_of_lists]. Nor do I. Rob Cliffe ___ Python-ideas mailing list -- [email protected] To unsubscribe se

[Python-ideas] Re: Deprecate sum of lists

2021-06-19 Thread Rob Cliffe via Python-ideas
ke this in Python? In JavaScript the equivalent syntax ("...chunk", where the "..." are a literal ellipsis) is called "spread". We could borrow this term. I'm not convinced.     1, 2 + x does not mean the same as     chunk + x but it would be if there were p

[Python-ideas] Re: Extension methods in Python

2021-06-20 Thread Rob Cliffe via Python-ideas
s that I know of that have extension methods the most given argument is better code readability. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailm

[Python-ideas] Re: Extension methods in Python

2021-06-24 Thread Rob Cliffe via Python-ideas
n that prompts for continuation after each screenful of output.  Very handy!  Power is good, as long as it's used with discretion. Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le

[Python-ideas] Re: Implementing a 'but' statement in for-iterations

2021-06-28 Thread Rob Cliffe via Python-ideas
rd by reusing one that can't go there, like except? for i in range(0,10) except (2, 8): don't know if it is actually worth it, but at least it doesn't add a new keyword. _______ Python-ideas mailing list -- [email protected] To

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

2021-07-02 Thread Rob Cliffe via Python-ideas
On 02/07/2021 08:12, Thomas Güttler wrote: Hi Nick and all other Python ideas friends, yes, you are right. There is not much difference between PEP-501 or my proposal. One argument why I would like to prefer backticks: Some IDEs detect that you want to use a f-string automatically: You

[Python-ideas] Re: Python Documentation in Bengali (translation)

2021-07-13 Thread Julien Palard via Python-ideas
nslating [2]: https://github.com/python/python-docs-bn-in [3]: https://github.com/JulienPalard/python-docs-cookiecutter [4]: https://devguide.python.org/documenting/#starting-a-new-translation -- [Julien Palard](https://mdk.fr) _______ Python-ideas mailing list -- pyth

[Python-ideas] Re: startswith() and endswith() methods returning the matched value

2021-08-09 Thread Samuel Freilich via Python-ideas
ion of that). For > instance: > > domain.findsuffix((".fr", ".com", ".org")) > > ChrisA > _______ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to python-ideas-le.

[Python-ideas] Re: startswith() and endswith() methods returning the matched value

2021-08-09 Thread Samuel Freilich via Python-ideas
't understand why my comment > about "can be used eg for indexing" was being quoted for context > there. I was talking about how you could do something like this: > > protocol = ("ws:", "wss:")[url.startswith("https:")] > > If the return value changes, this breaks.

[Python-ideas] Re: C API for converting Python integers to/from bytes sequences

2021-08-11 Thread Ronald Oussoren via Python-ideas
r of aliases. The API is more cumbersome to use, and you loose type checking from the C compiler. Other than that, the variants you mention could in general just by aliases for conversion functions to/from the basic C types. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https:/

[Python-ideas] Re: Request for help

2021-08-16 Thread Alan Gauld via Python-ideas
G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______ Python-ideas mailing list -- [email protected] To unsu

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

2021-08-16 Thread Rob Cliffe via Python-ideas
g/en-US/docs/Mozilla/QA/Bug_writing_guidelines> > > > Is there a reason why we can't just link to the Wayback Machine copy like > you did here? > > > > > ___ Python-ideas mailing li

[Python-ideas] We should have an explicit concept of emptiness for collections

2021-08-22 Thread Tim Hoffmann via Python-ideas
mpty() method is implemented there, all typical use cases should be covered. I'm looking forward to your feedback! Tim ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] ht

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread Tim Hoffmann via Python-ideas
u have to change a check `if values` to `if len(values) == 0`. That works for both but is against the PEP8 recommendation. This is a shortcoming of the language. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread Tim Hoffmann via Python-ideas
y. However, Python makes a strong point on readability, which IMHO is one of the major reasons for its success. I belive that in that context adding is_empty syntactic sugar would be a clear improvement. _______ Python-ideas mailing list -- python-ideas@pyt

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread Tim Hoffmann via Python-ideas
empty()" method. However, defining a method downstream breaks duck typing and maybe even more important authors have to mentally switch between the two empty-check variants `if users` and `if users.is_empty()` depending on the context. Ethan Furman wrote: > On 8/23/21 1:15 PM, Tim

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread Tim Hoffmann via Python-ideas
Ethan Furman wrote: > On 8/23/21 2:31 PM, Tim Hoffmann via Python-ideas wrote: > > Ethan Furman wrote: > > > It seems to me that the appropriate fix is for numpy to have an > > > "is_empty()" function > > that knows how to deal with arrays and array-like

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-24 Thread Tim Hoffmann via Python-ideas
, even if it did exist. As written in another post here, `len(container) == 0` is on a lower abstraction level than `isempty(container)`. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@py

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-24 Thread Tim Hoffmann via Python-ideas
hird party libs to adopt that convention as well. That would give a uniform syntax by convention. Reflecting the discussion in this thread, I now favor variant 3). Tim _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-24 Thread Tim Hoffmann via Python-ideas
Ethan Furman wrote: > On 8/24/21 3:03 PM, Tim Hoffmann via Python-ideas wrote: > > **How do you check if a container is empty?** > > IMHO the answer should not depend on the container. > I think this is the fly in the ointment -- just about everything, from len() > to bo

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-25 Thread Tim Hoffmann via Python-ideas
ere are any. If we come to the conclusion that an explicit empty check is better than a length=0 check, there are again different ways how that could be implmented again. My favorite solution now would be adding `is_empty()` methods to all standard containers and encourage numpy and pandas to add

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-25 Thread Tim Hoffmann via Python-ideas
arrays and dataframes. _______ 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-id

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-25 Thread Tim Hoffmann via Python-ideas
ant enough here to take further action. Anyway, thanks all for the discussion! Tim _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/li

[Python-ideas] synatx sugar for quickly run shell command and return stdout of shell command as string result

2021-08-26 Thread Evan Greenup via Python-ideas
culties to implement. _______ 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/[email protected]/message/5KKHG6TLBLI4

[Python-ideas] Re: synatx sugar for quickly run shell command and return stdout of shell command as string result

2021-08-26 Thread Tim Hoffmann via Python-ideas
And also IPython: https://ipython.readthedocs.io/en/stable/interactive/shell.html e.g. ls_lines = !ls -l ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org

[Python-ideas] Complete recursive pickle dump

2021-08-27 Thread Evan Greenup via Python-ideas
lly a cool feature, because pickle is to keep python object, completeness is a great advantage of pickle than json and other data persist library. Sent with ProtonMail Secure Email. _______ Python-ideas mailing list -- [email protected] To unsubscri

[Python-ideas] Re: synatx sugar for quickly run shell command and return stdout of shell command as string result

2021-08-29 Thread Rob Cliffe via Python-ideas
On 26/08/2021 15:44, Christopher Barker wrote: Python itself is purposely not designed to provide quick and easy shell access. Is that really true?  What evidence do you have for that statement? Best wishes Rob Cliffe ___ Python-ideas mailing

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

2021-08-30 Thread Ronald Oussoren via Python-ideas
m. Why do you prefer strings for the options rather than an Enum? The enum clearly documents what the valid options are for the option. Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ _______ Python-ideas mailing lis

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

2021-08-31 Thread Ronald Oussoren via Python-ideas
question was out of interest in this particular remark. Ronald > > -CHB > > > -- > Christopher Barker, PhD (Chris) > > Python Language Consulting > - Teaching > - Scientific Software Development > - Desktop GUI and Web Development > - wxPython, numpy, s

[Python-ideas] open functions in dbm submodule need to support path-like object

2021-09-07 Thread Evan Greenup via Python-ideas
Currently, in Python 3.9, `dbm.open()`, `dbm.gnu.open()` and `dbm.ndbm.open()` doesn't support path-like object, class defined in `pathlib`. It would be nice to add support with it. Sent with ProtonMail Secure Email. ___ Python-ideas mailing

[Python-ideas] Re: Different exceptions for assert

2021-09-10 Thread Rob Cliffe via Python-ideas
assertions. 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://mail.python.org

[Python-ideas] Re: itertools.compress default selectors

2021-09-13 Thread Rob Cliffe via Python-ideas
", "-filove-python", "CFLAGS=-O3"]) " ".join(opts) '-filove-python CFLAGS=-O3' What do you think guys about this? Perhaps it was proposed by someone else? Thanks! Stepan Dyatkovskiy ___ Python-ideas

[Python-ideas] Invalidate list iterators after size changes?

2021-10-09 Thread Tyler Hou via Python-ideas
te an implementation yourself. What should be done about deque for block sizes > 1? If this change gets made, should we add way to create a deque with block size == 1 whose iterators are never invalidated? _______ Python-ideas mailing list -- pyt

[Python-ideas] socketserver StreamRequestHandler non-blocking read__

2021-10-10 Thread Evan Greenup via Python-ideas
input, then it will return None type. This would be a nice feature. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Me

[Python-ideas] Re: Adding a Version type

2021-10-11 Thread Rob Cliffe via Python-ideas
    # can't use this feature etc. 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 ar

[Python-ideas] Except * formatting

2021-10-17 Thread Rob Cliffe via Python-ideas
exception coming. 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: Syntax for late-bound arguments

2021-10-24 Thread Rob Cliffe via Python-ideas
es 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://mail.python.org/archives/list/python-ideas@pytho

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Rob Cliffe via Python-ideas
to a subsequent early-binding default, e.g.         def f(a := b+1, b = b_default):     I don't feel strongly about this.  But L-to-R is nice and simple, and I would reverse the parameter order here to make it work (and be more comprehensible). Best wishes Rob Cliffe _

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Rob Cliffe via Python-ideas
On 26/10/2021 02:12, Chris Angelico wrote: On Tue, Oct 26, 2021 at 11:44 AM Rob Cliffe via Python-ideas wrote: I prefer 1). Easier to understand and debug in examples with side-effects such as def f(a := enter_codes(), b = assign_targets(), c := unlock_missiles(), d = FIRE()): (not

<    1   2   3   4   5   6   7   8   9   10   >