While confusion with optional arguments is somewhat unfortunate, the name came
from an already established convention. A lot of languages have exactly the
same concept, varying between names like Optional, Option, and Maybe. I don't
think coming up with a Python-specific name for the same thing
I might be posting this prematurely, but I had an idea and wanted to float it.
Also, I'm new here so hopefully this is appropriate.
How about augmenting slicing with an additional parameter 'size' (name chosen
to achieve alliteration; 'start', 'stop', 'step', and 'size'), as such:
>>> a_list =
I actually initially was going to suggest a `strict` flag get added, but I
figured that would be impractical. I was mostly concerned about classes that
mimic file objects, because (obviously) their read methods wouldn't include a
`strict` flag and you couldn't pass such objects to functions usin
The code I'm currently working on involves parsing binary data. If I ask for,
say, 4 bytes, it's because I actually need 4 bytes and if the file doesn't have
4 bytes for me, it's malformed. Because `f.read(4)` can silently return less
than 4 bytes and I don't want to have to explicitly double ch
If you don't like:
while True:
...
if whatever:
break
One thing I've seen people do is:
condition = True
while condition:
...
condition = whatever
You can use it if you really hate `while True` loops with `break`.
___
Python-id
I'm not sure what you're proposing. What should its `__name__` be set to?
If you have a value you want its `__name__` to be, you can just set it yourself.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ide
As I said before, the "1,2,3" in `f(1,2,3)` has a very different meaning than
the "1,2,3" in `d[1,2,3]`. One is a (comma-separated) list of expressions, and
one is a single expression, a tuple.
`*(1,2,3)` does not evaluate to the tuple `(1,2,3)`, so I don't think expecting
it to do so in the co
> One reason MRAB points to. The `*keys` syntax is more-or-less equivalent to
> "substitute a tuple" in other Python contexts; you are proposing to give it a
> completely different meaning. This would be confusing and inconsistent.
I disagree that it is a completely different meaning. If the i
No, definitely not. d[1,2,3] and d[1][2][3] are not the same thing. The latter
is what I am talking about.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mail
Given code like this:
```
d = {1: {2: {3: 4}}}
print(d[1][2][3])
d[1][2][3] = None
print(d)
```
It should be possible to rewrite it using a starred expression, like this:
```
d = {1: {2: {3: 4}}}
keys= 1,2,3
print(d[*keys])
d[*keys] = None
print(d)
```
Hopefully it's clear from that example wha
Sorry for the duplicate message. I realized two seconds after I sent it, that I
only replied to you and not the group.
I didn't see the `consume` recipe until after I posted, or I probably would've
mentioned it. What I want would have to be done in C, because `it_index` (as
`listiterobject` and
str_iterator, bytes_iterator, range_iterator, list_iterator, and tuple_iterator
(and probably others) should have a method that is capable of efficiently
advancing the iterator, instead of having to call next repeatedly.
I suggest adding an itertools.advance function which dispatches to a dunder
You should add https://bitbucket.org/hipchat/txlocal as a reference for the
pep as it largely implements this idea for Twisted. It may provide for some
practical discussions of use cases and limitations of this approach.
On Tue, Sep 5, 2017, 09:55 Guido van Rossum wrote:
> On Tue, Sep 5, 2017 at
As far as providing a thread-local like surrogate for coroutine based
systems in Python, we had to solve this for Twisted with
https://bitbucket.org/hipchat/txlocal. Because of the way the Twisted
threadpooling works we also had to make a context system that was both
coroutine and thread safe at th
14 matches
Mail list logo