[Python-ideas] Adding support for adequately tagging AIX (pep425) to support distributed wheels

2019-08-19 Thread Michael
et_platform() tag (b32, ppc, aix32), (b64, ppc64, aix64) for 32 and 64 bit operations, respectively - as that is a "running" environment attribute. Open to other ideas on what the bitness tag should be. IMHO - anything is better than nothing. Maybe this could be considered a bu

[Python-ideas] Anonymous namedtuples, revisited

2022-03-24 Thread michael
Back in early 2016 there was an idea submitted[1] by Joseph Martinot-Lagarde in regard to anonymous namedtuples. The crux of the submission was the idea of instantiating a namedtuple using only Python's generic tuple syntax plus keyword arguments. At the time, the major rebuttal against this ide

[Python-ideas] Re: fsync-on-close io object

2020-12-26 Thread Michael Smith
Sorry for the duplicate, Barry. I got bit by the "I don't reply-all by default" spider. On Sat, Dec 26, 2020 at 12:30 PM Barry Scott wrote: > > > > On 24 Dec 2020, at 17:15, Michael A. Smith wrote: > > > > With all the buffering that modern disks and file

[Python-ideas] Re: fsync-on-close io object

2020-12-26 Thread Michael Smith
Also sorry for the duplicate, Steven. On Thu, Dec 24, 2020 at 5:31 PM Steven D'Aprano wrote: > On Thu, Dec 24, 2020 at 12:15:08PM -0500, Michael A. Smith wrote: > > > With all the buffering that modern disks and filesystems do, a > > specific question has come up a fe

[Python-ideas] Re: fsync-on-close io object

2020-12-26 Thread Michael Smith
On Thu, Dec 24, 2020 at 6:18 PM Cameron Simpson wrote: > > On 25Dec2020 09:29, Steven D'Aprano wrote: > >On Thu, Dec 24, 2020 at 12:15:08PM -0500, Michael A. Smith wrote: > > > >> With all the buffering that modern disks and filesystems do, a > >> speci

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

2021-05-14 Thread Michael Smith
Jonathan Fine said > But here there is a cost. Arbitrary precision arithmetic (and roots) uses more memory and takes longer. I think a wider (perhaps naive) interpretation of the idea could be, "can we defer certain lossy calculations until they have to be done?" Fraction may do eager arbitrary p

[Python-ideas] Re: Create a @deprecated decorator (annotation)

2021-07-29 Thread Michael Smith
Perhaps another approach would be to make a more general purpose warning decorator, that would give a warning when invoking a function or instantiating a class. It could be used for deprecation notices, of course, but has the potential for tooling to give other types of warnings, such as using a th

[Python-ideas] Re: PEP8 mandatory-is rule

2021-08-31 Thread Michael Lee
at minimizes the use of union types (and subtyping, etc) is usually easier to maintain. -- Michael On Tue, Aug 31, 2021 at 1:08 PM Nick Parlante wrote: > Thanks to everyone for many thoughtful comments. I'm going to try to wrap > this up. > > So I talked above about how th

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Michael Foord
y: bool = True > """Just a comment.""" > > Making such strings syntactically meaningful would be a breaking change, > although one with a very small impact. (Some strings which were > previously ignored by the interpreter will now be kept in memor

Re: [Python-ideas] Change repr of collections.OrderedDict to be more dict-like

2018-07-26 Thread Michael Selik
Sounds good to me. It'll make OrderedDict look much nicer at the REPL. On Thu, Jul 26, 2018 at 10:21 AM Terry Reedy wrote: > I am not sure what our repr change policy is, as there is a > back-compatibility issue but I remember there being changes. Given the way different Python prompts feel f

Re: [Python-ideas] Python docs page: In what ways is None special

2018-07-26 Thread Michael Selik
On Mon, Jul 23, 2018 at 2:03 AM Jonathan Fine wrote: > Thank you for your attention. What have I missed? > None and a few other things are special-cased by CPython. The compiler won't bother to write bytecode instructions when an if-statement obviously evaluates false. That might surprise some f

Re: [Python-ideas] Toxic forum

2018-08-13 Thread Michael Selik
On Mon, Aug 13, 2018, 5:59 AM Nicholas Chammas wrote: > Maybe we need to revive that discussion? Overall, I don’t think we have a > people problem on this list as much as we have an administration tooling > problem. > +1 Even the fact that "straw poll" votes aren't counted automatically shows t

Re: [Python-ideas] Toxic forum

2018-08-13 Thread Michael Selik
Something that limits posts to once per day per thread could be useful, maybe even once per week. On Mon, Aug 13, 2018, 10:06 AM Michael Selik wrote: > > > On Mon, Aug 13, 2018, 5:59 AM Nicholas Chammas > wrote: > >> Maybe we need to revive that discussion? Overall, I

Re: [Python-ideas] Toxic forum

2018-08-13 Thread Michael Selik
On Mon, Aug 13, 2018, 10:09 AM Chris Angelico wrote: > On Tue, Aug 14, 2018 at 3:06 AM, Michael Selik wrote: > > > > > > On Mon, Aug 13, 2018, 5:59 AM Nicholas Chammas < > [email protected]> > > wrote: > >> > >> Maybe we need to

Re: [Python-ideas] Syntactic sugar to declare partial functions

2018-08-13 Thread Michael Selik
On Mon, Aug 13, 2018, 5:48 PM Greg Ewing wrote: > Chris Angelico wrote: > > No, lambda calculus isn't on par with brakes - but anonymous functions > > are, and if they're called "lambda", you just learn that. > > It's like saying that people would find it easier to learn to > drive if "brakes" we

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-14 Thread Michael Selik
The conversation about syntactic sugar for ``functools.partial`` led to a question about whether jargon like "lambda" makes the concept of an anonymous function more difficult to learn. In my own experience teaching, I find that many concepts are easier to introduce if I avoid the Python jargon un

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Michael Selik
On Wed, Aug 15, 2018, 12:06 AM Stefan Behnel wrote: > Michael Selik schrieb am 14.08.2018 um 21:42: > > This is supported by education research. Some light Googling found a > > study on the topic [0] that is consistent with my own observations. > > OTx2, and no offence, bu

Re: [Python-ideas] Off topic: 'strike a balance' - second language English

2018-08-18 Thread Michael Selik
On Sat, Aug 18, 2018 at 2:48 AM Steve Barnes wrote: > "The removal of technical terminology needs to be moderated to account > for the risk of loss of the essential meaning or the meaning being lost > due to excessive length. Where such terminology is widely accepted > within a given specialisati

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

2018-08-30 Thread Michael Selik
On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote: > It would be nice if there was a DSL for describing neural networks (Keras). > > model.add(Dense(units=64, activation='relu', input_dim=100)) > model.add(Dense(units=10, activation='softmax')) > > Why not JSON or XML for cross-language compatibilit

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

2018-08-30 Thread Michael Selik
On Thu, Aug 30, 2018, 9:23 PM David Mertz wrote: > On Fri, Aug 31, 2018, 12:08 AM 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 nested key-value pairs. (Though who >> knows maybe that's all Keras n

Re: [Python-ideas] Keyword only argument on function call

2018-09-07 Thread Michael Selik
On Fri, Sep 7, 2018, 12:00 AM Jacco van Dorp wrote: > Sometimes we make a function only to be called once at a specific > location, more because of factoring out some functions for clarity. > I've found myself making the opposite refactoring recently, improving clarity by eliminating unnecessary

Re: [Python-ideas] Keyword only argument on function call

2018-09-08 Thread Michael Selik
On Sat, Sep 8, 2018, 6:34 AM Anders Hovmöller wrote: > > A finer grained analysis tool would be helpful. I'm -0 on the idea > because I believe it would discourage more expressive names in calling > contexts in order to enable the proposed syntax. But I also see a big > difference between cases w

Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Michael Selik
Elias, I'm a little confused about what you're suggesting. You want to have a Mapping that does not supply a keys method? What use case motivated your proposal? On Mon, Sep 10, 2018, 7:04 PM Elias Tarhini wrote: > This has been bouncing around in my head for a while regarding the > requisite ke

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-12 Thread Michael Selik
On Sat, Sep 8, 2018 at 4:17 AM Jonathan Fine wrote: > I thank Steve D'Aprano for pointing me to this real-life (although > perhaps extreme) code example > > > https://github.com/Tinche/aiofiles/blob/master/aiofiles/threadpool/__init__.py#L17-L37 It's hard to know from just a brief glance how th

Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Michael Selik
The dict keys method has other benefits beyond iteration. For example, it provides a set-like interface. On Wed, Sep 12, 2018, 10:50 PM Elias Tarhini wrote: > On Wed, Sep 12, 2018 at 4:42 PM Michael Selik wrote: > >> You want to have a Mapping that does not supply a keys meth

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-13 Thread Michael Selik
On Thu, Sep 13, 2018, 12:39 AM Anders Hovmöller wrote: > It seems to me this discussion has drifted away from the original > discussion toward one where you have a chain of functions with the same or > almost the same signature. This is interesting for sure but we shouldn’t > forget about the ori

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-13 Thread Michael Selik
On Thu, Sep 13, 2018 at 11:35 AM Anders Hovmöller wrote: > Using keyword arguments is not painful. It's ugly in some unusual cases, > such as creating helper functions with nearly the same signature. > > It’s more painful than positional. To me the fact that everyone who works > on code bases tha

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-13 Thread Michael Selik
On Thu, Sep 13, 2018 at 5:34 PM Anders Hovmöller wrote: > I wrote a script so you can get a list of [good use cases] in big code > bases without looking through the code randomly. > https://gist.github.com/boxed/e60e3e19967385dc2c7f0de483723502 > In that case, you should be able to link to a com

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-13 Thread Michael Selik
On Thu, Sep 13, 2018 at 5:22 PM Anders Hovmöller wrote: > For example: > django-master/django/http/multipartparser.py 225 > Sorry, I didn't recognize this as a link on first read. I'll provide a link here to the code in context. https://github.com/django/django/blob/e7a0a5c8b21f5ad1a0066bd0dfab

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-13 Thread Michael Selik
On Thu, Sep 13, 2018 at 6:50 PM Anders Hovmöller wrote: > On 14 Sep 2018, at 03:35, Michael Selik wrote: > In that case, you should be able to link to a compelling example. If you > go to the trouble of finding one, I'll take time to try to refactor it. > > > https://g

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-14 Thread Michael Selik
On Thu, Sep 13, 2018, 11:48 PM Anders Hovmöller wrote: > > It's a bit too large for me to make sense of it quickly. My apologies for > not offering a holistic refactor. > > > My tool will print plenty of other examples. You can pick anyone really... > > > That’s positional because keyword is more

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-14 Thread Michael Selik
On Thu, Sep 13, 2018, 11:58 PM Anders Hovmöller wrote: > In that case, you should be able to link to a compelling example. If you >> go to the trouble of finding one, I'll take time to try to refactor it. >> >> >> https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L707

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-14 Thread Michael Selik
On Fri, Sep 14, 2018, 12:17 AM Anders Hovmöller wrote: > > That's a bit of a dodge. There is a huge difference in verbosity between > > handler.new_file(field_name, file_name, content_type, content_length, > charset, content_type_extra) > > and > > handler.new_file(field_name=field_name, file_nam

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-14 Thread Michael Selik
On Fri, Sep 14, 2018 at 12:30 AM Anders Hovmöller wrote: > Since neither version fits well on one line or even three, I'd have > written each of those on a separate line, indented nicely to emphasize the > repetition. Seems fine to me. > > Sure. As would I. Doesn't change anything[.] > Our aesth

Re: [Python-ideas] Pre-conditions and post-conditions

2018-09-15 Thread Michael Lee
lenging and would probably have too-steep of a learning curve to be usable by most people anyways.) -- Michael On Fri, Sep 14, 2018 at 11:51 PM, Marko Ristin-Kaufmann < [email protected]> wrote: > Hi, > Let me make a couple of practical examples from the work-in-progress ( >

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

2018-09-18 Thread Michael Selik
On Tue, Sep 18, 2018 at 5:57 PM Chris Angelico wrote: > For any proposal that actually has currency, this system does work The trouble is the ambiguity of knowing what "actually has currency" is and how to get it. PEP 1 states, "Following a discussion on python-ideas, the proposal should be submi

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

2018-09-20 Thread Michael Selik
On Thu, Sep 20, 2018 at 2:13 AM Stephen J. Turnbull wrote: > Michael Selik writes: > > > However, PEP 1 does not give instruction on how to evaluate whether > > that discussion has been completed satisfactorily. > > That's because completion of discussion has n

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

2018-09-20 Thread Michael Selik
On Thu, Sep 20, 2018 at 9:27 AM Anders Hovmöller wrote: > >> That's because completion of discussion has never been a requirement > >> for writing a PEP. > > > > Not for drafting, but for submitting. > > Can you quote pep1? I think you’re wrong. I can't remember if I pulled this quote previously

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

2018-09-20 Thread Michael Selik
On Thu, Sep 20, 2018 at 10:25 AM Anders Hovmöller wrote: > >>> Not for drafting, but for submitting. > >> > >> Can you quote pep1? I think you’re wrong. > > > > I can't remember if I pulled this quote previously (that's one of the > > troubles with emails): "Following a discussion on python-ideas,

Re: [Python-ideas] Asynchronous exception handling around with/try statement borders

2018-09-20 Thread Michael Selik
On Thu, Sep 20, 2018, 3:52 PM Kyle Lahnakoski wrote: > KeyboardInterrupt (any interrupt really) is dangerous. Now, we can > probably code a solution, but how about we remove the danger > The other day I accidentally fork-bombed myself with Python os.fork in an infinite loop. Whoops. It seems to

Re: [Python-ideas] PEPs: Theory of operation

2018-09-22 Thread Michael Selik
On Sat, Sep 22, 2018 at 2:00 PM Stephen J. Turnbull wrote: > If one doesn't know who the senior developers are yet, she should > think twice about whether she's ready to PEP anything. On Sat, Sep 22, 2018 at 4:03 PM Anders Hovmöller wrote: > Is there a committee? Then why not just name it? > How

Re: [Python-ideas] Proposal for an inplace else (?=) operator

2018-09-22 Thread Michael Selik
On Sat, Sep 22, 2018 at 4:53 AM Lee Braiden wrote: > Problem: [Python] prevents actual default argument values being set in a > function signature > Feedback would be much appreciated. You'd be more convincing if you stated the problem more precisely. Python supports default values for function

Re: [Python-ideas] "while:" for the loop

2018-09-25 Thread Michael Selik
On Tue, Sep 25, 2018 at 8:46 PM Mikhail V wrote: > I suggest allowing "while:" syntax for the infinite loop. > I.e. instead of "while 1:" and "while True:" notations. > > My opinion: > 1. I think it'd definitely improve clarity. I prefer the explicit phrase, ``while True:``. Saying "while" with

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Michael Selik
On Wed, Sep 26, 2018, 9:42 AM Tobias Kohn wrote: > Although I doubt it will really make it into Python's grammar, I am all +1 > for the idea of having "repeat" as a loop keyword in Python. Actually, I > have been using "repeat" as a keyword in Python for quite some time now, > and found it not o

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Michael Selik
On Fri, Sep 28, 2018 at 11:32 PM Steve Barnes wrote: > One of the strengths of the IEEE float, (to set against its many > weaknesses), is the presence of the magic value NaN. Not a Number, or > NaA, is especially useful in that it is a valid value in any > mathematical operation, (always returning

Re: [Python-ideas] Debugging: some problems and possible solutions

2018-10-03 Thread Michael Selik
On Wed, Oct 3, 2018 at 8:42 AM Anders Hovmöller wrote: > foo(=a, =1+bar) Unfortunately, that won't help with Jonathan's inital example expression "big_array[5:20]" as it's not a valid keyword. ___ Python-ideas mailing list [email protected] https:

Re: [Python-ideas] Debugging: some problems and possible solutions

2018-10-03 Thread Michael Selik
On Wed, Oct 3, 2018 at 9:29 AM Anders Hovmöller wrote: >>> foo(=a, =1+bar) > >> Unfortunately, that won't help with Jonathan's inital example >> expression "big_array[5:20]" as it's not a valid keyword. > > I didn't understand that. The example you are referring to is > print('big_array[5:20] =',

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Michael Selik
How does a frozendict help in that example? It's not obvious to me. Despite not understanding that example, I'm +1 for having a frozendict. I don't think it'll increase cognitive load much, as it'll sit right next to frozenset when someone reads the builtins in alphabetical order. In my own experi

Re: [Python-ideas] [Python-Dev] bpo-34837: Multiprocessing.Pool API Extension - Pass Data to Workers w/o Globals

2018-10-22 Thread Michael Selik
I switched this thread to the python-ideas list, since this is proposing a new feature. On Mon, Oct 22, 2018 at 12:13 PM Sean Harrington wrote: > I contend that multiprocessing.Pool is used most frequently with a single > task. I am proposing a feature that enforces this invariant, optimizes ta

Re: [Python-ideas] Add "default" kwarg to list.pop()

2018-10-31 Thread Michael Selik
On Wed, Oct 31, 2018 at 10:17 AM Eric Fahlgren wrote: > On Wed, Oct 31, 2018 at 2:42 AM Chris Angelico wrote: > >> https://www.python.org/dev/peps/pep-0463/ wants to say hi. >> > > That was exactly my reaction, too, and usually is whenever one of these > "add a default" or similar ideas pops up.

Re: [Python-ideas] Add "default" kwarg to list.pop()

2018-10-31 Thread Michael Selik
On Wed, Oct 31, 2018 at 12:31 PM Chris Angelico wrote: > What is being asked for here (if I'm not misreading) is a relatively simple > enhancement to a method on a built-in type (or a small handful of > types). If that garners reasonable support, the next step wouldn't be > a PEP, it'd just go st

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-02 Thread Michael Selik
On Fri, Nov 2, 2018 at 10:31 AM Philip Martin wrote: > [Why don't] csv writer and DictWriter provide ... > serialization/deserialization hooks? > Do you have a specific use-case in mind? My intuition is that comprehensions provide sufficient functionality such that changing the csv module inter

Re: [Python-ideas] dict.setdefault_call(), or API variations thereupon

2018-11-02 Thread Michael Selik
On Fri, Nov 2, 2018 at 5:25 PM Anders Hovmöller wrote: > Could you explain what the difference is between defaultdicts "factory > which is unconditionally called when the key is missing" and "the default > is evaluated only on need"? > The distinction was the motivation for this thread: setdefau

Re: [Python-ideas] Proposing additions to the standard library

2018-11-12 Thread Michael Selik
On Sat, Nov 10, 2018 at 6:56 PM Jonathan Crall wrote: > Sometimes there's a good, useful function than doesn't get added because >> there's no reasonable place to put it. For example, a "flatten" function >> has been talked about since Python 1.x days, and we still don't have a >> standard soluti

Re: [Python-ideas] __len__() for map()

2018-11-26 Thread Michael Selik
If you know the input is sizeable, why not check its length instead of the map's? On Mon, Nov 26, 2018, 1:35 PM Kale Kundert I just ran into the following behavior, and found it surprising: > > >>> len(map(float, [1,2,3])) > TypeError: object of type 'map' has no len() > > I understand that map()

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-04 Thread Michael Foord
solutely everyone knows what it means. Michael > It destroys the visual flow of code and for what? To signify a global, > constant, or Enum? Is that really so important? I don't think so. I think > the all caps style has out-lived its usefulness and needs to go the way of > the dod

Re: [Python-ideas] Potential PEP: with/except

2019-01-22 Thread Michael Selik
On Tue, Jan 22, 2019, 12:11 PM Paul Ferrell I see this as the natural evolution of what 'with' is all about - > replacing necessary try-finally blocks with something more elegant. We just > didn't include the 'except' portion. > The time machine strikes again. In fact, you can handle exceptions w

Re: [Python-ideas] kwargs for return

2019-01-26 Thread Michael Selik
On Sat, Jan 26, 2019, 6:30 AM Anders Hovmöller > > I don't see anything here that can't be done by returning a dict, a > > namedtuple (possibly with optional fields), or some other object with > > named fields. They can be optional, they can have defaults, and you can > > extend the object by addi

Re: [Python-ideas] Single line single expression try/except syntax

2019-01-27 Thread Michael Selik
Any discussion of except expressions should reference PEP 463 and respond to the arguments there. https://www.python.org/dev/peps/pep-0463/ On Sun, Jan 27, 2019, 3:52 AM Alex Shafer via Python-ideas < [email protected] wrote: > Hello, > > I'd like to discuss an idea I had to shorten the sy

Re: [Python-ideas] Stack traces ought to flag when a module has been changed on disk

2019-01-30 Thread Michael Foord
and save wibble.py > >reload(wibble) > >fn() > > > > I think using reload should raise warnings, since it doesn't work, and the > reload case shouldn't be the killer of this really good idea. > > Reload isn't the issue here. Even without th

Re: [Python-ideas] Dict joining using + and +=

2019-02-27 Thread Michael Selik
On Wed, Feb 27, 2019 at 10:22 AM Anders Hovmöller wrote: > I dislike the asymmetry with sets: > > > {1} | {2} > {1, 2} > > To me it makes sense that if + works for dict then it should for set too. > > / Anders > > > On 27 Feb 2019, at 17:25, João Matos wrote: > > > > Hello, > > > > I would like

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-06 Thread Michael Lee
en it is to preserve some of the invariants I've seen proposed above, like "len(d1 + d2) == len(d1) + len(d2)". Personally, I don't really have a strong opinion on this PEP, or the other one I've seen proposed where we add a "d1.merge(d2, d3, ...)". But I do know that

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-06 Thread Michael Lee
actually really exist while being more broadly useful. Or I guess we could just remove that restriction: "it feels too magical" isn't a great objection on my part. Either way, that part of the PEP could use some more refinement, I think. -- Michael On Wed, Mar 6, 2019 at

Re: [Python-ideas] singledispatch for methods

2019-03-26 Thread Michael Selik
On Tue, Mar 26, 2019, 1:09 PM Tim Mitchell wrote: > Is it time to add singledispatch for methods to the core library? > What's the motivation for it, beyond the fact that it's possible? Regarding jargon, aren't Python's instance methods are already single-dispatch, because they receive the inst

Re: [Python-ideas] Running average and stdev in the statistics module?

2019-05-06 Thread Michael Selik
I've often wanted a windowing function in itertools. One exists as a recipe in the docs. If I remember correctly, one reason this was never implemented is that the most efficient implementation changes depending on the size of the window. Use a deque(maxsize=n) for large windows and tuple slicing/

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Michael Foord
add canceling threads to python threading library? I am > willing to help creating a patch (at least for linux). Back in the day we used the .NET API for king threads from IronPython. It made threads so much saner to work with. It's been an egregious lack in the Python thread API for yea

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Michael Foord
t; A straightforward API that works without fuss or excuses. It works by raising an exception in the target thread, which the thread is free to handle (usually for cleanup and then reraise). Michael > On Thu, 20 Jun 2019, 23:59 Michael Foord, wrote: > >> >> >> On Thu, 2

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Michael Foord
On Thu, 20 Jun 2019 at 16:11, Matúš Valo wrote: > I have found out at least this link: > > http://www.voidspace.org.uk/ironpython/threading.shtml > > There is also example of aborting thread. Thanks, good reference 😀 It also mentions the same API in Java. Mich

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Michael Foord
On Thu, 20 Jun 2019 at 16:33, Guido van Rossum wrote: > On Thu, Jun 20, 2019 at 8:21 AM Michael Foord wrote: > > It works by raising an exception in the target thread, which the thread > is free to handle (usually for cleanup and then reraise). > > Sure, those are the right s

[Python-ideas] Re: Canceling thread in python

2019-06-27 Thread Michael Foord
a very useful > function. > This is not what is being suggested. Read about the semantics of thread killing in C# and Java. > In practice (and I actually had to deal with exactly this problem in my > own code just last week!) there are two approaches that tend to work: > Yet again

[Python-ideas] Re: Namespace context managers

2019-07-26 Thread Michael Selik
The class statement works in this fashion. foo = 1 class Bar: foo = 2 assert foo = 1 assert Bar.foo = 2 On Fri, Jul 26, 2019, 12:19 AM Batuhan Taskaya wrote: > I am proposing namespace context managers with implementing `__enter__` > and `__exit__` on dict objects. It would make closures p

[Python-ideas] Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
Hello, I have a proposal to improve support of __main__.py (python -m foobar) invocation to argparse.ArgumentParser You can find attached a PEP draft. Unfortunately, I'm not very confident on how to add that PEP and ... honnestly not very used to github. In short, can you help me and advise on

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
names for all of > those—especially automatically—would be silly), but that’s not the case for > most scripts. > > Sent from my iPhone > >> On Aug 23, 2019, at 08:16, Michael Hooreman wrote: >> >> Hello, >> >> I have a proposal to improve support of

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
Hi Richard, The issue is with package foobar containing __main__.py file (not with a module called as a script, which is your case), and called via python -m foobar See the last paragraph of https://docs.python.org/3/library/__main__.html : « For a package, the same effect can be achieved by inc

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
19 09:53, Richard Musil a écrit : > On Sat, Aug 24, 2019 at 9:25 AM Michael Hooreman > wrote: > >> Running __main.py__ as a script works *only* if we use absolute imports. >> And I consider that using absolute imports in a package to itself is a very >> bad pra

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
using absolute imports in a package to itself is a very bad practice. So, __main.py__ is not an executable. Best regards. Le sam. 24 août 2019 03:24, Richard Musil a écrit : > On Fri, Aug 23, 2019 at 11:54 PM Michael Hooreman > wrote: > >> The issue is with package foobar contain

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
that they are other uses cases of python than some packages to deploy with setuptools. Best regards. Le 24/08/19 à 17:01, Andrew Barnert a écrit : > On Aug 24, 2019, at 00:25, Michael Hooreman wrote: >> In fact, I should add more than the python executable in prog: it must >> contai

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
ich has a very depth (sub-)packages structure, and on one hand having dozens of scripts in a ./bin directory lacks of efficiency, on the other hand I don't want to use absolute imports within a library just to be able to have standalone scripts, knowing that it is also the job of __main__.py. Bes

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
e what you need, I'll explain how to not need that". We are all IT guys, and I also do that. Now, I see what it is from the other side of the court :-) [End of private joke] Best regards Le sam. 24 août 2019 21:40, Andrew Barnert a écrit : > On Aug 24, 2019, at 08:48, Michael Hoo

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
Tanks a lot Wes, I know what I will do on Monday :-) Le sam. 24 août 2019 23:22, Wes Turner a écrit : > ```python > !cat ../../bin/example > ``` > > #!/home/user/-wrk/-ve37/s_example/bin/python3 > # EASY-INSTALL-ENTRY-SCRIPT: 'example','console_scripts','example' > __requires__ = 'e

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Michael Hooreman
e. Le sam. 24 août 2019 23:20, Andrew Barnert a écrit : > On Aug 24, 2019, at 13:16, Michael Hooreman wrote: > > > > I'll consider what you say, and try to understand what entrypoint is. I > have understood entrypoint as a wording for an entry point (main) script. > Sorry.

[Python-ideas] Re: Adding support for adequately tagging AIX (pep425) to support distributed wheels

2019-09-01 Thread Michael Felt
use Python apps in a heterogeneous environment. Thank you for your comments! Michael ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pyt

[Python-ideas] Re: Adding support for adequately tagging AIX (pep425) to support distributed wheels

2019-09-01 Thread Michael Felt
Among other places, Python ideas was recommended as a place to goto. In the meantime I have been discussing this on pypa/pip (mainly), and also on wheel and packaging. Even submitted PRs. But the PRs are only needed if the tag is inadequate. So, part of my reason for being here is to figure o

[Python-ideas] Re: Add a `dig` method to dictionaries supporting the retrieval of nested keys

2019-09-03 Thread Michael Foord
ConfgObj used to have a similar method I believe. From fetching a value from a nested section by supplying the full path (as an iterable I believe). Michael On Tue, 3 Sep 2019 at 15:36, James Livermont via Python-ideas < [email protected]> wrote: > It seems most of the folk

[Python-ideas] Re: Adding support for adequately tagging AIX (pep425) to support distributed wheels

2019-10-08 Thread Michael Felt
ck. It will have to be one of something documented/known by/to the OS. Again - thanks for your feedback and thoughts! > Greg > > > > On Sun, Sep 1, 2019 at 1:53 PM Michael Felt wrote: > >> Among other places, Python ideas was recommended as a place to goto. >> >>

[Python-ideas] Re: Adding support for adequately tagging AIX (pep425) to support distributed wheels

2019-10-09 Thread Michael Felt
On 09/10/2019 06:49, Pradyun Gedam wrote: > On Mon, 2 Sep 2019 at 2:24 AM, Michael Felt wrote: > >> Among other places, Python ideas was recommended as a place to goto. >> >> In the meantime I have been discussing this on pypa/pip (mainly), and also >> on wheel and

[Python-ideas] Re: Renaming json.load()

2019-11-27 Thread Michael Selik
Those functions, ``load`` and ``loads``, for better or worse, are a standard across many modules. Now that the standard has been established, it's good to stick with it. Good interface design needs to consider familiarity as well as what might be best without any history. On Wed, Nov 27, 2019 at 1

[Python-ideas] Re: Python slicing

2019-12-12 Thread Michael Selik
On Thu, Dec 12, 2019 at 5:29 AM Siddharth Prajosh wrote: > Can we have an extra function for lists and string (and wherever slicing > works) to explicitly mention that we're slicing?? Something like - > *s=list(range(100)); > s.slice(10, 20).* > This exists already as ``itertools.islice`` and,

[Python-ideas] Re: Fixed point format for numbers with locale based separators

2019-12-20 Thread Michael Amrhein
use '#' instead of '*' as modifier, which - for my taste - is a better fit for LC_NUMERIC . Syntax would be [[fill]align][sign][#][0][width][grouping_option][.precision][type][#|$] or [[fill]align][sign][#][0][width][grouping_option][.precision][#|$][type] Michael ___

[Python-ideas] Re: Fixed point format for numbers with locale based separators

2019-12-20 Thread Michael Amrhein
Yes, you are right. Would it be a way out, to bind the "locale character" to the type? [[fill]align][sign][#][0][width][grouping_option][.precision][type[#|$]] ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pytho

[Python-ideas] Re: str(obj) not calling obj.__str__?

2020-02-23 Thread Michael Foord
In unittest.mock.MagicMock I solve this problem by having __new__ create a new subclass for every instantiation. Setting any magic method on the instance is promoted to the type via __setattr__. That way every instance can have unique magic methods without affecting other instances. Michael On

[Python-ideas] Re: str(obj) not calling obj.__str__?

2020-02-25 Thread Michael Foord
On Sun, 23 Feb 2020 at 11:25, Michael Foord wrote: > In unittest.mock.MagicMock I solve this problem by having __new__ create a > new subclass for every instantiation. Setting any magic method on the > instance is promoted to the type via __setattr__. That way every instance > can

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

2020-04-01 Thread Michael Christensen
We've got to be considerate of other languages: What if, for example, a German speaker is looking for example code in English documentation and sees the word "speck"? He/she will think it means bacon and will be offended! Sent via the Samsung Galaxy S® 6, an AT&T 4G LTE smartphone Get Outlook fo

[Python-ideas] Re: Function composition

2020-05-24 Thread Michael Mitchell
JavaScript has an early proposal for this use-case: https://github.com/tc39/proposal-partial-application#pipeline-and-partial-application where "cat data | sort | cut -d; -f6 | grep ^foo | sort -r | uniq -c" could be represented as: data |> sort |> cut(?, delimeter=";", fields=6) |>

[Python-ideas] Re: Proposal to introduce pattern matching syntax

2020-06-22 Thread Michael Christensen
Concerning parameters in the as section: I think using `with` would make it easier to understand. try match result: as Dog: print("Dog") as Cat with lives: print(f"Cat with {lives} lives") as tuple with (arg1, arg2): print(f"Tuple with args {arg1}, {arg2}")

[Python-ideas] Re: Restricting Python

2020-07-19 Thread Michael Smith
.html Since your post doesn't seem to mention it I thought I'd bring it to your attention. – Michael On Sun, Jul 19, 2020 at 12:18 Robert wrote: > > Hi, I’ve been lurking for a while. This is my first real post in a long > time. > > > This is a proposal for a syste

[Python-ideas] Re: use type hints and slices to specify a valid numerical range, example: `Angle = int[0:361]`

2020-08-08 Thread Michael Smith
On Sat, Aug 8, 2020 at 16:41 Dominik Vilsmeier wrote: > On 08.08.20 05:48, David Mertz wrote: > > On Fri, Aug 7, 2020, 6:03 PM Paul Moore wrote: > >> > x: int[0:] # any ints greater than or equal to zero would match, >> others would fail >> > x: int[:101] # any ints less than 101 match >> > x:

[Python-ideas] Re: Ensuring that a package is available.

2020-09-02 Thread Michael Smith
Pillow for one example). Installers downloading stuff is a whole security domain. But software I want to run implicitly invoking the installer adds a layer of complexity to that domain that I think outweighs the gain. - Michael Smith ___ Pytho

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-06 Thread Michael Smith
On Tue, Oct 6, 2020 at 00:37 Kevin Mills wrote: > str_iterator, bytes_iterator, range_iterator, list_iterator, and > tuple_iterator (and probably others) should have a method that is capable > of efficiently advancing the iterator, instead of having to call next > repeatedly. > > I suggest adding

[Python-ideas] Re: New feature

2020-10-13 Thread Michael Smith
I occasionally find it useful to clear the screen when doing demos/presentations. I think the case for it is clear (hah) enough based on its long history and presence in many terminal emulators. But then again, the terminals I use and readline support it already, so I don't need python repl to do

  1   2   3   >