[Python-ideas] Re: Shorthand syntax for lambda functions that have a single parameter

2021-09-29 Thread Guido van Rossum
t; 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/K6ZOKOHBJQLCRDDWARTIPYGZB3IN25SG/ > Code of Conduct: http://pytho

[Python-ideas] Re: More efficient list copying

2021-10-02 Thread Guido van Rossum
it's a dumb idea :-) > At the very least it might lead to a recommendation based on which operation is implemented most efficiently. Though you should just measure it for various N. Are you actually observing that people are doing this with regular lists? Don't people working with Big

[Python-ideas] Re: dict_items.__getitem__?

2021-10-10 Thread Guido van Rossum
You have to check the C code to be sure, but IIRC the latest dict implementation has a dense array of the values in insert order, and the hash table (which has gaps) contains indexes into the values array. So you could easily index into the values array (which I believe also has the keys) in O(1) t

[Python-ideas] Re: Implementing string unary operators

2021-10-12 Thread Guido van Rossum
I would also like to remind various other posters that sarcasm is *not* a good way to welcome newbies. The name of the list is python-ideas, not python-ideas-to-shoot-down-sarcastically. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing

[Python-ideas] Re: Implementing additional string operators

2021-10-13 Thread Guido van Rossum
lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/UGRD4QCDGRPOOCDMLPZ7EXWJFKM22AGO/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is

[Python-ideas] Re: Accessing target name at runtime

2021-10-15 Thread Guido van Rossum
I suspect there won’t be enough support for this proposal to ever make it happen, but at the very least could you think of a different token? The three left arrows just look too weird (esp. in the REPL examples, where they strongly seem to suggest a false symmetry with the ‘>>>’ prompt. How did you

[Python-ideas] Re: Unpacking in tuple/list/set/dict comprehensions

2021-10-16 Thread Guido van Rossum
Seems sensible to me. I’d write the equivalency as for x in y: answer.extend([…x…]) On Sat, Oct 16, 2021 at 07:11 Erik Demaine wrote: > Extended unpacking notation (* and **) from PEP 448 gives us great ways to > concatenate a few iterables or dicts: > > ``` > (*it1, *it2, *it3) # tuple with t

[Python-ideas] Re: Unpacking in tuple/list/set/dict comprehensions

2021-10-16 Thread Guido van Rossum
r lists because unlike lists the over-allocation isn't permanent." Finally, the bytecode generated for (*a, *b) creates a list first and then turns that into a tuple (which will be allocated with the right size since it's known at that point). -- --Guido van Rossum (python.org/~gui

[Python-ideas] Re: Unpacking in tuple/list/set/dict comprehensions

2021-10-17 Thread Guido van Rossum
efinitely not dead (as you seemed to imply). -- --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 mailing list -

[Python-ideas] Re: Syntax for late-bound arguments

2021-10-23 Thread Guido van Rossum
I like that you're trying to fix this wart! I think that using a different syntax may be the only way out. My own bikeshed color to try would be `=>`, assuming we'll introduce `(x) => x+1` as the new lambda syntax, but I can see problems with both as well :-). -- --Guido van Ro

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-23 Thread Guido van Rossum
; a, b = 3, 5 > > fn2(defer: x) # look for local a, b within fn2() if needed > > # ... other stuff > > return x # return 8 here > > > > How would it know to look for a and b inside fn2's scope, instead of > looking for x inside fn2's scope?

[Python-ideas] Re: Syntax for late-bound arguments

2021-10-24 Thread Guido van Rossum
er's scope. It's no different than a function defined in the caller. I don't think it would be a good substitute for late-binding default arguments. (You could make something up that uses dynamic scoping, but that's a whole different can of worms.) -- --Guido van Rossum (p

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Guido van Rossum
reaking new ground. Everywhere else in Python, undefined names are runtime errors (NameError or UnboundLocalError). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Guido van Rossum
Oct 25, 2021 at 10:49 AM Chris Angelico wrote: > On Tue, Oct 26, 2021 at 4:36 AM Guido van Rossum wrote: > > > > On Mon, Oct 25, 2021 at 10:28 AM Chris Angelico > wrote: > >> > >> [...] The two options on the table are: > >> > >> 1) Allow re

[Python-ideas] Re: Add __len__ to ipaddress._BaseNetwork

2021-10-26 Thread Guido van Rossum
gt; https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/4OHZ6QZWDI3U2ADI5A36UU73OOXFOGJE/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~g

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Guido van Rossum
I’m with Steven. On Fri, Oct 29, 2021 at 06:22 Chris Angelico wrote: > On Fri, Oct 29, 2021 at 11:52 PM Steven D'Aprano > wrote: > > > Except that that's still backward-incompatible, since None is a very > > > common value. > > > > How is it backwards incompatible? Any tool that looks at __defa

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-11-01 Thread Guido van Rossum
Agreed, class namespaces are weird. :-) On Sun, Oct 31, 2021 at 23:38 Chris Angelico wrote: > On Mon, Nov 1, 2021 at 5:15 PM Greg Ewing > wrote: > > > > 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 > > oth

[Python-ideas] Re: Adding pep8-casing-compliant aliases for the entire stdlib

2021-11-11 Thread Guido van Rossum
One thought: No. On Thu, Nov 11, 2021 at 05:41 Matt del Valle wrote: > So I was reading the docs for the `threading` module and I stumbled upon > this little note: > > Note: > > In the Python 2.x series, this module contained camelCase names for some > methods and functions. These are deprecated

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Guido van Rossum
+1 On Thu, Nov 18, 2021 at 09:31 Michael Foord wrote: > > > On Thu, 18 Nov 2021 at 04:38, Steven D'Aprano wrote: > >> On Wed, Nov 17, 2021 at 02:26:16PM -, tmkehrenb...@gmail.com wrote: >> >> > @dataclass >> > class A: >> > """Docstring for class A.""" >> > x: int >> > """Docstr

[Python-ideas] Re: PEP7 may need to add a info

2021-12-03 Thread Guido van Rossum
Good catch! You can submit a PR or issue to the peps project in the Python organization on GitHub. On Fri, Dec 3, 2021 at 00:24 wrote: > Hi! > When I read PEP7 and check Cpython source code, I found a deficiency that > in https://www.python.org/dev/peps/pep-0007/#code-lay-out. > In this section,

Re: [Python-ideas] On evaluating features [was: Unpacking iterables for augmented assignment]

2018-08-28 Thread Guido van Rossum
__iadd__ pairwise. But I am not so keen, because the ambiguity of `a, b, c += x`. Perhaps someone can do some research and unearth real code that contains series of += assignments that would become more readable by collapsing them into a single line using the proposed construct. -- --Guido van

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-30 Thread Guido van Rossum
llow top-level function calls to be written without parentheses, but it was too hard to make it unambiguous (e.g. would "foo +1" mean "foo(+1)" or "foo + 1"?) -- --Guido van Rossum (python.org/~guido) ___ Python-idea

Re: [Python-ideas] Why shouldn't Python be better at implementing Domain Specific Languages?

2018-08-30 Thread Guido van Rossum
On Fri, Aug 31, 2018 at 4:04 AM, David Mertz wrote: > On Thu, Aug 30, 2018 at 9:41 PM Guido van Rossum wrote: > >> On Fri, Aug 31, 2018 at 3:19 AM, Michael Selik wrote: >> >>> On Thu, Aug 30, 2018 at 5:31 PM James Lu wrote: >>> >>>> It would

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-13 Thread Guido van Rossum
nadian actress named Samantha Quan. -- --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] PEPs: Theory of operation [was: Moving to another forum system ...]

2018-09-22 Thread Guido van Rossum
elp prospective authors based on the text they show us. I have to admit that I've not followed the full context, but I recommend that you try to see that other posters in this thread are trying to help with kindness, not judging you or your skills

Re: [Python-ideas] f-string "debug" conversion

2018-10-03 Thread Guido van Rossum
Gah! You are overthinking it. This idea is only worth it if it's dead simple, and the version that Eric posted to start this thread, where !d uses the repr() of the expression, is the only one simple enough to bother implementing. -- --Guido van Rossum (python.org/~

Re: [Python-ideas] add a time decorator to timeit.py

2018-10-07 Thread Guido van Rossum
to > the empty coffee pot. > > -- > Jonathan > > ___ > 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] support toml for pyproject support

2018-10-08 Thread Guido van Rossum
k > with YAML or perhaps something even simpler than either one. > I feel the same way. (Somebody was requesting extensive TOML support for mypy and was also waving those PEPs in front of us.) -- --Guido van Rossum (python.org/~guido) __

Re: [Python-ideas] Introduce typing.SupportsFsPath

2018-10-08 Thread Guido van Rossum
lement new objects (without > dependency to "Path") > that are implementing the __fspath__ protocol. > > robert > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/pytho

Re: [Python-ideas] Add closing and iteration to threading.Queue

2018-10-21 Thread Guido van Rossum
dlock. Nathaniel, would you be able to elaborate more on the issue of backpressure? I think a lot of people here are not really familiar with the concepts and its importance, and it changes how you have to think about queues and the like. -- --Guido van Rossum (python.org/~

Re: [Python-ideas] Return for assignment blocks

2018-10-24 Thread Guido van Rossum
ause because there's no trouble with switching between expression-mode and statement-mode. Also note that syntactically it is clearly a special form of `def` statement -- it can even be decorated! So let's review the proposal as a shorthand for defining a function and immediate

Re: [Python-ideas] Return for assignment blocks

2018-10-25 Thread Guido van Rossum
e") the use case is just much narrower. So unless we find more use cases, or until we can convince ourselves that we can use `def (args): block` in all expression contexts, I guess it'll have to remain an idea. Thank you though! It was a fascinating one. -- --Guido van Rossum (python.org/~guido

Re: [Python-ideas] name2type mapping

2018-10-25 Thread Guido van Rossum
ed with static type checking (PEPs 484, 526, 544, 561) it may be PEP-worthy. As a compromise, perhaps some discussion can take place in the issue tracker of the repo (https://github.com/guettli/python-name2type-mapping) Thomas created? If someone with PEP experience is interested they can guide T

Re: [Python-ideas] Decide if `type.__subclasses__` is part of future Python or not

2018-10-29 Thread Guido van Rossum
ns "__subclasses__() -> list of > immediate subclasses" > > To fully figure out what it did, I had to read the source code to Python > -- which really is not the best way to figure out what a function does; > hence the request to document it (and indicate it's fut

Re: [Python-ideas] Allow Context Managers to Support Suspended Execution

2018-11-01 Thread Guido van Rossum
ed > with as. > > Thanks, > > David > ___ > 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] dict.setdefault_call(), or API variations thereupon

2018-11-01 Thread Guido van Rossum
The two are less connected than you seem to think. On Thu, Nov 1, 2018 at 7:08 PM Alex Shafer wrote: > I had actually managed to miss collections.defaultdict! > > I'd like to instead propose that a reference to that be added to the > dict.setdefault docs. I can't imagine I'm the only one that ha

Re: [Python-ideas] dict.setdefault_call(), or API variations thereupon

2018-11-01 Thread Guido van Rossum
instance is created, while setdefault() is used when inserting a value. A major issue IMO with defaultdict is that if you try to *read* a non-existing key it will be inserted. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Pyt

Re: [Python-ideas] NAN handling in the statistics module

2019-01-07 Thread Guido van Rossum
them, I think other stdlib libraries are not beholden to that behavior.) -- --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] Dict joining using + and +=

2019-02-27 Thread Guido van Rossum
dea. After all, we have `list.extend(x)` ~~ `list += x`. The key conundrum that needs to be solved is what to do for `d1 + d2` when there are overlapping keys. I propose to make d2 win in this case, which is what happens in `d1.update(d2)` anyways. If you want it the oth

Re: [Python-ideas] Dict joining using + and +=

2019-02-27 Thread Guido van Rossum
x27; + 'a'. For non-numbers we only require + to be associative, i.e. a + b + c == (a + b) + c == a + (b + c). That is satisfied for this proposal. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.

Re: [Python-ideas] Dict joining using + and +=

2019-02-27 Thread Guido van Rossum
x27;b': 3}) > > At first I worried that changing base dict would cause confusion for the > subclass, but Counter seems to share the idea that update and + are > synonyms. > Great, this sounds like a good argument for + over |. The other argument is that | for sets

Re: [Python-ideas] Dict joining using + and +=

2019-02-27 Thread Guido van Rossum
erested in sponsoring the PEP. And I'm not it. Is there a core dev who is interested in sponsoring or co-authoring this PEP? -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman

Re: [Python-ideas] Dict joining using + and +=

2019-02-27 Thread Guido van Rossum
x27;t in d2. > > > > -- > Steven > ___ > 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 (p

Re: [Python-ideas] Dict joining using + and +=

2019-02-28 Thread Guido van Rossum
On Wed, Feb 27, 2019 at 11:18 PM Serhiy Storchaka wrote: > 27.02.19 20:48, Guido van Rossum пише: > > > > On Wed, Feb 27, 2019 at 10:42 AM Michael Selik > > > <mailto:m...@selik.org>> wrote > The dict subclass > collections.Counter overrides the

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-01 Thread Guido van Rossum
e of Conduct: http://python.org/psf/codeofconduct/ > > > ___ > 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

Re: [Python-ideas] Dict joining using + and +=

2019-03-01 Thread Guido van Rossum
is highly non-obvious except if you've already encountered that pattern before, while d1+d2 is what anybody familiar with other Python collection types would guess or propose. And the default semantics for subclasses of dict that don't override these are

Re: [Python-ideas] Dict joining using + and +=

2019-03-04 Thread Guido van Rossum
d list + list, so this seems an unwarranted worry to me. -- --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] Dict joining using + and +=

2019-03-04 Thread Guido van Rossum
On Mon, Mar 4, 2019 at 12:12 PM Neil Girdhar wrote: > On Mon, Mar 4, 2019 at 2:26 PM Guido van Rossum wrote: > > > > * Dicts are not like sets because the ordering operators (<, <=, >, >=) > are not defined on dicts, but they implement subset comparisons for s

Re: [Python-ideas] Dict joining using + and +=

2019-03-04 Thread Guido van Rossum
Honestly I would rather withdraw the subtraction operators than reopen the discussion about making dict more like set. On Mon, Mar 4, 2019 at 12:33 PM Neil Girdhar wrote: > On Mon, Mar 4, 2019 at 3:22 PM Guido van Rossum wrote: > > > > On Mon, Mar 4, 2019 at 12:12 PM Neil G

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-04 Thread Guido van Rossum
g naming conventions or type annotations. > Those two points make me uncomfortable with "+=" strictly behaving > like ".update()". > And yet that's how it works for lists. (Note that dict.update() still has capabilities beyond +=, since you can also invoke it with keyword args.) -- --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] Suggestions: dict.flow_update and dict.__add__

2019-03-05 Thread Guido van Rossum
gs): > self.update(*argv, **kwargs) > return self > > def copy(self): > return self.__class__(self) > > A DIRTY HACK > Not tested, using an assignment expression. >dict_arg = (tmp := defaults.copy(), tmp.update(optio

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-05 Thread Guido van Rossum
nted without hashing, e.g. using a balanced tree, so that it could support unhashable keys). If there's doubt about this anywhere, we could add an example to the docs and to the PEP. -- --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] PEP: Dict addition and subtraction

2019-03-05 Thread Guido van Rossum
t as long as they are *strings* such keys should be allowed. -- --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] PEP: Dict addition and subtraction

2019-03-05 Thread Guido van Rossum
rst, none of the other situations I listed above raises for conflicts. Second, there's the experience of str+unicode in Python 2, which raises if the str argument contains any non-ASCII bytes. In fact, we disliked it so much that we changed the language incompatibly to deal with it. -- --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] Dict joining using + and +=

2019-03-05 Thread Guido van Rossum
y > > other obvious meaning that + and * could have for sets. > > The language SETL (the language of sets) also uses + and * for set > operations.¹ > So the secret is out: Python inherits a lot from SETL, through ABC -- ABC was heavily influenced by SETL. > ¹ https://www.li

[Python-ideas] OT: about hasty posts from phones

2019-03-06 Thread Guido van Rossum
e better. NOTE: I'm not picking on you specifically Chris! I see this a lot, and I do it myself too (and regularly regret it). -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/m

Re: [Python-ideas] dict literal allows duplicate keys

2019-03-06 Thread Guido van Rossum
recall, in SGML the first value "original" is the one that is > in effect. This is what happens with the LaTeX command > \providecommand. > > FURTHER LINKS > [6] > https://docs.python.org/3/reference/expressions.html#dictionary-displays > [7] https://cwe.mitre.org/data/definitions/561.html # CWE-561: Dead Code > &

Re: [Python-ideas] unittest: 0 tests pass means failure of the testsuite

2019-03-06 Thread Guido van Rossum
ibed) > ___ > 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] PEP: Dict addition and subtraction

2019-03-08 Thread Guido van Rossum
> In the spirit of full disclosure: > Of these, 2 is already implemented and widely used, so we don't need > to use dict.__add__ for that. I've never seen 4 in the mathematical > literature (union of relations is not the same thing). 3, however, is > very common both for mappings with small domain and sparse > representation of mappings with a default value (possibly computed > then cached), and "|" is not suitable for expressing that sort of > addition (I'm willing to say it's "wrong" :-). > -- --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] PEP: Dict addition and subtraction

2019-03-08 Thread Guido van Rossum
On Fri, Mar 8, 2019 at 3:33 PM Greg Ewing wrote: > Guido van Rossum wrote: > > I guess this explains the behavior of removing results <= 0; it makes > > sense as multiset subtraction, since in a multiset a negative count > > makes little sense. (Though the name Counter c

[Python-ideas] Why operators are useful

2019-03-15 Thread Guido van Rossum
r me this is the default assumption (even at Dropbox -- our most performance critical code has already been rewritten in ugly Python or in Go). For the few cases where performance concerns are paramount, it's easy to transform the operator version to something else -- *once you've confirmed i

Re: [Python-ideas] Why operators are useful

2019-03-15 Thread Guido van Rossum
On Fri, Mar 15, 2019 at 9:19 PM Inada Naoki wrote: > On Sat, Mar 16, 2019 at 2:51 AM Guido van Rossum wrote: > > > > But I think that the folks who point out "there is already a way to do > this" are missing the point that it really is easier to grasp the meaning &

Re: [Python-ideas] dict.merge(d1, d2, ...) (Counter proposal for PEP 584)

2019-03-21 Thread Guido van Rossum
elling, then I think > this proposal is the best: explicit, unambiguous, immediately > understandable and easy to remember. > I don't find it easy to understand or remember that d1.update(d2) modifies d1 in place, while d1.merge(d2) first copies d1. Maybe the name can

Re: [Python-ideas] Enabling / disabling optional type hinting

2019-03-23 Thread Guido van Rossum
not much of a reason to try and introduce a mechanism to disable type hints. Sorry. PS. This particular syntax was introduced by PEP 526, and introduced in Python 3.6. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas

Re: [Python-ideas] META: Is a PEP a good place to record Python's core design decisions and coding principles?

2019-03-24 Thread Guido van Rossum
nd > many more bugs. > > SUMMARY > > I have argued that Python's core design decisions and coding principles > can, at least in part, be reduced to a system of AXIOMS that can be useful > applied. I have argued mainly based on analogy with the Hindu-Arabic > numeral system, and the life and work of Gauss. > > > > > > > ___ > 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 explicit methods to trim strings

2019-03-25 Thread Guido van Rossum
ategory error. > I assume the whole proposal was a pastiche of the proposal to add a + operator for dictionaries. Jonathan needs to come clean before more people waste their time discussing this. -- --Guido van Rossum (python.org/~guido) ___ Pyt

Re: [Python-ideas] Built-in parsing library

2019-03-31 Thread Guido van Rossum
sing as the main candidate that fits this bill. >>>> >>>> What do you say? >>>> >>>> Thanks! >>>> Nam >>>> ___ >>>> Python-ideas mailing list >>>> Python-ideas@py

Re: [Python-ideas] Add output() helper function to subprocess module

2019-04-04 Thread Guido van Rossum
Let’s please leave this alone. As Serhiy says run() covers everything. On Thu, Apr 4, 2019 at 3:03 AM Oleg Broytman wrote: > On Thu, Apr 04, 2019 at 07:44:29PM +1100, Chris Angelico > wrote: > > On Thu, Apr 4, 2019 at 7:12 PM Nathaniel Smith wrote: > > > > > > On Thu, Apr 4, 2019 at 12:48 AM G

Re: [Python-ideas] What are the strong use cases for str.rindex()?

2019-04-23 Thread Guido van Rossum
a list of comma-separated items for the last comma, a fully-qualified module name for the last period, and some ad-hoc parsing of other things. The "last separator" use cases are the most common and here rindex() sounds very useful. -

Re: [Python-ideas] CPython Bytecode Assembler

2019-04-24 Thread Guido van Rossum
lman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___

Re: [Python-ideas] Using rightarrow "->" for typing annotation of functions

2019-04-24 Thread Guido van Rossum
irst time posting an idea to python-ideas. So apologies if i > am not following some conventions that i might not be aware of. > Vaibhav Karve > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinf

Re: [Python-ideas] Users of statistics software, what quantile functionality would be useful for you?

2019-04-28 Thread Guido van Rossum
re = data[max(0, index - 1)] after = data[min(len(data) - 1, index)] return (before + after) / 2.0 where `data` is a sorted array. Essentially we use the average of the two values nearest the cutoff point, except for edge cases. (I think we could do better, but this is the code I found in our

Re: [Python-ideas] More alternate constructors for builtin type

2019-05-06 Thread Guido van Rossum
y-value pairs. > Uses __iter__() instead of keys() for iterating keys, and can take an > optional iterable of keys. Equals to {k: m[k] for k in m} or {k: m[k] > for k in keys}. > * dict.fromitems() -- accepts only key-value pairs. Equals to {k: v for > k, v in iterable}. > > ____

Re: [Python-ideas] More alternate constructors for builtin type

2019-05-06 Thread Guido van Rossum
On Mon, May 6, 2019 at 11:14 AM Serhiy Storchaka wrote: > 06.05.19 17:49, Guido van Rossum пише: > > 20-25 years ago this might have been a good idea. Unfortunately there's > > so much code (including well-publicized example code) that I'm not sure > > it's a

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-15 Thread Guido van Rossum
ed in other languages (e.g. Scala) and notational systems (https://en.wikipedia.org/wiki/Subtyping). Overloading '<=' would be easier to implement, but would also cause enough confusion that I think we should avoid it at all cost. -- --Guido van Rossum (python.org/~guido) *Pron

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-17 Thread Guido van Rossum
On Mon, Jun 17, 2019 at 7:23 AM Rhodri James wrote: > On 16/06/2019 03:34, Guido van Rossum wrote: > > I don't actually know how viable this proposal is, but given that it's > > being debated at some length, I'd like to put in my opinion that *if* > > we&#

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-17 Thread Guido van Rossum
On Mon, Jun 17, 2019 at 12:54 PM Andrew Barnert wrote: > On Jun 17, 2019, at 07:47, Guido van Rossum wrote: > > On Mon, Jun 17, 2019 at 7:23 AM Rhodri James wrote: > >> On 16/06/2019 03:34, Guido van Rossum wrote: >> > I don't actually know how viable this

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-19 Thread Guido van Rossum
t; > Symbols CAN be searched for, both in Google and in many documentation > tools. > It's still harder. E.g. the wikipedia article on subtyping does not show in the search results for "<:", and searching for "<: wikipedia" ignores the "<:" entire

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Guido van Rossum
r a server to return a response which just isn't ever going to come, but the connection somehow is kept open by the other side? -- --Guido van Rossum (python.org/~guido) Pronouns: he/him/his (why is my pronoun here?) ___ Python-ideas mailing list -

[Python-ideas] Re: Canceling thread in python

2019-06-27 Thread Guido van Rossum
ch can be interrupted -- IIRC Victor spent a lot of time making this work). There's a workaround (specify a timeout) but this is still something that would have to be solved for this to be useful. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* &l

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-13 Thread Guido van Rossum
il 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/QE5OTQSEQHBBWWAQVIA66YUKGK5M6QDL/ > Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Re: Should tempfile.NamedTemporaryFile() not raise FileNotFoundError if the file does not exist at the moment of closing?

2019-07-17 Thread Guido van Rossum
deas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/46U433BTSAKCZKCNFUQGYDSC6GV5S35A/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <h

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-19 Thread Guido van Rossum
python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/2WFZPWUSW3CKGGP7P623GIHG5AK3NVCC/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun h

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-19 Thread Guido van Rossum
has been > available for a very long time. I emailed the author, Paul McGuire, a few > times about this python-ideas thread too but never got a response. > > On Fri, Jul 19, 2019 at 9:36 AM Guido van Rossum wrote: > >> Have you looked into pyparsing (https://github.com/pyparsing/py

[Python-ideas] Re: Skip modules by default in star-import

2019-07-26 Thread Guido van Rossum
my key message here is to Anders: stay on topic or start a new thread. You're welcome to discuss your idea in a separate thread. But don't steal existing threads. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2

[Python-ideas] Re: for ... except, with ... except

2019-07-26 Thread Guido van Rossum
ata in stream: > try: > write(data) > except OSError: > handle_write_error() > except OSError: > handle_read_error() > except OSError: > handle_connection_error() > __

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-26 Thread Guido van Rossum
k I recall encountering one in the past decade or so). Batuhan, if you still want to continue to debate this, please show some real use cases of programs where itertools.product() makes it hard for the human reader to understand the code. Examples like {1, 2, 3} * {"a", "b", "c

[Python-ideas] Re: Add a "partial with placeholders" function to the functools module

2019-07-27 Thread Guido van Rossum
Before we go too far down this route, let's consider whether these can't be solved with lambda rather than introducing new special cases to partial(). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-

[Python-ideas] Re: Meta question: python-ideas HOWTO (re Re: PEP's shouldn't require a sponsor)

2019-07-29 Thread Guido van Rossum
python.org/archives/list/python-ideas@python.org/message/NBILWWRZ46G2WUB3EHSZMII5V7B4IYD6/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-t

[Python-ideas] Re: for ... except, with ... except

2019-07-29 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] Re: for ... except, with ... except

2019-07-29 Thread Guido van Rossum
or..else prematurely; it would never be accepted now. But at this point there would be a cost at removing it as well and I don't think that's worth considering. But if the bar is about as high for with...except as it would be if for...else was proposed today, then I think it's clear we

[Python-ideas] Re: for ... except, with ... except

2019-07-29 Thread Guido van Rossum
On Mon, Jul 29, 2019 at 3:51 PM Eric Fahlgren wrote: > On Mon, Jul 29, 2019 at 2:58 PM Guido van Rossum wrote: > >> I am *guessing* the problem here is something like this: >> >> with open(filename) as f: >> data = f.read() >> >> raises an exception

[Python-ideas] Re: Namespace context managers

2019-07-29 Thread Guido van Rossum
ng. The successor of namedtuple is typing.NamedTuple which supports this syntactically. From the [docs]( https://docs.python.org/3/library/typing.html#typing.NamedTuple): ``` class Employee(NamedTuple): name: str id: int ``` -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his

[Python-ideas] Re: asyncio: futures and tasks with synchronous callbacks

2019-07-30 Thread Guido van Rossum
ep 2 need to be > clarified, probably a cleaner way to fix this) > - it is totally transparent for the end user, as synchronous callback are > totally compatible with asynchronous ones > ___ > Python-ideas mailing list -- python-ideas@python.o

[Python-ideas] Re: for ... except, with ... except

2019-07-30 Thread Guido van Rossum
or` had optional `except` clauses. (Alternatively, you can write little wrappers that turn OSError into different exceptions so you can use a single try/except/except/except statement to handle them all.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/h

[Python-ideas] Re: Entrypoint function for modules (AKA if __name__ == '__main__' ) with built-in argument parsing

2019-07-30 Thread Guido van Rossum
ved at > https://mail.python.org/archives/list/python-ideas@python.org/message/OEXGSBYWG5JGR4G2ELFVJUGUVWWIN52Q/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his *

[Python-ideas] Re: asyncio: futures and tasks with synchronous callbacks

2019-07-30 Thread Guido van Rossum
I wonder if Nathaniel has something to add? Trio has a different approayto cancellation. Of course it is also an entirely new library... On Tue, Jul 30, 2019 at 9:51 PM wrote: > Oh only now it appears in the list ! I thought the post hadn't working, so > I posted again :/. > > I've fixed my "lib

[Python-ideas] Re: for ... except, with ... except

2019-07-31 Thread Guido van Rossum
On Wed, Jul 31, 2019 at 2:06 AM Rob Cliffe via Python-ideas < python-ideas@python.org> wrote: > > > On 31/07/2019 00:35:59, Eric V. Smith wrote: > >> On Jul 30, 2019, at 11:38 AM, Guido van Rossum > wrote: > >> > > .. > > > >> with

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Guido van Rossum
ven has an option to limit its size (and silently drop older values as new ones are added), let alone that the case of setting the size to zero is optimized in the C code. But more importantly, I don't think I've ever needed either of those features, so maybe I was better off not knowing

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Guido van Rossum
ild a red house. I don't want Python to become the modern-day Lego. The craft of programming includes being able to combine pieces in all sorts of ways. Now, it's fine for 3rd party packages to have a different philosophy. (Pandas seems to cater to the crowd that wants a function for ev

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