[Python-ideas] Re: Allow kwargs in __{get|set|del|}item__

2019-10-08 Thread Andrew Barnert via Python-ideas
sue won’t be a problem in practice, but just showing methods that deal with it and remain perfectly readable makes the case a lot better. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected]

[Python-ideas] adding "port" parameter to urllib.parse.urlunparse

2019-10-09 Thread AMIR MOHAMMADI via Python-ideas
Hi. I'm a newbie and Python ideas was recommended to me as a place to go to. I think this is a good idea that have port parameter in "urlunparse" method. (refer to: https://bugs.python.org/issue38408) One way is to add keyword parameters to urlunparse, like: def urlunp

[Python-ideas] Re: Simple feature for argparse.py

2019-10-10 Thread Andrew Barnert via Python-ideas
the 3.7 version. That may be trivial, or it may require some complicated rewriting to work with 2.x (in which case it might even be worth creating a separate backport module that requires, say, 3.4+ but is easier to keep in sync with new features). _______

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-13 Thread Andrew Barnert via Python-ideas
an fixing a couple of minor things people have already learned how to deal with. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pyth

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-13 Thread Andrew Barnert via Python-ideas
what you want for the other examples is to add an `__rcontains__` method, so instead of `x in y` meaning `y.__contains__(x)`, it means either `y.__contains__(x)` or `x.__rcontains__(y)` depending on some rule that you have to define. Should it be the same rules as `__radd__`? You probably wan

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
might be better than explicit type-switching code. Or, if you have a lot of your own classes that you can modify that aren’t quite sequences but want to be pushable, you can even add your own protocol method that it checks for first. _______ Pytho

[Python-ideas] Re: Why not accept lists or arbitrary iterables in str.endswith?

2019-10-13 Thread Andrew Barnert via Python-ideas
ly thought it needed to be fixed in 2.2 or 3.0, so… why was that the wrong decision? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
Jorgensen seem to be proposing a bunch of things that already exist. It’s worth taking the time to figure out what’s already there before suggesting changes. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pyth

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
r overloads for will use those overloads; any other types will use the `push` method protocol if it exists, and it’ll raise whatever exception you want otherwise. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to

[Python-ideas] Re: Add Scalar to collections.abc with str, bytes, etc. being both Scalar and Sequence (therefore also Container)

2019-10-13 Thread Andrew Barnert via Python-ideas
’m at least +0 if you can think of any examples that would work, and should be implemented this way, but I don’t think either of these qualifies. Maybe it would help to come up with something concrete rather than an abstract toy example? _______ Python-

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
than just wanting to use it. Now that I read it more carefully… I agree 100%. :) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.p

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-13 Thread Andrew Barnert via Python-ideas
l, or Scala), either types aren’t first-class objects at all, or they’re first-class objects into a two-kinded system; they’re definitely not sets at the language level. So why should Python try to go farther than any of them? _______________ Python-ideas mailing l

[Python-ideas] Re: Why not accept lists or arbitrary iterables in str.endswith?

2019-10-13 Thread Andrew Barnert via Python-ideas
to you). Ideally your mail client lets you quote properly. If not, at least you can top-post your reply above (part of) the message you’re replying to; they all can do that. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an em

[Python-ideas] Re: Set operations with Lists

2019-10-13 Thread Andrew Barnert via Python-ideas
ty, you probably wouldn’t want the same thing I do. _______ 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 a

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
ily, without needing anything to be changed. Which implies that Python is fine as it is. :) ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-i

[Python-ideas] Re: Resolve append/add API inconsistency between set and list

2019-10-13 Thread Andrew Barnert via Python-ideas
t I’ve never thought of a need for it until this thread. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ M

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-14 Thread Andrew Barnert via Python-ideas
`1.0` when you do. But that doesn’t mean when you use it in `isinstance(1, float)` it’s the same as `1.0`. So, is `'1'` a valid way of representing the float `1.0`? Yes if you’re doing arithmetic, no if you’re doing type-switching. ___ Python-i

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-14 Thread Andrew Barnert via Python-ideas
true for the set of integers. Or for the set of Python `int` values. But that’s not what the ABC is testing for, so that’s fine. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] ht

[Python-ideas] Re: Add Scalar to collections.abc with str, bytes, etc. being both Scalar and Sequence (therefore also Container)

2019-10-14 Thread Andrew Barnert via Python-ideas
y bridge types like objc.NSString or js.String—a lot more often than I build strings out of UserString. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/ma

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-14 Thread Andrew Barnert via Python-ideas
at’ll show those fools at the academy who’s crazy. But anyway, even if you aren’t a categorist and don’t want to eliminate set theory foundations, you have to accept that they proved that `issubset(R, C)` is only false because of something about sets, not something about numbers or algebra. __

[Python-ideas] Re: Additional meanings for "in" operator and ability to customize implementation

2019-10-14 Thread Andrew Barnert via Python-ideas
On Oct 14, 2019, at 06:07, Steven D'Aprano wrote: > >> On Mon, Oct 14, 2019 at 12:54:13AM -0700, Andrew Barnert via Python-ideas >> wrote: >>> On Oct 13, 2019, at 22:54, Chris Angelico wrote: >>> >>> Mathematically, what's the differenc

[Python-ideas] Re: Add Scalar to collections.abc with str, bytes, etc. being both Scalar and Sequence (therefore also Container)

2019-10-14 Thread Andrew Barnert via Python-ideas
tter would not only (like Steven’s proposal) be unprecedented and require changes to builtin types, but also (completely unlike Steven’s proposal) be just wrong—it’s certainly not true in any useful sense that every mutable sequence is usable as a bytearray. __

[Python-ideas] Re: Add collections.abc.Struct as virtual base class of namedtuple classes and dataclass-decorated classes.

2019-10-16 Thread Andrew Barnert via Python-ideas
overloads and even custom __getattribute__. And of course you can just as easily define a regular old class and then use it as a plain-old-data struct. So, would this even be useful as a hint, much less a guarantee, of anything? ___________ Python-ideas mailing

[Python-ideas] Re: Add collections.abc.Struct as virtual base class of namedtuple classes and dataclass-decorated classes.

2019-10-16 Thread Andrew Barnert via Python-ideas
ues. That’s if anything less direct than a normal class, where you just have to access the instance’s __dict__. Finally, why are we even bikeshedding this? As Steven already explained, there’s no point in trying to nail down details for something when it’s not even remotely clear what it’s meant to be,

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-17 Thread Andrew Barnert via Python-ideas
Dict and ChainMap? (And are there any other types that need that question?) _______ 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: PEP 584: Add + and += operators to the built-in dict class.

2019-10-17 Thread Andrew Barnert via Python-ideas
archives. _______ 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@p

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-17 Thread Andrew Barnert via Python-ideas
whether * for sequences was a mistake. If you want to propose adding a `repeat` method to the sequence types and deprecating or at least lightly discouraging the use of __mul__, that seems completely unrelated to this PEP. _______ Python-ideas mailing list

[Python-ideas] Re: Add collections.abc.Struct as virtual base class of namedtuple classes and dataclass-decorated classes.

2019-10-17 Thread Andrew Barnert via Python-ideas
ings that tells you even make sense in Python._______ 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: Add collections.abc.Struct as virtual base class of namedtuple classes and dataclass-decorated classes.

2019-10-17 Thread Andrew Barnert via Python-ideas
our code better? _______ 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@pyt

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-18 Thread Andrew Barnert via Python-ideas
duck typed”, and why we have NumPy and SymPy while other dynamic languages can’t, and so on. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/pyth

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-18 Thread Andrew Barnert via Python-ideas
a facility for arbitrary in-language-defined operators). _______ 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-i

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-18 Thread Andrew Barnert via Python-ideas
C&scope=set%3Astackage) for all the meanings in the stdlib, but programs and third-party libs might define even more. But I think this all serves as more an argument for you than for the other side. :) _______ Python-ideas mailing list -- python-i

[Python-ideas] Re: Add kwdefaults parameter to function constructor

2019-10-18 Thread Andrew Barnert via Python-ideas
t unless the result is something like “the constructor segfaults”, it seems like probably it’s fine to keep doing it, and if not it’s probably a separate bug from the one you’re fixing. _______ Python-ideas mailing list -- [email protected] To unsub

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

2019-10-19 Thread Andrew Barnert via Python-ideas
plementation of it anyway if you want it. It’s also worth looking at the implementation of the various alternative enum implementations on PyPI (both the ones that pre-existed 3.4, and the ones that build on it). ___ Python-ideas mailing list --

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

2019-10-20 Thread Andrew Barnert via Python-ideas
fix in Python, or just a problem in your design or implementation that could be easily fixed to work in existing Python. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.o

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-20 Thread Andrew Barnert via Python-ideas
.__or__ exists, but Sequence.__add__ does not. I think if you end up using __or__ I’d argue for it to be added to Mapping, but if you end up using __add__… well, I don’t know why Sequence.__add__ wasn’t included, so I don’t know whether the same rationale applies to Mapping.__add__ or not

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-20 Thread Andrew Barnert via Python-ideas
whether exponentiation was ^ or ** and whether > I needed parentheses around calls to print or not. Agreed. I know that in most of the languages I occasionally use, update/merge/+/|/<https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-20 Thread Andrew Barnert via Python-ideas
it to be spelled | if it has to be added. But people who are dying for it mostly want + (except for the ones who want all the set operators). I’m not sure what that means… _______ Python-ideas mailing list -- [email protected] To unsubscribe send an emai

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-20 Thread Andrew Barnert via Python-ideas
m doing the same thing indirectly. ___________ 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.pyth

[Python-ideas] Re: Copying a multiple values of a dict to another with a lot easier syntax

2019-10-21 Thread Andrew Barnert via Python-ideas
s `with`): with adiv.style: .y = comp.y .height = comp.height I don’t think that’s really helpful here, because you have two different objects you want to shortcut, not just one. But you might want to look into past proposals to add a similar feature to Python, to see if any of

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-21 Thread Andrew Barnert via Python-ideas
that I could pass to sum and use it efficiently as a generic fold function against its will, it was pretty obvious that’s not what it was for.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Andrew Barnert via Python-ideas
parser ambiguity. What future worthwhile suggestions to that existing syntax are you imagining that might break that? Even if you’re imagining that people might want @ to be a unary prefix operator as well as a binary operator (like + and -), how does restricting decorator syntax help ambiguity t

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Andrew Barnert via Python-ideas
t’s doable it might be acceptable. The only question is whether you’d want the same error for adding instances of subclasses of dict that don’t override the method(s)—and I think the answer there is yes, you would. _______ Python-ideas mailing list

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

2019-10-22 Thread Andrew Barnert via Python-ideas
oing Perl.” _______ 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: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Andrew Barnert via Python-ideas
sing import hook. Then people could experiment with it and if someone finds real-life performance benefits, file a bug to add it to CPython (which should be a lot easier nowadays than it was a few versions ago). ___________ Python-ideas mailing list -- pyt

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

2019-10-23 Thread Andrew Barnert via Python-ideas
be a small QoI thing that adds to Python 3.9 being on average a bit faster than 3.8. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python

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

2019-10-23 Thread Andrew Barnert via Python-ideas
’s come up with a whole new syntax that does the same thing”. _______ 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: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-23 Thread Andrew Barnert via Python-ideas
;.splitlines() … gave you a list of one string that contains new lines instead of a list of three strings that don’t. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pytho

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-23 Thread Andrew Barnert via Python-ideas
On Oct 23, 2019, at 16:00, Christopher Barker wrote: > >> On Sun, Oct 13, 2019 at 12:52 PM Andrew Barnert via Python-ideas >> wrote: > >> The main problem is that a str is a sequence of single-character str, each >> of which is a one-element sequence of itself,

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

2019-10-23 Thread Andrew Barnert via Python-ideas
the str class. You can’t document something as a method of Unicode strings that splits on “whitespace” using anything other than a Unicode definition of whitespace is without a good reason. _______ Python-ideas mailing list -- [email protected] To un

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

2019-10-23 Thread Andrew Barnert via Python-ideas
ey can be Z but not Zs. Anyway, some of the answers the Unicode committee came up with are odd, but they’re the right answers by definition. Plus, even if I had a time machine and an unlimited life span, I’m pretty sure I wouldn’t want to participate in those arguments. _______

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

2019-10-23 Thread Andrew Barnert via Python-ideas
On Oct 23, 2019, at 22:45, Greg Ewing wrote: > > Andrew Barnert via Python-ideas wrote: >> Someone earlier in this thread said we could optimize calling split on a >> string literal, just as we can and do optimize iterating over a list literal >> in a for statement. >&

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-24 Thread Rob Cliffe via Python-ideas
w is that this argument might sort of work now but didn't work before mypy et al existed. / Anders _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ide

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-24 Thread Andrew Barnert via Python-ideas
live with either. _______ 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: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-24 Thread Andrew Barnert via Python-ideas
hink it really is primarily about them being iterables of strings. _______ 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 a

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-25 Thread Andrew Barnert via Python-ideas
On Oct 25, 2019, at 01:34, Paul Moore wrote: > > On Thu, 24 Oct 2019 at 23:47, Andrew Barnert via Python-ideas > wrote: >> But again, I don’t think either of these is the reason Python strings being >> iterable is a problem; I think it really is primarily about them b

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-25 Thread Andrew Barnert via Python-ideas
On Oct 25, 2019, at 06:26, Serhiy Storchaka wrote: > > 25.10.19 15:53, Andrew Barnert via Python-ideas пише: >> If you were designing a new Python-like language today, or if you had a time >> machine back to the 90s, it would be a different story. > > Interesting, how f

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-25 Thread Andrew Barnert via Python-ideas
(See RipGrep, which uses Rust’s ability to do this to make regex searching large files both faster and simpler at the same time, if it’s not obvious why this is nice.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email t

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-26 Thread Rob Cliffe via Python-ideas
On 24/10/2019 18:19:27, Andrew Barnert via Python-ideas wrote: On Oct 23, 2019, at 23:47, Inada Naoki wrote: But if we use + for dict merging, I think we should add + to set too. Then the set has `.union()`, `|` and `+` for the same behavior. I don’t think we really need that. If set and

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-26 Thread Andrew Barnert via Python-ideas
On Oct 26, 2019, at 16:28, Steven D'Aprano wrote: > >> On Sun, Oct 13, 2019 at 12:41:55PM -0700, Andrew Barnert via Python-ideas >> wrote: >> On Oct 13, 2019, at 12:02, Steve Jorgensen wrote: > [...] >>> This proposal is a serious breakage of backward com

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-27 Thread Andrew Barnert via Python-ideas
same time. There’s no need for the string type itself to do 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 arch

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-27 Thread Andrew Barnert via Python-ideas
etimes work.) _______ 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/p

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-27 Thread Andrew Barnert via Python-ideas
> On Oct 27, 2019, at 05:38, Steven D'Aprano wrote: > >> On Sun, Oct 27, 2019 at 12:10:22AM -0700, Andrew Barnert via Python-ideas >> wrote: >> >> If you redesign your find, re.search, etc. APIs to not return >> character indexes, then I think you c

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-27 Thread Andrew Barnert via Python-ideas
ying to “fix” strings in “Python 4000” in the first place is that the right fix probably cannot be done in a way that’s remotely feasible for backward compatibility. So I hope you wouldn’t expect that something additional that I suggested could be considered only if that unfeasible fix we

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-27 Thread Andrew Barnert via Python-ideas
ld be, and if you don’t raise exceptions in a bottleneck, it probably doesn’t matter that you’ve made them more than twice as slow to raise, and you won’t be breaking any builtin or library code that expects it to be faster because that code is still using raise statements. ______

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-27 Thread Andrew Barnert via Python-ideas
hat, and we really do need to change the language to allow raise in expressions, it should be done like yield, not like print. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] ht

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-10-27 Thread Andrew Barnert via Python-ideas
On Oct 27, 2019, at 18:00, Steven D'Aprano wrote: > > On Sun, Oct 27, 2019 at 10:07:41AM -0700, Andrew Barnert via Python-ideas > wrote: > >>> File "/home/rosuav/tmp/demo.py", line 1 >>> print("Hello, world!') >>>

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-28 Thread Andrew Barnert via Python-ideas
-necessary-and-incredibly-handy-when-that-happens for installed packages as for in-place submodules._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.py

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-28 Thread Andrew Barnert via Python-ideas
it today as it would be if we added it to the docs somewhere or even included it somewhere in the stdlib, and trivial to use once you find it, so i don’t think we need to bend over backward to make it easier. _______ Python-ideas mailing list --

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-28 Thread Andrew Barnert via Python-ideas
On Oct 28, 2019, at 14:23, Serhiy Storchaka wrote: > > 28.10.19 20:38, Andrew Barnert via Python-ideas пише: >> Many of them are abusing throw(StopIteration) to fake a “takewhile clause” >> in comprehensions > > Well, so actually you needed the break expre

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-29 Thread Andrew Barnert via Python-ideas
If you actually need this behavior for some reason, you usually want to call importlib directly and avoid using the sys.modules cache. But usually you don’t want this behavior. See the docs on the import system (https://docs.python.org/3/reference/import.html)for full details on how this wor

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-29 Thread Andrew Barnert via Python-ideas
es (packages that can be added to by other packages); I believe it works that way for historical reasons that go back to the way you faked it in 2.x with a third-party library. _______ Python-ideas mailing list -- [email protected] To unsubscribe

[Python-ideas] Re: add a .with_stem() method to pathlib objects

2019-10-29 Thread Andrew Barnert via Python-ideas
except FileExistsError: pass ___________ 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@pyth

[Python-ideas] Re: add a .with_stem() method to pathlib objects

2019-10-29 Thread Andrew Barnert via Python-ideas
d to rather than replaced. So, the OP’s first implementation would be the right one, not his second. Hopefully that doesn’t contradict what you’d want from the OP’s use case. :) ___________ Python-ideas mailing list -- [email protected] To unsub

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-29 Thread Andrew Barnert via Python-ideas
r. Some of these have a confusing path, some have no path at all. They do always have a loader spec, which could theoretically serve the same purpose. But modules don’t remember the loader spec used to load them. Plus, loader specs, unlike names, are a low-level detail that most Python developer

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-29 Thread Andrew Barnert via Python-ideas
Plus, there’d be a ready-to-use backport for people who want to use the feature but don’t want to require Python 3.10. If it doesn’t cover everything, you could definitely implement spam = twin.import('spam'), but that’s obviously not nearly as nice to use. ______

[Python-ideas] Re: Suggestion for behaviour change import mechanics

2019-10-30 Thread Andrew Barnert via Python-ideas
, you can already shadow any stdlib or other module completely. _______ 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 a

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-31 Thread Andrew Barnert via Python-ideas
couple third-party libraries (over the decades) that had to be patched to work in a non-CPython interpreter because of it. If everyone is doing it wrong because it’s too hard to do it right, it seems like it’s worth making it easier to do it right. ___

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-31 Thread Andrew Barnert via Python-ideas
efit of removing the statement? _______ 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.o

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-10-31 Thread Andrew Barnert via Python-ideas
More flexible isn’t always more useful. I’m not convinced that people really do frequently need to raise in the middle of an expression. And performance is far from the only consideration—there’s backward compatibility, and looking like flow control, and so on. None of which are an issue for a

[Python-ideas] Re: Allow Path object instances in subprocess.Popen

2019-11-03 Thread Andrew Barnert via Python-ideas
t as well as being able to search for your “https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/VIKWLWLDX3JKQOUGEUZ3EOX5T5JL7YBJ/ Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-11-03 Thread Andrew Barnert via Python-ideas
On Nov 2, 2019, at 21:02, Random832 wrote: > >> On Sun, Oct 27, 2019, at 19:17, Andrew Barnert via Python-ideas wrote: >>> On Oct 27, 2019, at 15:07, Ben Rudiak-Gould wrote: >>> >>> throw is an expression, not a statement, in C++. I see no reason raise >

[Python-ideas] Re: Python 4000: Have stringlike objects provide sequence views rather than being sequences

2019-11-03 Thread Andrew Barnert via Python-ideas
ate special-purpose variants for special strings (I know this is always ASCII, or I know it’s always under 16 chars…) or specific use cases (I know I’m going to iterate backward, so repeatedly counting forward from index[idx%16] would be hugely wasteful). But if str builds an index, there’s no way

[Python-ideas] Re: Allow Path object instances in subprocess.Popen

2019-11-03 Thread Andrew Barnert via Python-ideas
done quick&dirty debugging by printing out a bunch of intermediate variables. If that could raise and ruin your debug session, wouldn’t that be very frustrating? In fact, we don’t have to guess; anyone who ever used Python 2 on Windows, where printing out a unicode would often rai

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-11-03 Thread Andrew Barnert via Python-ideas
ng a raise_expr PEP and can be added even in the initial version.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at http

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-11-03 Thread Andrew Barnert via Python-ideas
general expression instead of a heavily restricted one, -1 on making it a magic function (or anything else that’s not backward compatible) instead of syntax, and -0.5 on leaving it as a statement but adding throw to the stdlib somewhere. _______

[Python-ideas] Re: foo.setParseAction(lambda a, b, c: raise FuckPython(":("))

2019-11-05 Thread Andrew Barnert via Python-ideas
tainly seems true in your use case, where your goal (making a sync function async) has nothing to do with exceptions, and the only reason you thought of resumable exceptions was, effectively, as a way to clumsily simulate callcc. _______ Python-ideas mailing

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

2019-11-06 Thread Andrew Barnert via Python-ideas
On Nov 6, 2019, at 01:46, martin_05--- via Python-ideas wrote: > > > Still, the idea of two assignment operators just didn't sit well with me. > That's when I realized I had seen this kind of a problem nearly thirty years > ago, with the introduction of "J&

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

2019-11-06 Thread Andrew Barnert via Python-ideas
So it’s definitely not worth 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/

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

2019-11-06 Thread Martin Euredjian via Python-ideas
lver in APLhttps://www.youtube.com/watch?v=DmT80OseAGs -Martin On Tuesday, November 5, 2019, 11:54:45 PM PST, Richard Musil wrote: On Wed, Nov 6, 2019 at 5:32 AM martin_05--- via Python-ideas wrote: In other words, these two things would have been equivalent in Python:     a ← 23

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

2019-11-06 Thread Martin Euredjian via Python-ideas
future. AI and ML, if anything, will allow us to define the problems we want to solve in something much closer to natural language and let the computers figure out how that translates to code. What kind of code? Python? C++? APL? x86? RISC-V? Who cares?! That's all I have time

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

2019-11-06 Thread Andrew Barnert via Python-ideas
On Nov 6, 2019, at 19:52, Mike Miller wrote: > >> On 2019-11-06 05:40, Andrew Barnert via Python-ideas wrote: >> While we’re at it, when you replace both = and := with an arrow, what do you >> do with += and the other augmented assignments? I can’t think of a >> s

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

2019-11-06 Thread Martin Euredjian via Python-ideas
n with many people in the 30+ years since I learned APL and 20+ years since I stopped using it professionally.  Oh, really? You programmed APL for 10 years?! Did you go to Yale Mr. Kavanaugh? You can cut the arguments from Authority. They're worth nothing. Look, we don't have to a

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

2019-11-06 Thread Andrew Barnert via Python-ideas
On Nov 6, 2019, at 21:53, Martin Euredjian via Python-ideas wrote: > > I've had this kind of a conversation with many people in the 30+ years since > I learned APL and 20+ years since I stopped using it professionally. It has > been my experience that people who have not h

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

2019-11-06 Thread Martin Euredjian via Python-ideas
never noticed before this that the two main text notations for music have the same name as Python’s predecessor and Python’s creator. Probably not significant…) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pytho

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

2019-11-06 Thread Andrew Barnert via Python-ideas
On Nov 7, 2019, at 01:04, Martin Euredjian via Python-ideas wrote: > > >> No professional thinks that "a = some_object" results in a bucket being > >> filled with whatever the object might contain. > > That's exactly how variables work in many c

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

2019-11-06 Thread Martin Euredjian via Python-ideas
e gone differently if the Mayans had a say. It has been my experience that people who have not had the experience rarely get it A pattern I've seen in my experience is that some person or group will put forth a pretty good idea, and others become dogmatic about that idea, loose sight of pra

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

2019-11-07 Thread Martin Euredjian via Python-ideas
difference being that these words are far more powerful and easily represent tens to hundreds of lines of code with conventional languages. Thanks, -Martin ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ide

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

2019-11-07 Thread Andrew Barnert via Python-ideas
fully designed by half the core APL team. If he hates that, I’m pretty sure he wouldn’t be happy with Sinclair APL. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.py

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

2019-11-07 Thread Andrew Barnert via Python-ideas
act that you can touch type them into Mail.app and pine and a StackOverflow answer box and a blog comment and a general purpose text editor and get the exact same result you get in PyCharm or PyDev. That’s a pretty huge difference, which the OP is ignoring. _____

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