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]
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
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).
_______
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
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
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
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.
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
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
’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-
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
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
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
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
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
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
`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
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
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
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.
__
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
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.
__
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
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,
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
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
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
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
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
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
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
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
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
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 --
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
.__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
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
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
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
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
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
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
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
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]
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
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
’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/
;.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
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,
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
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.
_______
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.
>&
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
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
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
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
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
(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
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
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
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
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
> 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
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
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.
______
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
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!')
>>>
-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
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 --
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
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
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
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
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
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
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.
______
, 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
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.
___
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
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
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/
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
>
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
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
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
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.
_______
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
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&
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/
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
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
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
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
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
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
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
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
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
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
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.
_____
601 - 700 of 1693 matches
Mail list logo