[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Andrew Barnert via Python-ideas
reemptively answer all of those questions and turn this into a proposal that covers everything but the implementation details (with maybe a few narrow open questions). _______ Python-ideas mailing list -- [email protected] To unsubscribe send an ema

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Andrew Barnert via Python-ideas
for normal .py imports on a stock CPython on Windows or Mac installation, can a non-sophisticated user (or automated software) reliably distinguish system, site, added-by-old-school-egg, user, venv, script-dir, and custom based on the pathname? _______ Python-

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Andrew Barnert via Python-ideas
is std but nothing else”), but if that’s what we want, I think it’s doable without an implementation nightmare. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailm

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Andrew Barnert via Python-ideas
tarts using try from std import except from local import instead of screwing with sys.path, that’s not a problem, it’s a good thing). But it’s something to keep in mind._______ Python-ideas mailing list -- [email protected] To unsubscribe send an

[Python-ideas] Re: A bit change to create a matrix variable in Python as easy as MATLAB and Julia!

2019-11-08 Thread Andrew Barnert via Python-ideas
to Python itself, just define the one-liner wherever you want to use it, and you can use it. _______________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-10 Thread Andrew Barnert via Python-ideas
On Nov 10, 2019, at 08:00, Stephen J. Turnbull wrote: > > Andrew Barnert via Python-ideas writes: >>> On Nov 7, 2019, at 19:59, Chris Angelico wrote: >>> >>> And I do the same with the operators that you disparagingly call >>> "ASCII soup".

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-10 Thread Andrew Barnert via Python-ideas
On Nov 10, 2019, at 08:23, Stephen J. Turnbull wrote: > > Martin Euredjian via Python-ideas writes: > >> Another interesting example is had in some of my work with real >> time embedded systems. There are plenty of cases where you are >> doing things that are v

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-10 Thread Martin Euredjian via Python-ideas
e case that someone is actually going to get out of that box and comprehend what you are saying. BTW, there are some interesting efforts out there, like this: https://www.youtube.com/watch?v=1iTPLgfmFdI Once you dig into these truly interesting examples you end-up discovering that notat

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-10 Thread Andrew Barnert via Python-ideas
On Nov 10, 2019, at 20:50, Martin Euredjian via Python-ideas wrote: > > > This has nothing to do with representation or input via text > > It does, it's an extension of the reality that, after so many decades, we are > still typing words on a text editor. And how

[Python-ideas] Re: A bit change to create a matrix variable in Python as easy as MATLAB and Julia!

2019-11-11 Thread Andrew Barnert via Python-ideas
far as the grammar) a kind of display. On the other hand, except for dtype example, you can already do all of this exactly the same without changing Python just by using A(...) instead of a[...], and I don’t think it looks that much worse. ______

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-11 Thread Martin Euredjian via Python-ideas
ank you, -Martin _______ 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@py

[Python-ideas] Re: Domain Specification

2019-11-11 Thread Andrew Barnert via Python-ideas
t hook that runs your macros as AST transforms, so you only have to focus on what the macros should look like and do. It can’t always do everything you need, but when it can, it’s amazing. _______ Python-ideas mailing list -- [email protected]

[Python-ideas] Re: `__lcontains__` for letting the other class determine container membership when `__contains__` fails

2019-11-12 Thread Andrew Barnert via Python-ideas
o be useful, they’d all have to be changed to return NotImplemented instead. I think __lcontains__ (following the same rules as __radd__, and with the change to every existing __contains__, and probably at least two versions’ worth of __future__) could be useful, and if I were designing a new P

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-13 Thread Andrew Barnert via Python-ideas
out at that point. But this all based on my memory, which is probably wrong or fuzzy on at least some points, so you really should dig up all of the old threads. _______________ Python-ideas mailing list -- [email protected] To unsubscribe send an

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-14 Thread Andrew Barnert via Python-ideas
expressions, what gets dumped with the SyntaxError isn’t always the most relevant part of the expression. (Everyone remembers the first time they left off a close paren and got a baffling error complaining about the perfectly good next line…) ___ Pytho

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-14 Thread Andrew Barnert via Python-ideas
On Nov 14, 2019, at 09:53, Andrew Barnert via Python-ideas wrote: > > Yeah, it seems like this should be doable in basically the same way bracketed > multiline expressions are. I’m not sure how much of a change that would > require. But it seems like it’s worth fiddling with

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-14 Thread Andrew Barnert via Python-ideas
enize.py have enough info to handle that properly? I don’t know, and the answer to that might be a good proxy to the question of whether it can be done in the real compiler without making parsing complicated, even if it won’t prove the answer either way. _______

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-14 Thread Andrew Barnert via Python-ideas
seemed potentially more promising than the original (and frequent) suggestion to add parens here. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pytho

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-14 Thread Andrew Barnert via Python-ideas
On Nov 14, 2019, at 13:23, MRAB wrote: > >> On 2019-11-14 19:51, Andrew Barnert via Python-ideas wrote: >> On Nov 14, 2019, at 11:21, Random832 wrote: >>>> On Thu, Nov 14, 2019, at 13:12, Andrew Barnert wrote: >>>> And then you can run it on a whole

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-15 Thread Andrew Barnert via Python-ideas
r cases. But it seems like it’s at least worth building for your personal toolbox and keeping track of how often it comes up (and how much nicer it makes things), and maybe publishing it to PyPI or submitting it to contextlib2 so more people will do the same. _________

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-15 Thread Andrew Barnert via Python-ideas
thon has—e.g., if you have a raw fd passed to you by a C API or over a Unix socket, the way to wrap it in a file object is just to call open and use it as the first argument; it seems like it would be weird to have a “file ready to be opened” that’s actually an open file but the wrap

[Python-ideas] Re: Use __signature__ in help() and perhaps somewhere else too

2019-11-15 Thread Andrew Barnert via Python-ideas
doesn’t give you any benefits except in special cases (s.g., it could be useful for an auto-curry decorator that accumulates args into a partial until the entire signature is bound, and then calls the function). Maybe those special cases are common enough to put a helper in functools or so

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-16 Thread Andrew Barnert via Python-ideas
that only cleans up if the generator is cleaned up…) Or breaking file objects up into as many orthogonal pieces as possible to see if there’s a better way to reassemble them? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an

[Python-ideas] Re: Tuple Comprehension

2019-11-18 Thread Andrew Barnert via Python-ideas
tax? I don’t think 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/archives/list/py

[Python-ideas] Re: Differentiate variables form everything else

2019-11-18 Thread Andrew Barnert via Python-ideas
good use. It seems like your argument is that even though it makes code harder to read as plain text, and to write, it helps IDEs so much that the readability is a net win? Maybe some examples would help, but it seems implausible. ___________ Python-i

[email protected]

2019-11-18 Thread Andrew Barnert via Python-ideas
= 18 > print (x + y + z + str(a)) > and thats not much difference to worry about. Problem comes when there are > more different data types need to be added and combined together. Why? Every data type is converted to string in the same way: the str function. Every data type is also automatically

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Andrew Barnert via Python-ideas
context manager. ___ 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.pytho

[Python-ideas] Re: Differentiate variables form everything else

2019-11-18 Thread Andrew Barnert via Python-ideas
On Nov 18, 2019, at 10:27, Random832 wrote: > > On Mon, Nov 18, 2019, at 13:00, Andrew Barnert via Python-ideas wrote: >>def f(a, b): return a**(b+1) >>g = partial(f, b==2) >>h = lambda x: f(x, 2) >> >> Python can’t tell the difference between f,

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Andrew Barnert via Python-ideas
g the closing cm on it in a different lexical context that you end up passing the released cm to). (I think C++ smart pointers might be relevant here, or maybe something from Rust, although I haven’t thought it through in much detail.) ___ Python-ideas mailing list -- pyth

[Python-ideas] Re: Differentiate variables form everything else

2019-11-18 Thread Andrew Barnert via Python-ideas
ts__, or even replace their __code__. In fact, there aren’t very many _immutable_ callables (by comparison to the huge number of functions). _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@python.

[Python-ideas] Re: Tuple Comprehension

2019-11-18 Thread Andrew Barnert via Python-ideas
claring that it’s definitely not a problem. But I _think_ it’s not a problem. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messa

[Python-ideas] Re: Differentiate variables form everything else

2019-11-18 Thread Andrew Barnert via Python-ideas
atever in the first place? _______ 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

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Andrew Barnert via Python-ideas
by default and every ownership is scoped by default” model that Rust has and C++ vaguely approximates, but with Python you’d need… I’m not sure, but I suspect it would be ugly. _______ Python-ideas mailing list -- [email protected] To unsubscribe s

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Andrew Barnert via Python-ideas
On Nov 18, 2019, at 16:35, Soni L. wrote: > > >> On 2019-11-18 5:22 p.m., Soni L. wrote: >> >> >>> On 2019-11-18 5:13 p.m., Andrew Barnert via Python-ideas wrote: >>>> On Nov 18, 2019, at 10:51, Random832 wrote: >>> > > On Mo

[Python-ideas] Re: Improved Function Decorators

2019-11-18 Thread Andrew Barnert via Python-ideas
behaves that way into the stdlib. Or just mention how to do (and that helpers are readily available) in the docs on decorators. (I don’t think it means we need to add a whole new decorator syntax that just does that for you magically but is otherwise the same as the existing one.) _____

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
ested functions and you’re done. But if we’re really going to rethink resource management from scratch, I don’t think we’re talking about Python anymore anyway. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to p

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
ile would probably work. But is that better than an opening function that takes a Path (or any of the other valid arguments to open) as its first argument? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
he problem; no matter how you write things, fn2 will never be entered, so no file will be created or truncated and no fd will get leaked. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-

[Python-ideas] Re: Ability to set precedence of classdict (returned from __prepare__) for a metaclass type

2019-11-19 Thread Rob Cliffe via Python-ideas
no doubt others) am less likely to engage with a thread if I have to spend more time than necessary trying to understand it. Thanks Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected]

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
On Nov 19, 2019, at 14:30, Greg Ewing wrote: > > On 20/11/19 6:51 am, Andrew Barnert via Python-ideas wrote: >> A class can bind attributes in __new__ and return a fully initialized >> object. If that’s perfectly ok, why doesn’t every class do everything >> in __new__,

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
g but not an error, if you break the rules. But you don’t have to use ARC, and you can go around the conventions rather than breaking them, so I think “just a convention” is close enough.) _______ Python-ideas mailing list -- [email protected] To u

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
rials and blog posts and python-list and StackOverflow answers to favor creating and using lazy context managers whenever possible (“because they work with the tuple syntax” seems like a good argument…). And you can do all of this without needing to change the protocol. ____

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Andrew Barnert via Python-ideas
t rely on eager context manager behavior. So we’re still not talking about an idea for Python here. The idea in my other email, providing a wrapper to turn eager context managers lazy and an ABC to distinguish them and so on, may not be nearly as clean, but it seems a lot more feasibl

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-22 Thread Rob Cliffe via Python-ideas
On 06/11/2019 17:05:21, Martin Euredjian via Python-ideas wrote:   One has to use APL for real work and for at least a year or two in order for your brain to make the mental switch necessary to understand it.  Just messing with it casually isn't good enough.  Lots of inquisitive people

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-22 Thread Rob Cliffe via Python-ideas
take "a year or two" to become familiar. In a nutshell: APL is a dinosaur; the world has moved on. Python is always alive to adopting ideas from other programming languages. But in this case "We've heard what you say.  No thank you". Rob Cliffe ____

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-11-24 Thread Rob Cliffe via Python-ideas
. +1. 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: Update pep8 for stressing type hinted long parameter in functions

2019-11-27 Thread Andrew Barnert via Python-ideas
experiment within the rules of PEP 484. The question is whether that’s still true, or whether PEP 484 usage is explored well enough by now to start offering guides rather than an invitation to experiment further. _______ Python-ideas mailing list -- pytho

[Python-ideas] Re: Calendar.year()

2019-11-27 Thread Andrew Barnert via Python-ideas
ryear) vs. prmonth? _______ 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/pytho

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

2019-11-27 Thread Andrew Barnert via Python-ideas
ing contents. That’s a lot more confusing. I frequently accidentally try to parse a pathname as an XML document, or to open a file using an XML document as a pathname, but I never make that mistake with JSON. ___ Python-ideas mailing list -- python-ideas@p

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

2019-11-28 Thread Andrew Barnert via Python-ideas
(much like dis), not a function you’d use to convert an object to a pickle and save in a file. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman

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

2019-11-29 Thread Andrew Barnert via Python-ideas
everything from scripts to servers. That’s why we usually get names like `get_current_loop` today instead of names like `getcwd`. (But not always—e.g., new additions to `math` that wrap or emulate `math.h` functions still get C-style names.) _______ Python-id

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

2019-11-30 Thread Andrew Barnert via Python-ideas
r new users would clamor first += but not ++, or be able to learn each when they see it, but knowing that C programmers would find them both intuitive but that their intuition for ++ doesn’t make sense for Python while their intuition for += does. _________

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

2019-11-30 Thread Andrew Barnert via Python-ideas
e aliases (because they’re just functions), but what about bound methods (and classmethods and custom method-y decorators)? For example, if `mine = MyClass()`, does `mine.process_file.__alias__` also work? How? Do method objects have a @property for the dunder that delegates to the underlying `__func__`? If not, I

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

2019-11-30 Thread Andrew Barnert via Python-ideas
On Nov 30, 2019, at 10:25, MRAB wrote: > > On 2019-11-30 05:28, Andrew Barnert via Python-ideas wrote: >>> On Nov 29, 2019, at 02:42, Steven D'Aprano wrote: >>> Programming uses lots of initialisms, abbreviations and hybrid words, such >>> as: >>

[Python-ideas] Re: namedtuple for dict.items()/collections.abc.Mappings.items()

2019-11-30 Thread Andrew Barnert via Python-ideas
so I don’t think it would have the desired result of pushing the whole ecosystem to change in 4.5 years; people would have to keep using [0] and [1] for many years to come if they wanted to work with all mapping types. _______ Python-ideas mailing

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

2019-11-30 Thread Andrew Barnert via Python-ideas
On Nov 30, 2019, at 16:15, Steven D'Aprano wrote: > On Sat, Nov 30, 2019 at 11:54:35AM -0800, Andrew Barnert via Python-ideas > wrote: > >> To an experienced C programmer, both += and ++ are intuitive. But to a >> novice who’s never programmed, neither one is int

[Python-ideas] Re: namedtuple for dict.items()/collections.abc.Mappings.items()

2019-11-30 Thread Andrew Barnert via Python-ideas
for value, key in d.items()` it will appear correct but then do the wrong thing inside the loop. (And if I’m trying to fix your code, I might not even notice that you got it backward until after a couple hours banging my head on the debugger.) With a namedtuple, there’s no way to mix up the n

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

2019-11-30 Thread Andrew Barnert via Python-ideas
On Nov 30, 2019, at 20:13, Steven D'Aprano wrote: > > On Sat, Nov 30, 2019 at 05:31:01PM -0800, Andrew Barnert wrote: >>> On Nov 30, 2019, at 16:15, Steven D'Aprano wrote: >>> On Sat, Nov 30, 2019 at 11:54:35AM -0800, Andrew Barnert via Python-ideas >&g

[Python-ideas] Re: namedtuple for dict.items()/collections.abc.Mappings.items()

2019-11-30 Thread Andrew Barnert via Python-ideas
les would in any way affect any of the code you wrote. ___________ 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 archiv

[Python-ideas] Re: Suggestion for language addition

2019-12-02 Thread Andrew Barnert via Python-ideas
u need a closing brace because the dedent could be a lie, in Python it syntactically means the very thing you hope it means.)_______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
up to the start. But does a ruler help any better? And would an “end for”? _______ 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: Sets for easy interning(?)

2019-12-03 Thread Andrew Barnert via Python-ideas
ld 2.3 sets module, change the underlying dict from mapping each key to None to instead map it to itself, and then the method is just return self._dict[key].) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pytho

[Python-ideas] Re: Sets for easy interning(?)

2019-12-03 Thread Andrew Barnert via Python-ideas
constructor returns a zero?) I’m pretty sure I have run into a handful of more useful uses for this method over the years, but I can’t remember any. Maybe something to do with Unicode normalization? ___ Python-ideas mailing list -- python-ideas@p

[Python-ideas] Re: Sets for easy interning(?)

2019-12-03 Thread Andrew Barnert via Python-ideas
> On Dec 3, 2019, at 03:41, Steven D'Aprano wrote: > On Tue, Dec 03, 2019 at 01:54:44AM -0800, Andrew Barnert via Python-ideas > wrote: >>>>> On Dec 2, 2019, at 16:27, Soni L. wrote: >>>> Even use-cases where you have different objects whose dif

[Python-ideas] Re: Fwd: re.findfirst()

2019-12-03 Thread Andrew Barnert via Python-ideas
ight that there would be similar convenience uses for findfirst, if not even more of them. And it makes more sense to build that findfirst around findall or finditer than around search. But, given how easy it is to build this on finditer, and that it uses a general pattern that works for every si

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-03 Thread Andrew Barnert via Python-ideas
s. For example, should dict.__or__ and __ior__ handle all the same values as update, or some more restricted set of types? The same as set.__or__ and __ior__ vs. union, and list.__add__ and __iadd__ vs extend, and so on. If they’re all consistent, and there’s no compelling reason to add an i

[Python-ideas] Re: Archiving Threads / Closing Threads

2019-12-03 Thread Andrew Barnert via Python-ideas
can, and already do. And if someone like Serhiy or even Guido is away for a week, does that mean every thread started during that week should get resolved without their frequently crucial input? _______ Python-ideas mailing list -- [email protected] To

[Python-ideas] Re: Sets for easy interning(?)

2019-12-03 Thread Andrew Barnert via Python-ideas
On Dec 3, 2019, at 15:45, Greg Ewing wrote: > > On 4/12/19 7:26 am, Andrew Barnert via Python-ideas wrote: >> If you’re using interning for functionality, to distinguish two equal >> strings that came from different inputs or processes, your code is probably >> brok

[Python-ideas] Re: Fwd: re.findfirst()

2019-12-03 Thread Andrew Barnert via Python-ideas
xt that raises a > different exception when the result isn't found. If you need that, it’s pretty trivial to write yourself. If you think other people need it and don’t know how to write it, why not submit it to more-itertools and/or tools? If it gets enough uptake, you can always su

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
deas, where you can directly respond to objections and refine your positive case, a frozen document is probably less likely to convince people. Plus, once it’s rejected, that’s … not quite final (I think ideas from rejected PEPs have been revived; I think the @ operator is an example?), but at l

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
overcome that. _______ 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/li

[Python-ideas] Re: Archiving Threads / Closing Threads

2019-12-03 Thread Andrew Barnert via Python-ideas
ne even worse, so that’s not a serious proposal, just a blue-sky wish. _______ 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: Sets for easy interning(?)

2019-12-03 Thread Andrew Barnert via Python-ideas
if the type is a builtin). _______ 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

[Python-ideas] Re: math.copysign not to introduce float

2019-12-04 Thread Andrew Barnert via Python-ideas
think about whether start==stop is safe, it will obviously safely give you an empty range. (You can extend this to be more flexible (take just stop, or start and stop, or start and stop and abs(step) arguments) if you need it.) _______ Python-ideas mailing

[Python-ideas] Re: Allow user extensions to operators [related to: Moving PEP 584 forward (dict + and += operators)]

2019-12-04 Thread Andrew Barnert via Python-ideas
t test it. _______ 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]

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
bout once/year for them? That sounds about right to me, too. _______ 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 arc

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
ed like when they last ran into it, and how much their workaround bothered 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/ Me

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
’s likely that you could find that much.) ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mai

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
example of a logic error that a compiler could catch without early return but can’t catch with it? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-05 Thread Andrew Barnert via Python-ideas
ey don’t. So maybe it’s worth at least adding first as a recipe, even if people don’t think it’s worth adding to the module itself? (Personally, I use first if I’ve already imported more-itertools for something else, but otherwise I just next Iter.)________

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-05 Thread Andrew Barnert via Python-ideas
st even more, because novices shouldn’t learn that bad idea. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messa

[Python-ideas] Re: Argumenting in favor of first()

2019-12-05 Thread Andrew Barnert via Python-ideas
dules in the stdlib) has come up before, but either there’s never a good enough use case, or just nobody volunteers to do it. And first might well be the candidate that’s worth it. Then again, maybe it is worth optimizing. Or maybe it’s fine to just list it as a recipe (the recipes docs already

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-06 Thread Andrew Barnert via Python-ideas
, but sometimes people do, and sometimes we all have to deal with their code. I don’t think this is a huge objection, but it is worth figuring out how often and how badly people would be affected. _______ Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Argumenting in favor of first()

2019-12-06 Thread Andrew Barnert via Python-ideas
want the basic peek. _______ 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-idea

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-07 Thread Andrew Barnert via Python-ideas
next(finditer()).group(1), which return a tuple vs. just the first one? ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pytho

[Python-ideas] Re: Argumenting in favor of first()

2019-12-07 Thread Andrew Barnert via Python-ideas
ot really an argument against making a special case for one that isn’t made for unique or consume. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/

[Python-ideas] Re: Argumenting in favor of first()

2019-12-07 Thread Andrew Barnert via Python-ideas
rently, but because its target audience is more novice-y), or what? You need some argument for that to overcome the status quo, and expanding itertools making it harder to find the stuff that really is necessary to have there, and the fact that you’d either have to implement it in C or con

[Python-ideas] Re: Argumenting in favor of first()

2019-12-08 Thread Andrew Barnert via Python-ideas
with a little edited-in footnote or comment saying “if you’re using the upcoming 3.9, you can use first instead of next and leave out the call to iter”. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-l

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
e’s ever been willing to do each time it comes up (and you’re right, it comes up every time a new potentially useful itertools tool is proposed…). If someone cares about first enough to finally do that, I’m +1 on the proposal instead of 0. ___________

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
s, I found some that were clearly updated for 3.x but still explicitly checked for StopIteration anyway. If adding first causes some people to re-evaluate old code like that in tutorials and improve a few of them, maybe that’s enough to be worth it on its own. Also, the new docs on first its

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
;__iter__') check No there isn’t. It’s almost always true, because the only things that normally have __next__ are iterators, and they always have __iter__ as well. But there’s no need to check for that. If you create a type that has __next__ but not __iter__ for some reason, you expect that it

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
take and then curry that. So you can just follow the convention everywhere without worrying about whether this is one of the rare cases where the other way around might actually be useful more often. ___ Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Fwd: Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
iple places in more_itertools) makes more sense. Trying to get the first value out of an empty Iterable is a lot like trying to use tuple unpacking on an empty Iterable; it’s not much like trying to look up a key in an empty dict. _______ Python-

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Andrew Barnert via Python-ideas
istinct from: > >first = next Because first works with any Iterable; next works only with iterators. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/pyth

[Python-ideas] Re: Argumenting in favor of first()

2019-12-10 Thread Andrew Barnert via Python-ideas
understand the subtleties of leaking StopIteration, or whatever). That’s a pretty different argument. (Not that there can’t be something to both arguments, of course.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to

[Python-ideas] Re: Argumenting in favor of first()

2019-12-10 Thread Andrew Barnert via Python-ideas
at way)? But I think by this point, we already have at least two answers (yours and Guido’s), it’s just a question of working out whether either one is sufficient for someone to go try to convince Raymond with it. ___ Python-ideas mailing list -- [email protected] T

[Python-ideas] Re: Argumenting in favor of first()

2019-12-11 Thread Andrew Barnert via Python-ideas
if it were called "one" instead of "first"? I’d expect one to be “like first, but raise if there are two or more elements”, because that’s what it means in a number of functional languages and database libraries, and more-itertools. __________

[Python-ideas] Re: Argumenting in favor of first()

2019-12-11 Thread Andrew Barnert via Python-ideas
ypeError. Take it away, and the standard idioms for at least two common things are no longer valid._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lis

[Python-ideas] Re: frozen dataclasses attribute initialization

2019-12-11 Thread Andrew Barnert via Python-ideas
o, what else could you do? Make __setattr__ check the stack and see if it’s being called from type(self).__post_init__? Add an extra hidden attribute to every instance just to track whether you’re inside __post_init__ so __setattr__ can check it? ___

[Python-ideas] Re: frozen dataclasses attribute initialization

2019-12-11 Thread Andrew Barnert via Python-ideas
e your fullname just by assigning to the always-mutable but private _fullname attribute, and have a readonly fullname property that uses that cache._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-i

<    3   4   5   6   7   8   9   10   11   12   >