As I introduced (a long time ago) this demand, let me add my grain of salt
here.
The use case is pretty simple, and somewhat common when writing manually C
extension class: The reason to write extension class is usually
performance, or link into an existing library.
When doing this manually (inste
e a heap type?
>
> On Wed, Jun 27, 2018 at 2:05 AM Greg wrote:
>
>> As I introduced (a long time ago) this demand, let me add my grain of
>> salt here.
>>
>> The use case is pretty simple, and somewhat common when writing manually
>> C extension class: The reaso
ject and call it later,
with the same effect as if I'd called it directly.
I wouldn't want that to change. Fortunately, it never will,
because changing it now would break huge amounts of code.
--
Greg
___
Python-ideas mailing list -- python-id
t see how we can get any more in this area than we
already have, without making (a.b)() have different
semantics from a.b() -- which is extremely unlikely to
to ever happen.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe sen
e strict mode
doesn't really make any "revolutionary" changes. It just exposes,
emphasizes, and makes consistent, the properties Python language
already has. Ain't that cute? Do you spot any issues, Greg?
So you *don't* intend to make any semantic changes?
I'm sti
On 18/12/20 1:52 am, Paul Sokolovsky wrote:
On Fri, 18 Dec 2020 01:23:34 +1300
Greg Ewing wrote:
On 17/12/20 11:25 pm, Paul Sokolovsky wrote:
a) (a.b)() syntax
b) apply() being resurrected
I can't answer that without knowing what alternative semantics
you have in mind for (a.b)()
import random
n = random.choice([1,2,3])
would have to be written:
import random
n = (random.choice)([1,2,3])
I would find that quite unpleasant.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-l
A()
def f(x, y):
return x.choice(y)
print(f(random, [1, 2]))
print(f(a, ["buckle", "my shoe"]))
How much of this is allowed under your restricted semantics?
--
Greg
___
Python-ideas mailing list -- [email protected]
T
minimally
disruptive when True and False were first introduced,
It would have been just as disruptive back then -- that's the
reason bool was made a subclass of int in the first place.
--
Greg
___
Python-ideas mailing list -- [email protected]
() method that returns an iterable (pf
pairs of objects).
It seems to me it would be more fundamental to use iteration to get
the keys and indexing to get the corresponding values. You're only
relying on dunder methods then.
--
Greg
___
Python-ideas ma
On 27/12/20 3:03 pm, Chris Angelico wrote:
But that would mean that a lot of iterables would look like mappings
when they're not.
In the context of ** you're expecting a mapping, not a sequence.
--
Greg
___
Python-ideas mailing list -- py
y more akin to the infamous
"file-like object" which is whatever it needs to be for the purpose
at hand?
Guido has since said that the ABCs are intended to be definitive,
but the docs don't really make that clear either. (And the ABC doc page
talks about "APIs", not "proto
t -- there are other syntactic situations that use
the iterator protocol, e.g. unpacking assignments. But there should
at least be links to it from all the places it's used.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscrib
t think so. All the logic for dealing with cycles is buried
inside pickle -- __getstate__ just gets info about one object.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@python
)))
Making `reversed(itertools.chain(x, y, z))` do this would be a
backwards incompatible change.
Also it's hard to see how it could be made to work, because the
argument to reversed() necessarily has to be a sequence, not an
iterator.
--
Greg
___
Python-
into
sequences of characters:
>>> list(itertools.chain("abc", "def"))
['a', 'b', 'c', 'd', 'e', 'f']
--
Greg
___
Python-ideas mailing list -- python-ideas@py
with
*specification*. How is it supposed to know when you want
a negative index without reading your mind?
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.pyth
to indent
by 4 spaces. I often write Python with 2-space indents,
which is quite readable and gives me twice as many
indentation levels to play with.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to pytho
mous functions, so
it feels sort of tacked on.
I'm not arguing for or against anything here, just exploring
possible reasons why the idea of lambda-replacement comes up
so often.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsu
a mistake transcribing a mathematics paper many years ago." :-)
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.o
aning has to be taught in any case,
though.
--
Greg
___
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
d you get to give it a name that
reflects what you're really doing with it. I don't understand
why there's such a fascination with things like SimpleNamespace.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe sen
On 18/02/21 3:38 am, MRAB wrote:
So a "byte" is part of a word (a word contains multiple characters).
In the Burroughs B6900 architecture, programs consisted
of 48-bit words broken up into 8-bit opcodes called "syllables".
--
Greg
cause Ruby's equivalent
of things like the iterator protocol work by passing in a block
of code representing the loop body, so having an easy way to
write that is important.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscri
On 2/03/21 7:01 am, [email protected] wrote:
Currently, the only way to concatenate an integer to a bytes object is by
converting the integer to bytes with a function call before concatenating.
No, it's not:
>>> b = bytearray()
>>> b.append(42)
>>
You can also use typing.cast for the handful of cases where your particular
type checker (e.g. MyPy) fails to refine the type properly in a case like the
following:
def lookup_usernames(db, user_ids: Optional[List[int]] = None) -> List[str]:
if user_ids is None:
return []
file() would pass along its kwargs to open(), and the user could
use lambda, partial, or write a utility function to customize the loader itself.
If we are really really leery of adding a new top-level builtin, you could
namespace it under a "loadfile" module:
from loadfile import lo
Which doesn't help unless the language allows leading commas that
are ignored, and I've never seen a language like that.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@p
tatic analysis can work out what class of object a name
refers to, and what methods and attributes it has, it can
generate code that is just as efficient.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ide
y is a thing. If your Python data
structure is bigger than your RAM, it will get paged out to disk
anyway, so you might not need to do anything.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-id
wrote a
compiler to translate it into Postscript. The project went much more
smoothly after that!
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/m
aces.
To get by with just one "+" you would need some way to bracket
the arguments, then you have something more like backwards Lisp
with at least as many parens as infix.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsu
hose things are obvious at a glance to
me from the RPN.
Sure, I can figure it all out, but it takes work, and I'm not
confident that I haven't made a mistake. Which means I'd much
rather audit an infix expression than an RPN one.
--
Greg
___
here will also have been some kind of
mode switch to make it subtract instead of add.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-id
On 4/04/21 6:50 am, Chris Angelico wrote:
Algebra gives us a HIGHLY compact notation (far too compact to be
truly useful in computing, as it's very blackboard/paper oriented)
Anyone up for allowing Mathjax in Python source?
--
Greg
___
Python-
se to the file operations,
it's usually at a much higher level.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.or
On 21/06/21 6:04 am, Sebastian Berg wrote:
* `flatten()` (alwasy copy)
* `ravel()` (copies if needed, and additionally ensures contiguity)
* `reshape(-1)` (copies if needed)
They are all subtly different, unfortunately.
There's also a .flat attribute, that returns a 1-d iterator!
--
-strings could be confusing. Whereas backticks
are currently unused, and they used to nest back when they were
used, so giving them a new nesting usage will be unsurprising to
those with long enough memories.
--
Greg
___
Python-ideas mailing list -- python
bbreviated syntax for a parameterless lambda
that's only available in template expressions?
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailma
just to tell the
user to install numpy.
--
Greg
___
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
uthor, so a user error at one level is an implementation
error at another.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/p
manager
methods to everything that has open-like functionality.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org
On 7/09/21 5:46 am, C. Titus Brown via Python-ideas wrote:
Maybe Greg missed that DictReader.open didn’t exist and was in fact what I was
asking for!
Sorry about that, I thought you were asking for context manager methods
to be added to an existing file-like object.
If csv.DictReader had a
.
This would break Plex. I use a loop like that as part of the
NFA-to-DFA conversion to calculate the epsilon-closure of a
state (although obviously there are conditions on adding things
to the list that ensure it terminates).
--
Greg
___
Python-ideas
>From a "hobbyist / programming aesthete" perspective, I think this is a great
>idea. I think pattern matching in ML-descended languages is wonderfully
>elegant. Packing and unpacking tuples is already a common syntactic idiom in
>Python, and now that we have Structural Pattern Matching (SPM), i
On 1/11/21 4:59 am, David Mertz, Ph.D. wrote:
b = b
I don't want to live in a universe where this could be anything
other than a no-op in Python.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an ema
e might want to do with an iterator. Why those particular ones?
What about the contents of the itertools module? Should they be
included too? Why or why not?
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to
ethods to a protocol late in the life of the language is effectively
impossible.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pyth
On 2/12/21 4:40 am, Paul Moore wrote:
the
intended use is that people must supply a list[int] or not supply the
argument *at all*.
I don't think this is a style of API that we should be encouraging
people to create, because it results in things that are very
awkward to wrap.
--
mething that doesn't
currently happen. And it can't be done in general-- the location of an
imported module isn't know for sure until run time, because changes
can be made dynamically to sys.path.
--
Greg
___
Python-ideas mailing list -- python-i
elp much in practice.
--
Greg
___
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
hat would give you two different ways to document a function,
and it seems you could use both of them at the same time,
which could be confusing. If you're looking for documentation
of a function, there are two places you would have to look --
in the function itself, and in the module where
On 11/12/21 1:22 pm, Christopher Barker wrote:
Darn — the P and A are swapped there.
"Argument" and "actual" both start with "A" -- does that help?
--
Greg
___
Python-ideas mailing list -- [email protected]
T
ouldn't have to be changed at all, and programmers
wouldn't need to have foresight to decide when to declare things
inline.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@python
U+2744 Snowflake, anyone?
my_frozenset = ❄{1, 2, 3}
--
Greg
___
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
frozenset() on a constant
set would immediately benefit from it.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.pyth
frozenset() on a constant
set would immediately benefit from it.
--
Greg
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.pyth
sentence, I thought it would be equivalent to [1, 2, 3]?
Those particular brackets are really confusing because they're half
square and half round. I would expect it to mean [(1, 2, 3)].
--
Greg
___
Python-ideas mailing list -- [email protected]
assumptions about whether equal frozensets are the same
object or not -- just as with ints, strings, etc.
It would be just as legitimate e.g. for "ABC".upper()
to return the same string object. There is no exception
here to be learned.
--
Greg
___
Py
On 20/01/22 12:52 pm, Christopher Barker wrote:
On Wed, Jan 19, 2022 at 2:12 PM Greg Ewing <mailto:[email protected]>> wrote:
Those particular brackets are really confusing because they're half
square and half round.
And THAT is why this is a bad idea.
I
David Mertz wrote:
Sorry. From my tablet. "Bug magnets" (it really, really wants to
autocorrect that)
At least it didn't correct it to "butt magnets". :-)
--
Greg
___
Python-ideas mailing list
[email protected]
https:
if some_other_condition:
break
If you want to flesh out your proposal you will have to address
these. Also you should seek out previous discussions about code
blocks to make sure you're not just rehashing old ground.
--
Greg
Otherwise, call it with no
arguments.
If you don
normal and expected syntax
to use. ?. is much more recent. Maybe in another 30 years, if
it has stood the test of time, it could be argued for on the
basis of familiarity, but not now.
--
Greg
___
Python-ideas mailing list
[email protected]
.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
considered a part of computers science,
because it was invented specifically for the purpose of modelling
computation. Set theory wasn't.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
quot; or something. I don't
think that's true.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
Steve Barnes wrote:
* Brakes are used to apply breaking,
I hope they actually apply braking, not breaking. :-)
* A dinosaur is specifically an extinct terrible (formerly considered)
lizard
Which technically is not a lizard.
--
Greg
Jonathan Fine wrote:
Puffinus puffinus is the scientific name for
Puff the Magic Dragon?
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf
Alexandre Brault wrote:
On 2018-08-15 03:32 PM, MRAB wrote:
On 2018-08-15 18:27, MRAB wrote:
>
While we're at it, what's the only creature that's known commonly and
only by its scientific name?
I would have guessed Tyrannosaurus Rex
I would have thought pretty much any
Jonathan Fine wrote:
Matlab says: "Here, copy paste this and it'll work".
To the point that the workspace is designed to automatically strip >>>
from any copy and pasted commands.
Maybe this is something Python's REPL should do?
--
Greg
_
ely recognise what it was doing, or did
you have to stop and think about it?
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
then you won't
be surprised when you find a yield in it somewhere.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
citly described in those terms.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
n underneath it. That's a
technical term and an implementation detail, right there
in the user interface!
(Never mind that the implentation detail isn't accurate,
because the car actually has disc brakes...)
--
Greg
___
Python-ideas mailing list
Pyth
call
them "caret expressions" and write
^(x, y): x + y
Nice and quiet!
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
symbols,
so sometimes they have to make a completely arbitrary choice.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
er, because its grammar is required to be LL(1).
If you're interested in this stuff, I recommend either taking
a computer science course or reading a good book about the
theory of parsing. It will bring a lot of these concepts
into sharp focus.
--
Greg
__
p is dead, but there is a heck of a
lot going on in the browser. And if someone could write a simple GUI for
a desktop app, and then easily prt that to a WebApp -- that would be great.
Pyjamas seems to be something like that:
https://pypi.org/project/Pyjamas/
--
Greg
thout Gtk are currently
out ofscope -- but contributions are always welcome!
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
([
[Label("A"), a],
[Label("B"), b],
[Label("A + B"), c],
], padding = (10, 10)))
win.shrink_wrap()
win.show()
application().run()
--
Greg
___
Python-ideas mailing list
Python-ideas@pyt
eople here willing to help you
develop it. You may just need to be prepared to ignore
some digressions.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
ing
generalisation of multiple assignment targets might be.
Would you write
a += b += c += 1
or
a = b = c += 1
? And if the former, do we allow different operations
on each target, e.g.
a += b -= c *= 2
?
--
Greg
___
Python-ideas mailing list
lf.y + self.height - 1) in self
(self.x + self.width, self.y + self.height) not in self
# body of __init__ goes here...
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-i
ut static typing and contracts are *different things*
in Eiffel. Static types are checked at compile time, contracts
are checked at run time.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
C
Also, Fraction(1) for the second case would be flat-out wrong.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
actions do something different would
make it inconsistent with floats.
My calculator (which only does real floats) reports an
error when trying to evaluate (-1) ** (2/3).
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.pyth
eturn float or complex results,
which could then be discontinuous with the rational ones.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
;t want to include those you'll have to explain your
rationale.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
s C:
__slots__ = ('attr_1', ..., 'attr_m')
def __new __ (cls, attr_1, ..., attr_m):
self.attr_1 = attr_1
...
self.attt_m = attr_m
--
Greg
___
Python-ideas mailing list
[email protected]
https://ma
sh)
# do something here
for d in doshes:
assert is_distimmed(d)
This ticks the precondition and postcondition boxes, but
still doesn't give you any idea what a Dosh is and why
you would want to distim it.
--
Greg
___
Py
Jonathan Fine wrote:
# Evil code!
ask_delete.__code__, ask_save.__code__ = ask_save.__code__,
ask_delete.__code__
If an attacker can trick you into executing that line of code,
he can probably just delete your data directly.
--
Greg
x27;s natural to want a way to avoid repeating
yourself so much when passing them on.
So I think the underlying idea has merit, but the particular
syntax proposed is not the best.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.pyth
natural language
text (in which case all the tricky unicode stuff probably
doesn't apply anyway).
For such a rare requirement, maybe a module on PyPI would be
a better solution than adding a string method.
--
Greg
___
Python-ideas mailing list
P
m a Czech word meaning "forced
worker".
https://www.etymonline.com/word/robot
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
tirely possible for a thing to
be spotlessly clean without being beautiful or elegant.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
ot; and "ugly"
to be expunged from the language is saying that we shouldn't
be allowed to choose *anything* based on how it affects us
aesthetically. That, I think, would make the world a rather
miserable place to live in.
--
Greg
___
Pyt
reflect that we care a *lot* about aesthetics
in Python.
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
actress Samantha Quan is a russian spy...
--
Greg
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
Chris Barker via Python-ideas wrote:
"efficient is better than inefficient" kind of goes without saying...
Perhaps we should just replace the entire Zen with
"Good is better than bad." Insert your own subjective
ideas on what constitutes "good" and "bad&
hich makes it more personal and meaningful
than a "+1" counter getting incremented somewhere.
Counting only makes sense if the counts are going to be
treated as votes, and we don't do that.
--
Greg
___
Python-ideas mailing list
Pyth
1 - 100 of 878 matches
Mail list logo