e that can be used to fake that), and a way to easily create a
pre-hooked REPL, which together are all you need to write this as an external
library.
In fact, this seems almost tailor made as a perfect first use case for André’s
ideas import-hook-helper library: https://github.com/aroberge/ideas
_
On Mar 5, 2020, at 02:11, Steve Barnes wrote:
>
> Comments in-line (I wish Outlook would behave sensibly)
>
> -Original Message-
> From: Paul Moore
> Sent: 05 March 2020 09:52
> To: Steve Barnes
> Cc: [email protected]
> Subject: Re: [Python-ideas]
gt;for B in C.__mro__:
>if B in cls._explicit_only_registry:
>return NotImplemented
>
>return cls._check_overrides_rich_comparison_methods(C)
>
>@classmethod
>def _check_overrides_rich_comparison_methods(cls, C):
>mro =
On Mar 5, 2020, at 08:27, Christopher Barker wrote:
>
>> On Wed, Mar 4, 2020 at 8:13 PM Andrew Barnert via Python-ideas
>> wrote:
>
>> Sorry, I thought I was replying to something from today, not a year ago.
>
> Which is fine — that conversation kind of p
r
> Raised when an operation or function is applied to an object of inappropriate
> type.
etc. It's never stated that TypeError should be raised when the number
of arguments is invalid, for example. It seems that TypeError itself
is saying "now I'm used outside my scope" :-)
, and 64 other characters have the
same byte invisibly as their second byte.)
Things that are not even that ASCII-compatible include UTF-16, EBCDIC code
pages, 80s Atari encoding, etc.; they are not commonly used in real-world UNIX
systems. Which I think was Random’s point._______
and libc functions and most third-party functions just take a
null-terminated string, meaning they silently truncate right after the first
Latin-1 character, and your string is exactly one Latin-1 character long.
___
Python-ideas mailing list
he wild for str,
but has anyone found examples of people doing it for bytes?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas
ike much of a problem, much less a problem worth breaking fundamental
truthiness for a builtin type.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists
y
surprised me. I had to add a boolean() function in my little msutils
module, that works also for ndarrays.
And the reason ndarray do this is because it also override __eq__():
https://github.com/numpy/numpy/issues/15573
_______
Python-ideas mailing list --
ove x` might be more understandable, but adding new keywords is expensive
>
> ## Optional extension
>
> For consistency, `x = (del foo.attr)` and `x = (del foo[i])` could also
> become legal expressions, and `__delete__`, `__delattr__`, and `__delitem__`
> would now have
On Thu, Mar 12, 2020 at 5:50 AM Marco Sulla via Python-ideas <
[email protected]> wrote:
> Actually, this is the behaviour of ndarray with any dtype. And IMHO
> ithis is quite terrible?
I can see how you would think that. But the fact is that element-wise
operations are ve
ements
collections.abc.Sequence, even if it's really not true. Like dict:
>>> help(dict)
Help on class dict in module builtins:
class dict(object)
[...]
>>> issubclass(dict, MutableMapping)
True
_______
Python-ideas mailing list -- p
sn’t.
But not allowing it at all seems even more confusing. Python grammar doesn’t
have a bunch of different rules for “target” for different contexts, and the
few special cases it does have, people always want to un-special them the first
time they run into them.
_____
's a
reference that can't be deleted, until the current scope is not
finished.
This in practice will break `del variable`
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://m
mprehensions, so there’s no
difference to learn, understand, and remember.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.
On Mar 12, 2020, at 10:52, Marco Sulla via Python-ideas
wrote:
>
> On Thu, 12 Mar 2020 at 18:19, Chris Angelico wrote:
>> No, it wouldn't - the use of the value as a return value counts as a
>> reference. It's exactly the same as any other function that returns a
ble? The change you linked was done
specifically for ndarrays, that you know they are immutable. How can
Python know that an object is an immutable?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-l
ns have to start off flagged,
but then values created and used internally by numpy won’t look temporary to
numpy, right?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.p
on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import getrefcount
>>> a = "nfnjgjsbsjbjbsjlbslj"
>>> getrefcount(a)
2
>>> a
'nfnjgjsbsjbjbsjlbslj'
>>>
for large immutables.
The problem is: how?
_______
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
ementation, but I don't know where and what to search.
_______
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
o strings into a
single object, and the CPython interpreter can intern strings at runtime,
because this is guaranteed to be safe, but obviously neither can do the same
thing for arbitrary objects.
_______
Python-ideas mailing list -- [email protected]
l is that `(del bc) + d` would enter `bc.__add__(d)` with
> `self` passed with a refcount of 1.
So your proposal doesn’t help their problem. At best, it gives them the same
behavior they already have, which they still need to optimize.
_______
Python-ideas
On Thu, 12 Mar 2020 at 18:42, Andrew Barnert via Python-ideas
wrote:
> What if a for loop, instead of nexting the iterator and binding the result to
> the loop variable, instead unbound the loop variable, nexted the Iterator,
> and bound the result to the loop variable?
I missed that.
this feature for __all__ Python objects. Maybe for
immutable ones, but it should be done one by one, I suppose, since
there's not an "immutable iterface".
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to
hon 3.7 (hey, what about "no more
breaking changes?" :-P)
___________
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
On Mar 12, 2020, at 14:32, Marco Sulla via Python-ideas
wrote:
> On Thu, 12 Mar 2020 at 21:22, Chris Angelico wrote:
>> They actually ARE already discarded
>
> 0O
> You're right. So *how* can juliantaylor said he measured a speedup of
> 2x for large ndarrays?
e. Only if the element of the iterable are __really__ big it
could be a little improvement, but I suppose it will slow down all the
other comprehensions (as Barnert already pointed out).
___________
Python-ideas mailing list -- [email protected]
To un
On Mar 12, 2020, at 13:22, Marco Sulla
wrote:
>
> On Thu, 12 Mar 2020 at 18:42, Andrew Barnert via Python-ideas
> wrote:
>> What if a for loop, instead of nexting the iterator and binding the result
>> to the loop variable, instead unbound the loop variable, nexted
???
We are saying the same thing.
On Thu, Mar 12, 2020 at 11:18 AM Marco Sulla via Python-ideas
wrote:
> This speedup is observed only for large objects
On Fri, 13 Mar 2020 at 00:45, Ben Rudiak-Gould wrote:
> it's only beneficial to try it when the array
Deleting Thing(abcd) - ID: 140185716001088
As you can see, Thing(abcd) has the same id of Thing(ab). So what Eric
Wieser wanted is already implemented in Python, for temporary objects.
_______
Python-ideas mailing list -- python-ideas@python.
observations are done by benchmarks. In the
real world, how can you be sure that L2 cache is not already filled
up? :-)
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https
real life numpy code.
But those benchmarks are for a patch to numpy that’s only vaguely similar to
this proposal, and neither requires it nor could benefit from it, so…
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email
> Well, probably it depends by two possible errors:
>
> 1. sometimes I send directly to [email protected]. This way my
> real address is used, and the system does not recognize it. I saved
> the "correct" address to my contact list, so now it's more simple to
> not
ot; for more information.
>>> r'x\'y'
"x\\'y"
>>> list(_)
['x', '\\', "'", 'y']
(Apologies for the double vertical spacing, I'm wrestling with my email
server.)
Rob Cliffe
_
die. If not, then I think the collections docs should at least link to Sorted
Containers and any other relevant libraries.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.py
e sense according to the
same model, and should agree with C99. (I haven’t actually tested that…)
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-idea
> On Mar 16, 2020, at 00:13, Ben Rudiak-Gould wrote:
>
> On Sun, Mar 15, 2020 at 9:41 PM Andrew Barnert via Python-ideas
> wrote:
>> Do you really want to require “binary”?
>
> I don't think so; they never talked about binary trees, only "binary
> search
at don’t
match our float semantics in fundamental ways and that are derived in a more
complicated way with unmotivated special cases instead of the natural way that
falls out of any of the usual constructions of C in mathematics, that’s not
really “maximum generality” you’re asking for, but
looking first.
At any rate, I still stand by the point that nobody is going to expect O(1)
copies for sorteddict when list, dict, etc. don’t do it.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-idea
ce to provide an API for it more
> directly.
>
> Which, it turns out, SortedDict does, in fact, do:
Yes, and it also includes things like key-slicing (“get the values for all keys
a<=keyhttps://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail
implementation just inherits dict
(because it’s not a tree of items, it’s a tree of keys on top of a plain old
dict). Which also means it requires keys that are _both_ hashable and
weak-ordered…___________
Python-ideas mailing list -- [email protected]
To
olutely no offence to anyone involved.
Rob Cliffe
On 16/03/2020 17:33, Andrew Barnert via Python-ideas wrote:
On Mar 16, 2020, at 02:54, Stephen J. Turnbull
wrote:
Andrew Barnert writes:
Well, there are an infinite number of ever larger infinite
ordinals, ω or ω_0 being the first one, and l
es of course]
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/archives/list/python
t, by adding whatever code you
want that gets run before and after the statement.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-idea
On Mar 19, 2020, at 06:23, Stephen J. Turnbull
wrote:
>
> Andrew Barnert via Python-ideas writes:
>
>> [A] context manager seems perfect. It allows you to hint any
>> statement, including a loop statement, by adding whatever code you
>> want that gets run bef
On Mar 19, 2020, at 11:29, Marco Sulla wrote:
>
> On Mon, 16 Mar 2020 at 22:22, Andrew Barnert via Python-ideas
> wrote:
>> I think the best solution is to just not have a SortedList. C++, Java, etc.
>> don’t provide anything like that
>
> Guava has TreeMultiset:
&
06 PM Rob Cliffe via Python-ideas
mailto:[email protected]>> wrote:
Consider that the start or end of a string may contain repetitions
of an
affix.
Should `-+-+-+Spam'.stripprefix('-+') remove just the first
occurence?
All of them? Does it n
ged semantics? And then, if you used
_tojson, you can add the stdlib’s __json__ and the same module works as the
backport of the 3.10 stdlib to older versions and as the more-featureful
third-party module some people still need.
_______
Python-ideas mail
thing it is a superset of),
but I think there would be more danger of confusion with this new method.
+0 on the proposal
Rob Cliffe
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https
perfectly coherent request, and of course arbitrary iterables are
relevant to it. The question is why anyone would ever need that method. If
someone has a use case for it, they should be able to post it easily.
_______
Python-ideas mailing list -- python-id
the Cygwin Python 3 package install something named python3 that’s on
the (Cygwin) PATH, same as on your *nix systems?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.pytho
nsitive equality, substring, etc. testing, none of which
Python has, or should have, as long as its strings are made of code points
rather than scalars (or EGCs or whatever).
___
Python-ideas mailing list -- [email protected]
To unsubscribe send
to compare sets.
(Perhaps issubset/issuperset should not accept non-set iterables, but
that ship has sailed.)
Rob Cliffe
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3
ible sequence” a sensible thing, corporate team, a
much worse status quo ante where strings were sequences of UTF-16 code units, a
need to interface natively with Cocoa and its NFKD decomposed strings, …). For
Python, it seems like if nobody’s put anything (other than thin wrappers around
you’re right that it’s rare enough (and easy enough to work around) that we
don’t need to add anything in the first place.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://m
define
everything, including lists, as sets, so picking one common set of definitions
arbitrarily, {1,{1,{2,{2,3 = [1,2,3] is actually true. But that isn’t
relevant, and wouldn’t be relevant even if all mathematicians were always
worried about foundations and always used those particular def
On 23/03/2020 23:49, Steven D'Aprano wrote:
On Mon, Mar 23, 2020 at 02:05:49PM +, Rob Cliffe via Python-ideas wrote:
s = set("a")
t = list("aa")
s.issubset(t)
True
s.issuperset(t)
True
but it would be misleading IMO to say that s and t are in some sense
equ
) follows the Python-on-Unix naming PEP as well as
whichever linux distro inspires its packaging.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/l
itten
code is uncommon but does exist, and may take a bit more work to optimize than
a 1-line change to optimize, but that’s acceptable—and not the responsibility
of any alternate Python implementation to help with.
___
Python-ideas mailing list -- python-ideas@p
ed into
it before the 3.3 string redesign; I don’t know if anyone has since), but it’s
still probably a major change.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail
xamples, it’s hard not to call the string concatenation optimization a win.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.p
d build a
minimal “ucs4array” class with a C accelerator and then build most of the str
API on top of that in pure Python. (Or, if you want the space efficiency of
CPython strings, you need ucs1/ucs2/ucs4array types and a str that switches
between them.)
________
ead
of one (with the new one less efficient and more complicated) would not be an
improvement.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas
might
> lead to it too.)
The problem isn’t your start, it’s jumping to the assumption that StringIO must
be an answer, and then not checking the docs and the code to see if there are
problems, and then ignoring the problems when they’re pointed out. Why do you
think a virtual file object
On Mar 30, 2020, at 22:03, Steven D'Aprano wrote:
>
> On Mon, Mar 30, 2020 at 01:59:42PM -0700, Andrew Barnert via Python-ideas
> wrote:
>
> [...]
>> When you call getvalue() it then builds a Py_UCS4*
>> representation that’s in this case 4x the size of the fin
, it’s
hard to know which is the case here. So can you explain why this is a problem
for you?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailma
=
>
> The author promises to provide a reference implementation for Python
> 3.10,
> should this PEP be accepted.
>
>
> References
> ==
>
> .. _worldindata: https://ourworldindata.org/meat-production
> .. _Python code of conduct: https://www.python.org/psf/conduct/
> ..
’t get silly.
___
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@python
ants or a tiger you were dealing with. Which is why we
should all hunt and eat redwood trees rather than cows or bananas. And don’t
even get me started on sunflowers.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email
just
in theoretical possible implementations of Python but in multiple real life
implementations, including CPython.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https
it’s always been easier to
show a newcomer to Python the point of for/else with a nice example than to try
to explain the semantics and why they’re useful, and I assume the same would be
true here.
_______
Python-ideas mailing list -- [email protected]
uot;.
>
> Should we deprecate the word "wheel" as well, since it's a
> reference to cheese?
If the Cheese Shop doesn’t actually have any cheese in stock, is it actually
offensive to cows?
_______
Python-ideas mailing list -- python-idea
nsequence of the accident that
our script has only two classes of letter case. I’m not aware of any human
scripts that have three or more classes, but do we really want a language
that’s limited to human use only?_______
Python-ideas mailing list -- python
ring to UTF-8 when you write and then
decoding back at the end. At which point you’re probably ready to give up on
Python altogether.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@python.
t do you get? You presumably don’t even need to look that up or try
it out. It would be pretty confusing if it were different without the tuple.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ht
where you plan to
print out that repr, how you’d like to specify it within the module source, etc.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists
with a C implementation—it
can just check if CPython and if so use a str as its buffer… but for a builtin
member of a stdlib module, that’s probably not acceptable.)
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email t
On Apr 2, 2020, at 13:35, Abdur-Rahmaan Janhangeer wrote:
>
>> On Thu, Apr 2, 2020 at 8:15 PM Andrew Barnert wrote:
>>
>> Why should modules break all of that, and be different from strings, tuples,
>> functions, classes, etc.?
>
> python-ideas is
fore they’re
proposed for inclusion (and then converted into a backport after inclusion).
Although again, the process should be a lot easier with macaddress than with
something as complicated as regex or as unprecedented as tulip.
___
Python-ideas mailing li
e helpful.
_______
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
looks like for the last decade its needed less than one
bugfix or feature per year for dealing with MAC/EUI addresses…
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mai
> On Apr 5, 2020, at 20:12, Stephen J. Turnbull
> wrote:
>
> Andrew Barnert via Python-ideas writes:
>
>> However, I think that a macaddress library could easily be one of
>> the few things that does properly fit in the networking section of
>> the stdlib. It
f course JSON isn’t perfect, as anyone who’s tried to interchange, say, int64
values discovers… but it’s good enough for many applications.)
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-i
ch instead of a method protocol. Have a bunch of
existing code from another project that used simplejson? Use its tojson
protocol, and you don’t need to fork every class just to change the name. And
so on.
___________
Python-ideas mailing list -- python-ideas@pyt
. Either way seems like it makes sense.
A schema generator for dataclasses, I think you’d want it to use the typing
information. A MyClass property a doesn’t just have an attribute of {“type”:
“array”}; it has a {“type”: “array”, “contains”:
recursively_schematize(A_Type)}.________
ing bound to something to do with f.
_______
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/l
ns add is JSON serialization that’s human
readable/editable, or computer verifiable, or both. You don’t need JSON-LD
unless you’re not just building APIs, but meta-indexes of APIs or automatic API
generators or something.
_______
Python-ideas mailing list -- pyth
y do, and then undo if the guard triggers, which was I think his
key 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/
Message
a, and so on. All of which are useful.
___________
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
nd that’s also fine.
Would it better serve the needs of the semantic web if the email format were a
mandatory rather than optional part of the spec and everyone were required by
law to always use it when storing email addresses? Maybe. But neither of those
things are true.
____
d see if there are any cases where it’s useful, but only with the
restrictions relaxed, and maybe use that as a guide to whether it’s worth
finding a way to aim for looser restrictions in the first place or not.
_______
Python-ideas mailing list -- py
ore complicated than in CPython.
But the PyPy guys seem to be really good at figuring out how to test such
questions empirically.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
htt
unting completely disabled) in C and other
languages, and there’s no reason (if you’re really careful) it couldn’t work in
Python. But it’s certainly not the behavior you’d want from a general-purpose
Python implementation.___
Python-ideas mailing list -
or that your tone doesn’t fit the style
or the Python community, or whatever, I don’t think so. Look at the proposal to
change variable deletion time—that’s gotten a ton of pushback, and it’s
certainly not because nobody respects Guido or nobody likes him.
______
ason those functions are
in itertools rather than builtins.) But those are unusual cases. Which means
they usually deserve to be called out. A change that makes it look less visible
and less unusual would actually be counterproductive.
_______
Python-idea
nts in
there or any flow control besides the linear-nested clauses. That doesn’t apply
to nested blocks.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org
would be different if it were invented today.)
_______
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
ht
anyway. But for the vast majority of code,
they’re both great.
_______
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
1001 - 1100 of 1693 matches
Mail list logo