[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-27 Thread Guido van Rossum
, when occurring in hard-coded arguments of either nature, may also be slices, e.g. `d[x]` could be `d[i:j]` or `d[i:j:k]` or e.g. `d[::]`. This makes no difference for the analysis. Note that in `*args` and `**kwargs` the slice notation is not syntactically valid -- but you can use explicit calls to `slice(

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments (Was: Re: PEP 9999 (provisional): ...)

2020-09-29 Thread Guido van Rossum
At this point I think we're all set for use cases, both for keyword-only and for mixed use. Clearly a lot of libraries are going to be able to provide better APIs using this PEP, and mixed use of positionals and keywords will be quite useful to some of these. -- --Guido van Rossum (pytho

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-09-30 Thread Guido van Rossum
Would it help if ‘__abstractmethods__’ was documented, overruling whatever the PEP says? On Wed, Sep 30, 2020 at 00:01 Ben Avrahami wrote: > I encountered this problem when I needed to implement a class that defined > all 4 of the comparison operators, once with `dataclass` (for one > implementa

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
the dev team probably knows better. If this is an accepted solution, I'd be > happy to write a BPO and PR. > > On Wed, Sep 30, 2020 at 5:30 PM Guido van Rossum wrote: > >> Would it help if ‘__abstractmethods__’ was documented, overruling >> whatever the PEP says? >&

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
> > example: @abstractmethod(True) # Method won't be included in required > implementations. Default: False (for bcompat reasons) > That's already possible: just don't use @abstractmethod at all. You can still override! -- --Guido van Rossum (python.org/~guido) *Pronoun

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
this behaviour into `dataclass` (and > possibly `total_ordering`), and let 3rd parties implement this logic > themselves. > > On Thu, Oct 1, 2020 at 5:08 PM Guido van Rossum wrote: > >> That might work (though not for older Python versions). What kind of API >> were you think

[Python-ideas] Re: CPP Namespaces For Python

2020-10-06 Thread Guido van Rossum
I think the OP would be happy with a decorator they can just copy-paste. All it needs to do is go over the class dict and apply @classmethod to every “normal” function. Probably skip under names. On Tue, Oct 6, 2020 at 06:46 Ricky Teachey wrote: > cf. this relatively recent conversation on the s

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-06 Thread Guido van Rossum
> https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/C66MLTYQNAL3KHZELGME62UQOVGAHM5L/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.o

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments

2020-10-06 Thread Guido van Rossum
field stating that the existing slots take a dict as argument. I'm not sure that we need a vector style API here -- I have a feeling that this isn't going to be performance critical. (Certainly not for most people, and not for the PEP authors' use cases.) If you really want

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-06 Thread Guido van Rossum
I’m still waiting for an example of a real app where this matters. -- --Guido (mobile) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ide

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-06 Thread Guido van Rossum
ecedent -- though it's a questionable one (Luciano discovered this). It shows how tricky these things are though. There's a `typing.SupportsFoat` protocol that checks for the presence of a `__float__` method, and a `typing.SupportsComplex` protocol that checks for `__complex__`. Ironical

[Python-ideas] Re: CPP Namespaces For Python

2020-10-06 Thread Guido van Rossum
s a pain to combine two different metaclasses. > namespace Foo: > x=1 > def bar(): > pass > def baz() > return bar() + x > That could be done with a function and a function decorator. "Proof left as an exercise for the reader." :-) -- --Guido v

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-06 Thread Guido van Rossum
On Tue, Oct 6, 2020 at 18:16 Steven D'Aprano wrote: > For `__advance__` to be an official Python protocol, it would almost > certainly have to be of use for *general purpose iterators*, not just > specialised ones -- and probably not *hypothetical* iterators which may > not even exist. Do you hav

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-07 Thread Guido van Rossum
exing and slicing) that would change from O(1) to O(N) if the implementation changed to something other than an array. I'm not arguing against this proposal, or for it. I'm just mentioning > some considerations which should be considered :-) > Same here, for sure. Still wait

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-07 Thread Guido van Rossum
On Wed, Oct 7, 2020 at 12:41 AM Serhiy Storchaka wrote: > 07.10.20 06:04, Guido van Rossum пише: > > Ironically, complex numbers have a `__float__` > > method that always fails, and floats don't have a `__complex__` method > > but complex(x) succeeds if x is a flo

[Python-ideas] Re: Variadic generics PEP draft

2020-10-07 Thread Guido van Rossum
n-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/FKXO4KOAMP3TZ22T

[Python-ideas] Re: Allow writing optional types as ?int

2020-10-07 Thread Guido van Rossum
t; > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.or

[Python-ideas] Re: New feature

2020-10-13 Thread Guido van Rossum
st -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MX54AOXMYJHGRVOO2XW3J7JWHQDDUKPQ/ >

[Python-ideas] Re: Exact decimal multiplication and division operations

2020-10-14 Thread Guido van Rossum
g to do so, only that it surprised me when > I first discovered it. > > > -- > Steve > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.pytho

[Python-ideas] Re: New feature

2020-10-15 Thread Guido van Rossum
and perhaps IDLE (or some enterprising IDLE hacker) can monkey-patch that to do whatever makes IDLE's shell reset. On Thu, Oct 15, 2020 at 4:52 PM Mike Miller wrote: > > On 2020-10-13 15:35, Guido van Rossum wrote: > > Can one of the educators on the list explain why this is such a co

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-20 Thread Guido van Rossum
g > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/UF22D3FOJIA4JAHEV4FPMZLIG6XE7V3X/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-20 Thread Guido van Rossum
___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/pytho

[Python-ideas] Re: Call a function at invocation

2020-10-20 Thread Guido van Rossum
___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/JWLFO

[Python-ideas] Re: Call a function at invocation

2020-10-20 Thread Guido van Rossum
On Tue, Oct 20, 2020 at 8:06 PM Michael Smith wrote: > On Tue, Oct 20, 2020 at 10:19 PM Guido van Rossum > wrote: > > > > I think it would be a tad more convincing if there was a way to pass > arguments too (even if just a list of strings). At the very least extra > ar

[Python-ideas] Re: Call a function at invocation

2020-10-20 Thread Guido van Rossum
The ‘if __name__…’ idiom makes one function special. Hm... So if the module has that, will that main() still be called with your proposal? I.e., is __name__ still ‘__main__’? On Tue, Oct 20, 2020 at 20:32 Michael Smith wrote: > > > On Tue, Oct 20, 2020 at 23:12 Guido van Rossum wrote

[Python-ideas] Re: f-strings as assignment targets

2020-10-21 Thread Guido van Rossum
ying that it wouldn't be useful or practical. Not really sure > how this works. > > ChrisA > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.py

[Python-ideas] Re: f-strings as assignment targets

2020-10-21 Thread Guido van Rossum
uot; > foo, bar, baz = scan_to_tuple(pat_only, haystack) > # names, if bound, have the types indicated by scanning language > > There are questions open about partial matching, defaults, exceptions to > raise, etc. But the general utility of something along those lines seems > roughly

[Python-ideas] Re: f-strings as assignment targets

2020-10-22 Thread Guido van Rossum
} {b} {c}": print("Triple", a, b, c) ``` Everything else (e.g. how to design the formatting language) would be open. We could even designate "raw" f-strings (rf"...") as regular expressions (). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my

[Python-ideas] Re: f-string: empty expression should be allowed

2020-10-22 Thread Guido van Rossum
On Thu, Oct 22, 2020 at 3:37 AM Hans Ginzel wrote: > Thank you for (ugly) workaorund. > Careful who you're calling ugly. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pron

[Python-ideas] Re: Dict unpacking assignment

2020-10-22 Thread Guido van Rossum
sition or by name: > > > height, width = get_dimensions(window) # returns a tuple > height, width = **get_dimensions(window) # returns a mapping > > Developers can choose whichever model best suits their API. > > Another use-case is dealing wi

[Python-ideas] Re: f-string: empty expression should be allowed

2020-10-23 Thread Guido van Rossum
's been worked on at the Core dev sprint that's currently winding down. But the quoting won't change. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-si

[Python-ideas] Re: Extrapolating PEP 634: The walrus was waiting for patmat all along

2020-10-23 Thread Guido van Rossum
ython-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MJ7JHYKHKB2T4SCFV4TX4IMKUANUAF5B/ >

[Python-ideas] Re: Dict unpacking assignment

2020-10-25 Thread Guido van Rossum
rse(): assignment to fstrings > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/

[Python-ideas] Re: [Suspected Spam]Re: Dict unpacking assignment

2020-10-31 Thread Guido van Rossum
ly have to write ``` {'spam': spam, 'eggs': eggs} = mapping ``` and any extra keys are ignored. This is because for the common use case here we want to ignore extra keys, not insist there aren't any. (We wrote it up a little better in the Mapping Patterns section of PEP 635

[Python-ideas] Re: [Suspected Spam]Re: Dict unpacking assignment

2020-10-31 Thread Guido van Rossum
On Sat, Oct 31, 2020 at 21:47 Steven D'Aprano wrote: > On Sat, Oct 31, 2020 at 09:05:43PM -0700, Guido van Rossum wrote: > > > Hm, for PEP 622/634 we looked at this and ended up making it so that this > > is the default -- you only have to write > > ``` > > {&#

[Python-ideas] Re: unix filter, one liners, awk

2020-11-05 Thread Guido van Rossum
@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/IT5MXIZB3LSMZTHJHVFCFADSGZOW4S2Y/ > Code of Conduct:

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-14 Thread Guido van Rossum
It’s a usability issue; mappings are used quite differently than sequences. Compare to class patterns rather than sequence patterns. On Sat, Nov 14, 2020 at 22:04 David Foster wrote: > From PEP 636 (Structural Pattern Matching): > > Mapping patterns: {"bandwidth": b, "latency": l} captures the

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-14 Thread Guido van Rossum
David Foster wrote: > On 11/14/20 10:17 PM, Guido van Rossum wrote: > > It’s a usability issue; mappings are used quite differently than > > sequences. Compare to class patterns rather than sequence patterns. > > I just found the following explanation from the superceded PEP

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-17 Thread Guido van Rossum
Go for it. This is a pretty minor issue but we want to get it right. Data is helpful. On Tue, Nov 17, 2020 at 06:58 David Foster wrote: > On 11/15/20 12:11 AM, Steven D'Aprano wrote: > > It would be good if the PEP gave a survey of the practical experience of > > other languages with pattern mat

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-21 Thread Guido van Rossum
> ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/a

[Python-ideas] Re: Matching TypedDicts and other values in JSON

2020-11-22 Thread Guido van Rossum
;] > > For arbitrary JSON beyond the example, we'd also want to support > isinstance() for: > * List[T] > > We already support isinstance() for the other JSON primitive types: > * str > * float > * bool > * type(None) > > So what do folks thi

[Python-ideas] Re: Matching TypedDicts and other values in JSON

2020-11-22 Thread Guido van Rossum
, please start a new thread on typing-sig and we'll discuss it. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> _

[Python-ideas] Re: Matching TypedDicts and other values in JSON

2020-11-23 Thread Guido van Rossum
I recommend taking this to typing-sig... On Mon, Nov 23, 2020 at 19:18 David Foster wrote: > On 11/22/20 10:15 AM, Guido van Rossum wrote: > > - We intentionally don't support things like `isinstance(x, List[str])` > > because that would require checking all the items w

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-25 Thread Guido van Rossum
@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/VKHB722PLUMZJPCMHEM2MB4HBEDI463Y/ > Code of Conduc

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
/list/python-ideas@python.org/message/WJXFEVKR3IU7BAI57DFUUZZYS6UA3P6N/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
yet sufficiently familiar with that field to be able to point you to examples. Hopefully there are readers here who can. (Nate?) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/ho

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-26 Thread Guido van Rossum
Council (not me). (Why do I propose "let" and not "const"? It seems "let" has become the industry standard language. The other day I saw a reference to a LET() function in Excel. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
> because the caller didn't bind it to keep hold of it. > Sounds like one of you is describing current semantics and the other is explaining the proposed new semantics. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
, the better I think because it encourages python users to > annotate their functions. > Indeed. Shantanu did some quick counting and found that after 'Any' and the types covered by PEP 585, Callable is by far the most used: https://bugs.python.org/issue42102#msg381155 -- --Guido van

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
ality. > Hm, but using Protocol you can already express every callable type. We could duplicate all of the complexity of 'def' parameter lists into the type notation, but it would be very complex. So this requirement is at least debatable (I'm not actually sure how I feel abou

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-28 Thread Guido van Rossum
hat comprehensions implicitly use 'for let ...'. If we were to drive this through quickly enough we could even make it apply to pattern matching captures. (Or maybe pattern matching could get these semantics anyway.) My bus is here, so that's it, -- --Guido van Rossum (python.org/~

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
yntax is particularly > readable when lots of nesting is involved, but I suspect that's just > because the type is just complicated. :) ) > You could simplify it by judicious application of type aliases. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(wh

[Python-ideas] Re: Callable annotation featureset [Was: Alternative to Callable Annotation]

2020-11-29 Thread Guido van Rossum
ll a very common case). The rule would be something like "if there's no /, a / is assumed at the end", and also "in positional args, the syntax is [name ':'] type_expr ['=' default_expr]." Gotta go, On Sun, Nov 29, 2020 at 12:02 AM Andrew Svetlov wrote:

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-29 Thread Guido van Rossum
usable to solve a whole bunch of other problems, in addition to giving us a cleaner way to solve the value capture problem. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-chang

[Python-ideas] Re: Making "Any" a builtin

2020-11-29 Thread Guido van Rossum
Inada Naoki > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://m

[Python-ideas] Re: [RFC] Built-in shorthand b() for breakpoint()

2020-12-02 Thread Guido van Rossum
3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/6UAJRDKVJNZ7EACXUTUCKSGAEYPJHME5/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(

[Python-ideas] Re: Proposal for __encode__ method for json encoder and dataclasses

2020-12-09 Thread Guido van Rossum
Maybe you could start by writing this as a separate decorator, to be applied on top of the data class decorator? On Wed, Dec 9, 2020 at 05:38 sam bland wrote: > In response to the additional work required to convert the new python > dataclass using the json encoder I propose an __encode__ method

[Python-ideas] Re: __init__ in module names

2020-12-10 Thread Guido van Rossum
s the value of Python in the larger ecosystem. My opinion is > the harm inflicted by dropping support for "__init__" in module names will > be more than compensated by long-term benefits of enabling turnkey Python > application distribution. But that's my personal take and I ha

[Python-ideas] Re: __init__ in module names

2020-12-10 Thread Guido van Rossum
On Thu, Dec 10, 2020 at 1:22 PM Steven D'Aprano wrote: > On Thu, Dec 10, 2020 at 10:57:32AM -0800, Guido van Rossum wrote: > > > All I have to add is that I am appalled that people actually write `from > > foo import __init__` > > I too would be appalled if that was

[Python-ideas] Re: Proposal: typing.affix_type_hints

2020-12-10 Thread Guido van Rossum
a > way for ForwardRef to cache evaluated values when get_type_hints is > called? > > 2. Something I haven't considered? Please let me know. > > > Paul > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsub

[Python-ideas] Re: a new data type: NamedValue -- similar to Enum

2020-12-12 Thread Guido van Rossum
t following this either. Can you give an example of something that doesn't work with Enum (and shouldn't work) but should work with NamedValues? Finally, why the plural in the name, where Enum and friends all have singular names? -- --Guido van Rossum (python.org/~guido) *Pron

Re: [Python-ideas] Let’s make escaping in f-literals impossible

2016-08-30 Thread Guido van Rossum
'{' is currently invalid, it's not. However it's a huge change conceptually and implementation-wise, and I don't blame Eric if he doesn't want to be responsible for it. So it has to be a new PEP, to be introduced in 3.7

Re: [Python-ideas] Let’s make escaping in f-literals impossible

2016-08-30 Thread Guido van Rossum
mind, so you might as well stop debating and save all the onlookers the embarrassment.) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Co

Re: [Python-ideas] Let’s make escaping in f-literals impossible

2016-08-30 Thread Guido van Rossum
as Guido did: It would be really nice if you > could pinpoint the phrases and reasons that make it seem that I mean it that > way. (In a private mail to me) > > Best, Philipp > > > Guido van Rossum schrieb am Di., 30. Aug. 2016, 18:43: >> >> Philipp, you need to stop

Re: [Python-ideas] Let’s make escaping in f-literals impossible

2016-08-30 Thread Guido van Rossum
expect that syntax will > confuse an awful lot of people. Can we please stop debating this? This observation has been made about 100 times by now. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] real numbers with SI scale factors

2016-08-30 Thread Guido van Rossum
ke. > This is really only an issue with output. So maybe the proposal should be toned down to just a way to request SI units when formatting numbers? -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@py

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-08-30 Thread Guido van Rossum
idea comes up. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-08-31 Thread Guido van Rossum
ll the drama we're just talking about adding an 'h' format code that's like 'g' but uses SI scale factors instead of exponents. I guess we need to debate what it should do if the value is way out of range of the SI scale system -- what's it going to do when I pass

Re: [Python-ideas] Extending expressions using ellipsis

2016-08-31 Thread Guido van Rossum
tails like "(..)" or "[...]". But then you could only use this new idea for chaining method calls, and not for spreading other large expressions across multiple lines. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] real numbers with SI scale factors: next steps

2016-08-31 Thread Guido van Rossum
human-readable" output. That would seem to apply to "space used" but not to "space available". -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] What should a good typechecker do?

2016-09-03 Thread Guido van Rossum
On Sat, Sep 3, 2016 at 8:28 AM, Stephen J. Turnbull wrote: > Guido van Rossum writes: > > > But that's not what type comments mean! They don't annotate the > > expression. They annotate the variable. > > In PEP 484. But syntactically, AFAICS in an initializat

Re: [Python-ideas] PEP 530: Asynchronous Comprehensions

2016-09-06 Thread Guido van Rossum
ut the ideas in it seem pretty uncontroversial, and in line with the existing expectations for async/await. Yury, if you manage to get a working implementation signed off by one other core dev (not me) I can accept the PEP provisionally, under the same c

Re: [Python-ideas] PEP 530: Asynchronous Comprehensions

2016-09-07 Thread Guido van Rossum
rather than a prefix on 'for'. Hopefully they've seen an 'async for' statement before they encounter an async comprehension. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.pyt

Re: [Python-ideas] Three ways of paths canonization

2016-09-08 Thread Guido van Rossum
xpath.realpath-e > posixpath.realpath_require_prefix -f > posixpath.realpath_allow_missing -m > posixpath.realpath_gnuext GNU extension > > ___ > Python-ideas mailing list > Python-ideas

Re: [Python-ideas] Changing optimisation level from a script

2016-09-09 Thread Guido van Rossum
7;) # will not raise an exception > > What do you think? Sorry if this has been discussed before! > > Cheers, > Damien. > ___ > Python-ideas mailing list > Python-ideas@python.org > https://

Re: [Python-ideas] Changing optimisation level from a script

2016-09-09 Thread Guido van Rossum
ty to change the optimization level > mid-execution would break assumptions or flat-out ban cross-module > optimizations in fear that too much code would break. > > So I'm not flat-out saying no to this idea, but there are some things to > consider first. > > ___ > Python-

Re: [Python-ideas] Null coalescing operator

2016-09-10 Thread Guido van Rossum
___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ -- --Guido van Rossum (python.org/~guido) ___ Python-ideas m

Re: [Python-ideas] Null coalescing operator

2016-09-10 Thread Guido van Rossum
On Sat, Sep 10, 2016 at 11:09 AM, MRAB wrote: > On 2016-09-10 18:44, Paul Moore wrote: >> >> On 10 September 2016 at 18:26, Guido van Rossum wrote: >>> >>> IMO the key syntax is >>> simply one for accessing attributes returning None instead of raising

Re: [Python-ideas] Null coalescing operator

2016-09-10 Thread Guido van Rossum
orners where we would want > behavior wrapped, but those shouldn't be that hard to add in principle. > > On Sat, Sep 10, 2016 at 3:21 PM, David Mertz wrote: >> >> I find the '?.' syntax very ugly, much more so in the examples of chained >> attributes. >>

Re: [Python-ideas] Null coalescing operator

2016-09-10 Thread Guido van Rossum
On Sat, Sep 10, 2016 at 4:27 PM, Chris Angelico wrote: > On Sun, Sep 11, 2016 at 9:10 AM, Guido van Rossum wrote: >> So you're offering `NoneCoalesce(x).bar` as less-ugly alternative to >> `x?.bar`... Color me unconvinced. > > As a syntactic form? Not interested. But w

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-10 Thread Guido van Rossum
I sent this accidentally as private reply, then tried to fix it on > phone. The latter produced horrible formatting. Please just read this > version. > > On Sat, Sep 10, 2016 at 4:10 PM, Guido van Rossum wrote: >> >> So you're offering `NoneCoalesce(x).bar` as les

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-10 Thread Guido van Rossum
No. PEP 505 actually solves the problem without ever catching AttributeError. Please read it. On Sat, Sep 10, 2016 at 5:15 PM, David Mertz wrote: > On Sep 10, 2016 4:45 PM, "Guido van Rossum" wrote: >> >> There seems to be a major misunderstanding here. A None-coalesci

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-10 Thread Guido van Rossum
t; motivation for new syntax. > > > On Sep 10, 2016 6:29 PM, "MRAB" wrote: >> >> On 2016-09-11 02:02, David Mertz wrote: >>> >>> On Sat, Sep 10, 2016 at 5:23 PM, Guido van Rossum >> <mailto:gu...@python.org>> wrote: >>> >>>

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-11 Thread Guido van Rossum
Interestingly, after analyzing the above example I desperately want to write it as return "Illegal Argument" + (self.message && (": " + self.message) || "") Note that I already know the relative priorities of && and ||, so I can drop a set of parentheses.

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-11 Thread Guido van Rossum
a` is in fact something more complex, like `f(a)`, repeating it twice sounds like a performance penalty, and that's where `f(a)?.foo` really shines. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@pyt

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Guido van Rossum
__ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ -- --Guido van Rossum (python.org/~guido) _

Re: [Python-ideas] An exciting opportunity to update PEP 3156

2016-09-12 Thread Guido van Rossum
turn None. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] An exciting opportunity to update PEP 3156

2016-09-12 Thread Guido van Rossum
gt; ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ -- --Guido van Rossum (python.org/~guido) __

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-12 Thread Guido van Rossum
On Mon, Sep 12, 2016 at 5:45 PM, Rob Cliffe wrote: > > > On 12/09/2016 16:37, Guido van Rossum wrote: >> >> For the record, I still really don't like PEP 463. We should strive to >> catch fewer exceptions, not make it easier to catch them. > > Can you ple

Re: [Python-ideas] Naming convention for Enums

2016-09-14 Thread Guido van Rossum
_____ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] New Python syntax for continuing definitions for existing classes

2016-09-14 Thread Guido van Rossum
ion that the affected class is >> extensible (i.e. the use of the custom metaclass, or inheritance from >> a base class that uses it) and hence that the given definition may be >> incomplete >> >> Cheers, >> Nick. >> >> -- >> Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia >>

Re: [Python-ideas] Naming convention for Enums

2016-09-15 Thread Guido van Rossum
, since they're most often going to be > representing constant integers, per Guido's post. I don't know of > _any_ real-world cases where they're not integers, though there are > some examples in the docs. Amen. > ChrisA > > [1] https://docs.python.org/3/libr

Re: [Python-ideas] Naming convention for Enums

2016-09-15 Thread Guido van Rossum
Please update the docs. On Thu, Sep 15, 2016 at 11:14 AM, Chris Angelico wrote: > On Fri, Sep 16, 2016 at 4:06 AM, Guido van Rossum wrote: >>> Sometimes they function as integer constants (esp IntEnum), and >>> sometimes more as just arbitrary values. See the examples in

Re: [Python-ideas] Make partial a built-in

2016-09-20 Thread Guido van Rossum
I am radically opposed to this proposal. Every time I see a partial application I wonder endlessly about what's going on. --Guido (mobile) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of

Re: [Python-ideas] Make partial a built-in

2016-09-20 Thread Guido van Rossum
hat partial was faster. This surprised me but it wa what I measured (in one particular case). > Elazar > > בתאריך יום ג׳, 20 בספט' 2016, 18:20, מאת Guido van Rossum ‏< > gvanros...@gmail.com>: > >> I am radically opposed to this proposal. Every time I see a partial >

Re: [Python-ideas] async objects

2016-10-04 Thread Guido van Rossum
Python 4 first). I'm still trying to figure out my position on the other points of discussion here -- keep discussing! -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python

Re: [Python-ideas] async objects

2016-10-04 Thread Guido van Rossum
ou buy into the async way of living and it's coroutines all the way down from there, no looking back -- or you stay on the safe side of the fence, and you interact with coroutines only using a very limited "remote manipulator" API. The two

Re: [Python-ideas] Flagging blocking functions not to be used with asyncio

2016-10-07 Thread Guido van Rossum
even raise an exception at that point. Maybe a simpler approach would be to write a linter that checks for a known list of common blocking functions, and anything that calls those automatically gets the same property? -- --Guido van Rossum (python.org/~guido) __

Re: [Python-ideas] Flagging blocking functions not to be used with asyncio

2016-10-07 Thread Guido van Rossum
On Fri, Oct 7, 2016 at 9:52 AM, Yury Selivanov wrote: > On 2016-10-07 11:16 AM, Guido van Rossum wrote: > >> Maybe a simpler approach would be to write a linter that checks for a >> known list of common blocking functions, and anything that calls those >> automaticall

Re: [Python-ideas] PEP8 dictionary indenting addition

2016-10-08 Thread Guido van Rossum
Makes sense, maybe you can send a PR to the Python/peps repo? --Guido (mobile) On Oct 8, 2016 12:27 PM, "Jelte Fennema" wrote: > I have an idea to improve indenting guidelines for dictionaries for better > readability: If a value in a dictionary literal is placed on a new line, it > should have

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