[Python-ideas] Re: Regex timeouts

2022-02-14 Thread Nick Timkovich
> > A regex that's vulnerable to pathological behavior is a DoS attack waiting > to happen. Especially when used for parsing log data (which might contain > untrusted data). If possible, we should make it harder for people to shoot > themselves in the feet. > While definitely not as bad and not as

Re: [Python-ideas] Idea: msgfmt.py and pygettext..py should be -m executable modules

2018-07-30 Thread Nick Timkovich
On Mon, Jul 30, 2018 at 8:43 AM, Petr Viktorin wrote: > On Mon, Jul 23, 2018 at 2:16 PM, Miro Hrončok wrote: > > > It might be: > > > > $ python3 -m gettext > > +1 > > > And: > > > > $ python3 -m gettext.msgfmt > > +1 > Note that this means gettext will need to become a package. > > > And (p

Re: [Python-ideas] On evaluating features [was: Unpacking iterables for augmented assignment]

2018-08-28 Thread Nick Timkovich
On Tue, Aug 28, 2018 at 12:57 PM Guido van Rossum wrote: > However, a user who doesn't typically think about the actual semantics of > iterable unpacking and tuple packing might think this would instead mean > the following: > > a += x > b += x > c += x > > IOW they might think that this is

Re: [Python-ideas] Powerset

2018-10-16 Thread Nick Timkovich
"more-itertools" seems to be a modestly popular library (top 100-500?) that includes the stdlib itertools recipes and more. https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.powerset On Tue, Oct 16, 2018 at 3:42 AM Hasan Diwan wrote: > Pal, > On Tue, 16 Oct 2018 at 01:36, P

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

2018-11-01 Thread Nick Timkovich
Does it make sense to draw some sort of parallel between next(myiterator, default="whatever") and mylist.pop(default="whatever")? They exhaust the iterator/list then start emitting the default argument (if provided). On Thu, Nov 1, 2018 at 2:46 PM Serhiy Storchaka wrote: > 31.10.18 13:08, Antoin

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

2018-11-12 Thread Nick Timkovich
Not to derail the conversation, but I've always been curious why the itertools recipes are recipes and not ready-made goods (pre-baked?) that I can just consume. They're great examples to draw from, but that shouldn't preclude them from also being in the stdlib. On Mon, Nov 12, 2018 at 7:41 PM Mic

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-07 Thread Nick Timkovich
Devils advocate: it might complicate things for someone that needs to use FIPS, where MD5 can be a pain to deal with. On Fri, Dec 7, 2018 at 8:50 AM Devin Jeanpierre wrote: > On Fri, Dec 7, 2018 at 1:40 AM Antoine Pitrou wrote: > >> md5 is only used for a quick integrity check here (think of it

Re: [Python-ideas] Left arrow and right arrow operators

2019-03-12 Thread Nick Timkovich
In general, there is lots of code out in the wild that can't be updated for whatever reason, e.g. the person that knows Python left and it needs to continue to work. Weak argument, but cost-benefit I think it comes out ahead. In your example there isn't a reason I can tell why swapping the operands

Re: [Python-ideas] Built-in parsing library

2019-03-31 Thread Nick Timkovich
What does it mean to be a universal parser? In my mind, to be universal you should be able to parse anything, so you'd need something as versatile as any Turing language, so one could stick with the one we already have (Python). I'm vaguely aware of levels of grammar (regular, context-free?, etc.),

[Python-ideas] Re: Shouldn't this: ' myVar: "value" ' be a syntax error ?

2019-07-10 Thread Nick Timkovich
On Tue, Jul 9, 2019 at 4:15 PM Andrew Barnert via Python-ideas < [email protected]> wrote: > On Jul 9, 2019, at 13:09, Shay Cohen wrote: > > > > >>> a: 3 > > The reason this isn’t a syntax error is that Python allows any valid > expression as an annotation. And “3” is just as valid an expre

[Python-ideas] Re: PEP: Idiomatic API for shell scripting

2019-08-12 Thread Nick Timkovich
I actually gave a talk along these lines at the Chicago Python (ChiPy) meetup last week: slides https://docs.google.com/presentation/d/1v5z4f-FQkS-bQYE-Xv5SvA6cyaTiqlxs2w2CI1yZcAU/edit?usp=sharing Part of the argument was about using pure standard library so a self-contained script/repo could run

[Python-ideas] Re: [Distutils] Re: Linux binary wheels?

2019-08-20 Thread Nick Timkovich
On Tue, Aug 20, 2019, at 5:05 AM Matthew Brett wrote: > ... Unless you meant wheels for non-Intel platforms, in which case, > please do say more about you need. Minor tangent: I've seen some people use https://www.piwheels.org/ for Raspberry Pi (ARM 6/7), but could the ARM binaries be uploaded

[Python-ideas] Add boolean attribute to datetime objects stating if they are tz-aware

2019-08-27 Thread Nick Timkovich
Currently the datetime docs say: > An object of type time or datetime may be naive or aware. A datetime object d is aware if d.tzinfo is not None and d.tzinfo.utcoffset(d) does not return None. If d.tzinfo is None, or if d.tzinfo is not None but d.tzinfo.utcoffset(d) returns None, d is naive. A ti

[Python-ideas] Re: Traits

2020-02-07 Thread Nick Timkovich
On Fri, Feb 7, 2020 at 10:11 AM Soni L. wrote: > I'd like to see traits some day, with a syntax similar to this one: > ... > if the trait isn't used in the function definition you get the raw > object, where name conflicts between traits (but not between traits and > inherent methods) result in a

[Python-ideas] Re: Control adding script path/CWD to sys.path

2020-02-24 Thread Nick Timkovich
On Mon, Feb 24, 2020 at 11:51 AM Brianvanderburg2 via Python-ideas < [email protected]> wrote: > When running a python script directly, the directory of that script gets > added to sys.path. When running as a module "python -m", it looks like an > empty string gets added to sys.path, which

[Python-ideas] Re: Control adding script path/CWD to sys.path

2020-02-24 Thread Nick Timkovich
thon -I myscript.py`, but `-m mypkg` is I think indistinguishable from trying to `import mypkg`, so it needs to be discoverable on `sys.path`...this feels like an A/B problem: what are you trying to do? On Mon, Feb 24, 2020 at 3:35 PM wrote: > Nick Timkovich wrote: > > > > Are you fa

[Python-ideas] Re: Add Standard String Literals and Prefixes for Mathematical Notation

2020-02-25 Thread Nick Timkovich
Can you provide short, but non-trivial, clear examples of "before" (current Python) and "after" (what you propose it looks like) to demonstrate the advantage? Will it be ambiguous with existing syntax? On Tue, Feb 25, 2020 at 6:10 PM Nathan Edwards wrote: > I love regular expressions. I would l

[Python-ideas] Re: Issue 34850: Syntax Warning in the real world (is 0 / is 1)

2020-03-31 Thread Nick Timkovich
> > I understand it locks in that particular implementation detail, but it > also seems unlikely that that particular optimization (int 0 and int 1 as > specific memory objects) would ever make sense to NOT be including in a > shipping implementation (future proof by practicality). > Do you explic

[Python-ideas] Heap data type, the revival

2016-10-15 Thread Nick Timkovich
I once again had a use for heaps, and after rewrapping the heapq.heap* methods for the umpteenth time, figured I'd try my hand at freezing off that wart. Some research turned up an older thread by Facundo Batista (https://mail.python.org/pipermail/python-ideas/2009-April/004173.html), but it seems

Re: [Python-ideas] Heap data type, the revival

2016-10-15 Thread Nick Timkovich
n? On Sat, Oct 15, 2016 at 3:26 PM, Sven R. Kunze wrote: > On 15.10.2016 20:15, Nick Timkovich wrote: >> >> I once again had a use for heaps, and after rewrapping the heapq.heap* >> methods for the umpteenth time, figured I'd try my hand at freezing >> off that wa

Re: [Python-ideas] Heap data type, the revival

2016-10-16 Thread Nick Timkovich
ze wrote: > On 15.10.2016 23:19, Nick Timkovich wrote: >> >> Features and speed are good, but I'm interested in getting something >> with the basic features into the Standard Library so it's just there. >> Not having done that before and bit clueless, I'm wanting

Re: [Python-ideas] SI scale factors alone, without units or dimensional analysis

2016-10-29 Thread Nick Timkovich
>From that page: > User-defined literals are basically normal function calls with a fancy > syntax. [...] While user defined literals look very neat, they are not much > more than syntactic sugar. There is not much difference between defining > and calling a literal operator with "foo"_bar and doi

Re: [Python-ideas] SI scale factors alone, without units or dimensional analysis

2016-10-29 Thread Nick Timkovich
wrote: > On Sat, Oct 29, 2016 at 12:43 PM, Nick Timkovich > wrote: > >> From that page: >> >>> User-defined literals are basically normal function calls with a fancy >>> syntax. [...] While user defined literals look very neat, they are not much >>>

Re: [Python-ideas] Method signature syntactic sugar (especially for dunder methods)

2016-11-08 Thread Nick Timkovich
Also you can support future changes to the syntax (e.g. __matmul__ and friends from 3.5, __aiter__ from 3.5.2) with a single codebase rather than having to push that grammar back to previous versions (impossible?) or have the grammar for magic methods be extraordinarily general (messy?) On Tue, No

Re: [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)

2016-11-14 Thread Nick Timkovich
Currently, Numpy takes advantage of __iadd__ and friends by performing the operation in-place; there is no copying or other object created. Numpy is very thinly C, for better and worse (which is also likely where the += syntax came from). If you're doing vast amounts of numeric computation, it quic

Re: [Python-ideas] Technical possibilities for a syntax [was: Reverse assignment operators ...]

2016-11-16 Thread Nick Timkovich
I think the best way to remove compound operators would be to go back in time and hit Dennis Ritchie with a bat at the exact moment when the notion of them crosses his mind. In all seriousness, compound operators are in practically every modern language and aren't going away. While you don't need

Re: [Python-ideas] Decorator to avoid a mistake

2016-11-22 Thread Nick Timkovich
I think you could implement this yourself with metaclasses and it wouldn't have much (if any) performance hit per-call or per-instantiation (just a bit slower when creating the class definition). It's a bit heavy-handed-hand-holding–if you ask me–but if you want to do it, the language gives you th

Re: [Python-ideas] Decorator to avoid a mistake

2016-11-25 Thread Nick Timkovich
You can do it at run-time, if you so desire, without a measurable performance hit with a metaclass. Here's a hacky demo: https://gist.github.com/nicktimko/5f08d6adfa1dbe1319c3bfc715ec0aa4#file-override_guard-ipynb (Pedants: Any performance hit will be constant-time and probably less than a stray i

Re: [Python-ideas] Decorator to avoid a mistake

2016-11-25 Thread Nick Timkovich
Here's hopefully a working link; GitHub's rendering seems to be iffy: https://nbviewer.jupyter.org/urls/gist.githubusercontent.com/nicktimko/5f08d6adfa1dbe1319c3bfc715ec0aa4/raw/37dd95cd92be7b7e5af01b98ce9e8e00a705b3f7/override_guard.ipynb Knowing how to do some introspection with dunder magic att

Re: [Python-ideas] (no subject)

2016-11-29 Thread Nick Timkovich
I would consider the speed of the "ultimate error handler" (i.e. whatever prints the traceback and kills the program) in the interpreter to be moot, so long as it takes a small fraction of a second. Optimizing Python's speed it crashes super-fast due to an *unhandled* NameError in your program seem

Re: [Python-ideas] Allow random.choice, random.sample to work on iterators

2016-11-30 Thread Nick Timkovich
Is the goal to allow them to consume a finite generator of *unknown* length (requires reservoir sampling https://en.wikipedia.org/wiki/Reservoir_sampling with N random calls, which seemed to be the rub before?) or just consume a generator with known length that's not indexable (a rare beast?). Con

Re: [Python-ideas] Input characters in strings by decimals (Was: Proposal for default character representation)

2016-12-07 Thread Nick Timkovich
Out of curiosity, why do you prefer decimal values to refer to Unicode code points? Most references, http://unicode.org/charts/PDF/U0400.pdf (official) or https://en.wikibooks.org/wiki/Unicode/Character_reference/-0FFF , prefer to refer to them by hexadecimal as the planes and ranges are broken

Re: [Python-ideas] Input characters in strings by decimals (Was: Proposal for default character representation)

2016-12-07 Thread Nick Timkovich
> > hex notation not so readable and anyway decimal is kind of standard way to > represent numbers Can you cite some examples of Unicode reference tables I can look up a decimal number in? They seem rare; perhaps in a list as a secondary column, but they're not organized/grouped decimally. Readab

Re: [Python-ideas] AtributeError inside __get__

2016-12-25 Thread Nick Timkovich
Are you saying that hasattr returning False was hiding a bug or is a bug? The former could be annoying to track down, though hasattr(X, 'y') == True. For the latter, having hasattr return False if an AttributeError is raised would allow the property decorator to retain identical functionality if it

Re: [Python-ideas] How to respond to trolling

2017-01-10 Thread Nick Timkovich
If you're proposing throwing half of Python's current syntax in the bin, this isn't the right list either. If not marginally malicious, I think it's delusional to think a post to Language X's lists by someone who recommends multiple breaking changes would ever be accepted. The correct response (if

Re: [Python-ideas] Things that won't change (proposed PEP)

2017-01-11 Thread Nick Timkovich
Why mention sys.ps1 == '>>> ', is that some inside joke I'm unaware of? That is one of the easier things to modify (with a sitecustomize.py or whatever). On Thu, Jan 12, 2017 at 12:03 AM, INADA Naoki wrote: > > Built-in functions > > > > -- > > > > > > > > Python is an object-ori

Re: [Python-ideas] Ideas for improving the struct module

2017-01-19 Thread Nick Timkovich
ctypes.Structure is *literally* the interface to the C struct that as Chris mentions has fixed offsets for all members. I don't think that should (can?) be altered. In file formats (beyond net protocols) the string size + variable length string motif comes up often and I am frequently re-implement

Re: [Python-ideas] Ideas for improving the struct module

2017-01-19 Thread Nick Timkovich
; construct doesn't automatically mean that we should stop improving the > stdlib, but OTOH not every useful thing can or should be in the stdlib. > > Personally, I find myself parsing uleb128-prefixed strings more often than > u4-prefixed strings. > > On Jan 19, 2017 1

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-23 Thread Nick Timkovich
Related and probably more common is the need for the line-continuation operator for long/multiple context managers with "with". I assume that's come up before, but was it also just a low priority rather than any technical reason? On Mon, Jan 23, 2017 at 1:53 PM, Brett Cannon wrote: > Actually mu

Re: [Python-ideas] Is it Python 3 yet?

2017-01-26 Thread Nick Timkovich
After Django 1.11 (alpha 1 out now, final in few months, LTS EOL 2020) was branched out from master on GH, it was pretty impressive & heartening to see massive commits against master that removed Python 2 compatibility from such a popular library. On Thu, Jan 26, 2017 at 10:11 AM, Victor Stinner

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-10 Thread Nick Timkovich
If everything was contained right in the same file, this is sanctioning another way to do it (when there should only be one obvious way). If you have multiple modules/packages, horrors can evolve where a class method could be patched in an unknown location by any loaded module (or you could even in

Re: [Python-ideas] Contraction for "for x in range()"

2017-02-14 Thread Nick Timkovich
for i in range(...) is *sometimes* indicative of code smell, especially when then doing x[i], though it has its uses. I've never had a need to shorten a for...range line though. Other than it being "cute", do you have an example where it's definitively better? On Tue, Feb 14, 2017 at 4:03 PM, Tod

Re: [Python-ideas] Contraction for "for x in range()"

2017-02-14 Thread Nick Timkovich
Make some shim object that you can index into to get that functionality, could even call it Z (for the set of all integers). Short, and requires no new syntax. class IndexableRange: def __getitem__(self, item): if isinstance(item, slice): start = item.start if item.start is

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Nick Timkovich
I think fundamentally by special-casing a for-loop variant, you have a construct with limited/no generality that's simply an additional burden to learn. You're kind of doing the opposite of converting print from a statement into a function. I far prefer the print function because it's a function li

Re: [Python-ideas] get() method for list and tuples

2017-02-28 Thread Nick Timkovich
I wouldn't see myself using it for an arbitrary value in the middle of the list, but perhaps for the 0th or -1st (first/last) element of a list that might be empty. Maybe also second-to-first/last if I'm initializing some comparison between sequential items? Some of the examples don't work with ne

Re: [Python-ideas] suggestion about the sort() function of the list instance

2017-03-01 Thread Nick Timkovich
>From my experience teaching Python to non-programmers, it's a huge hurdle/nightmare to teach functions/methods that modify objects in-place vs. return a value that must be reassigned. Behold Pandas's DataFrame's sort method, which has an optional `in_place` argument that defaults to *False*, which

Re: [Python-ideas] Exploiting type-homogeneity in list.sort() (again!)

2017-03-05 Thread Nick Timkovich
I see the benchmarks, and while I assume the asymptotic complexity is the same, is there a longer "start-up" time your optimizations need? Do you have benchmarks where you sort 10, 100...10**6 items to show that beyond the types you're sorting, you're not amortizing any increased overhead out to ob

Re: [Python-ideas] Add pathlib.Path.write_json andpathlib.Path.read_json

2017-03-29 Thread Nick Timkovich
> > I attended a talk at PYCON UK that talked to the point of using object > composition > rather then rich interfaces. I cannot recall the term that was used to > cover this idea. > > Separating things by concern/abstraction (the storage vs. the serialization) results in easier-to-learn code, *e

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-24 Thread Nick Timkovich
GitHub shows that that note hasn't changed in 10 years: https://github.com/python/cpython/blame/master/Doc/reference/datamodel.rst#L2210 On Mon, Apr 24, 2017 at 3:15 PM, Terry Reedy wrote: > On 4/24/2017 12:14 PM, Stephan Hoyer wrote: > > Based on the change in the documentation between 2.x and

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-26 Thread Nick Timkovich
I was wondering that if there are so many arguments to a function that it *looks* ugly, that it might just *be* ugly. For one, too many required arguments to a function (constructor, whatever) is already strange. Binding them as attributes of the object, unmodified in a constructor also seems to b

Re: [Python-ideas] CPython should get...

2017-07-01 Thread Nick Timkovich
On Sat, Jul 1, 2017 at 1:17 PM, Oleg Broytman wrote: > >I think the sentence "Python should have implement feature>" should be ;-) forbidden if it is not followed with > "I'm in the middle of development. Expect the 1st PR in timeframe>." > >Python can only have features that You, the ,

Re: [Python-ideas] Idea : for smarter assignment?

2017-07-25 Thread Nick Timkovich
On Fri, Jul 21, 2017 at 12:59 PM, David Mertz wrote: > > But you've left out quite a few binding operations. I might forget some, > but here are several: > Ned Batchelder had a good presentation at PyCon 2015 about names/values/assignments/binding: https://youtu.be/_AEJHKGk9ns?t=12m52s His summa

Re: [Python-ideas] Fwd: Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Nick Timkovich
On Tue, Aug 22, 2017 at 12:34 AM, Nick Coghlan wrote: > Folks, this has come up before, but: please don't post through Google > Groups, as it breaks everyone else's ability to easily reply to the > entire mailing list. > Mentioning this is probably going to do nothing, especially for new, future

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Nick Timkovich
Knowing nothing about the JavaScript ecosystem (other than that leftpad is apparently not a joke and everything needs more jQuery), what are the leagues-above testing libraries? On Tue, Aug 22, 2017 at 5:20 PM, [email protected] wrote: > TBH you're completely right. Every time I see someone using

Re: [Python-ideas] Make map() better

2017-09-13 Thread Nick Timkovich
On Wed, Sep 13, 2017 at 10:54 AM, Jason H wrote: > > Thanks for the insights. > I don't think it would be that breaking: > > def remap_map(a1, a2): > if hasattr(a1, '__call__'): > return map(a1, a2) > elif hasattr(a2, '__call__'): > return map(a2,a1) > else: > raise NotCallable #

Re: [Python-ideas] Proposal to change Python version release cycle

2017-11-04 Thread Nick Timkovich
On Sat, Nov 4, 2017 at 10:44 AM, M.-A. Lemburg wrote: > Just to clarify: Python 2.0 was called 2.0 because the BeOpen marketing > department thought it was good idea, not because there were major > incompatible changes going into that release. > Alternative history question: if it was just 1.6,

Re: [Python-ideas] Allow additional separator character in variables

2017-11-18 Thread Nick Timkovich
Python does not use U+2010 HYPHEN for the minus operator, it uses the U+002D (-) HYPHEN-MINUS. In some monospace fonts, there is a subtle difference between U+002D, U+2013 EN DASH, and U+2014 EM DASH, but it's usually hard to tell them *all* apart. If you want to make a proposal, I'd suggest that

Re: [Python-ideas] Allow additional separator character in variables

2017-11-19 Thread Nick Timkovich
I guess for reference: exec('a\N{MIDDLE DOT} = 0') exec('\N{BUHID LETTER RA} = 1') exec('\N{HANGUL LETTER EU} = 2') exec('\N{TIFINAGH LETTER YO} = 3') exec('\N{BOPOMOFO LETTER I} = 4') exec('\N{HANGUL LETTER ARAEA} = 5') On Sun, Nov 19, 2017 at 1:38 AM, Serhiy Storchaka wrote: > 19.11.17 04:01,

Re: [Python-ideas] Make bytes __repr__ and __str__ representation different?

2017-11-21 Thread Nick Timkovich
On Tue, Nov 21, 2017 at 11:22 AM, Chris Barker wrote: > supposedly __repr__ is supposed to give an eval-able version -- which your > proposal is. But the way you did your example indicates that: > > bytes((42, 43, 44, 45, 46)) > > would be an even better __repr__, if the goal is to make it clear

Re: [Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-21 Thread Nick Timkovich
On Tue, Nov 21, 2017 at 4:16 PM, Sven R. Kunze wrote: > Maybe, that suffices: https://pypi.python.org/pypi/xheap > I still think the heapq.heap* functions are atrocious and they should immediately be packaged with *no additional features* into a stdlib object for reasons along the line of https:/

Re: [Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-21 Thread Nick Timkovich
On Tue, Nov 21, 2017 at 6:45 PM, Steven D'Aprano wrote: > On Tue, Nov 21, 2017 at 04:56:27PM -0600, Nick Timkovich wrote: > > On Tue, Nov 21, 2017 at 4:16 PM, Sven R. Kunze wrote: > > > > > Maybe, that suffices: https://pypi.python.org/pypi/xheap > >

Re: [Python-ideas] Using an appropriate tone in emails (was: Adding a thin wrapper class around the functions in stdlib.heapq)

2017-11-27 Thread Nick Timkovich
On Mon, Nov 27, 2017 at 8:17 PM, Brett Cannon wrote: > But calling it "atrocious" and so bad that it needs to be fixed > "immediately" as if it's a blight upon the stdlib is unnecessarily > insulting to those that have worked on the module. To convey the feeling > that you think an OO wrapper wou

Re: [Python-ideas] Add a dict with the attribute access capability

2017-11-29 Thread Nick Timkovich
On Wed, Nov 29, 2017 at 7:21 AM, Daniel Moisset wrote: > As reference of prior art, there is https://pypi.python.org/pypi/munch in > PyPI > Box is also popular as it permits deeper nesting: https://pypi.python.org/pypi/python-box/ https://github.com/cdgriffith/Box Addict is similar: https://pypi

Re: [Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

2017-11-30 Thread Nick Timkovich
On Thu, Nov 30, 2017 at 12:24 PM, Brett Cannon wrote: > On Wed, 29 Nov 2017 at 13:28 Greg Ewing > wrote: > >> Nick Coghlan wrote: >> >> >>What about more English-like syntax: >> >> >> >>X or else Y >> > >> > The problem with constructs like this is that they look like they >> > should mean the s

Re: [Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Nick Timkovich
If I'm understanding correctly, the interpreter already does this with threads. About every 15 milliseconds the interpreter will stop a thread and see if there are any others to work on, see "Grok the GIL," blog: https://emptysqua.re/blog/grok-the-gil-fast-thread-safe-python/ or the PyCon talk: htt

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Nick Timkovich
I think part of the reason that logging appears complicated is because logging actually is complicated. In the myriad different contexts a Python program runs (daemon, command line tool, interactively), the logging output should be going to all sorts of different places. Thus was born handlers. If

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-07-01 Thread Nick Timkovich
On Fri, Jun 29, 2018 at 8:58 PM, Matt Arcidy wrote: > It seems like the very small percentage of academic users whose careers > depend on this cannot resolve the political issue of forming a standards > body. > > I don't see how externalizing the standard development will help. Kudos > for short

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread Nick Timkovich
> > > This might be a silly idea but, would it be a good idea to have > > ...[a:b:c] return a range(a, b, c)? > If a 'thunderscore' is acceptable: import itertools class _ranger: @classmethod def __getitem__(self, key: slice): if isinstance(key, slice): if key.stop is

[Python-ideas] Re: heapq max heap

2022-04-13 Thread Nick Timkovich
I myself have proposed heap objects and seen that and other features come up from time to time. I think the general mood is to use a PyPI library, or even just vendor a single file from a package like xheap https://github.com/srkunze/xheap/blob/master/xheap.py If you wanted to stick with what's in