[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-23 Thread Guido van Rossum
propose to fix the bug by not writing things back that way, instead writing back whenever a key in the proxy is set. The discussion is about subtler differences between the proposals. —Guido On Mon, Aug 23, 2021 at 22:19 Steven D'Aprano wrote: > On Sat, Aug 21, 2021 at 05:46:52PM -0700, G

[Python-Dev] Re: Should PEP 8 be updated for Python 3 only?

2021-08-24 Thread Guido van Rossum
org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/MK7N36L3XCXVY5R4DIIYIDU2W7EGJKZ3/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-26 Thread Guido van Rossum
On Thu, Aug 26, 2021 at 1:29 AM Nick Coghlan wrote: > On Mon, 23 Aug 2021 at 13:07, Guido van Rossum wrote: > > But... I also care about backwards compatibility, and I have a crazy > idea for making PyEval_GetLocals() work in a useful manner without > compromising the behavior

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-26 Thread Guido van Rossum
at would be the use case for that? I guess to start over with a computation. But there are better ways to do that. So let's not worry too much about preventing the user from shooting themselves in the foot -- surely at the global level, "globals().clear()" will do weird shit too. :-)

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-26 Thread Guido van Rossum
e object is advantageous. The cost of the extra indirection is irrelevant, this is always going to be a slow interface meant for occasional use in a debugger. -- --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-

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-26 Thread Guido van Rossum
ast locals proxy > implementation, as that could cause weird interactions if a trace hook is > enabled during the initial start up of the interpreter and tries to trace > the proxy implementation code. > Of course. But it would still be interesting to have pseudo-code in your PEP showin

[Python-Dev] Re: Making code object APIs unstable

2021-09-01 Thread Guido van Rossum
(context) > Guido van Rossum schrieb am 13.08.21 um 19:24: > > In 3.11 we're changing a lot of details about code objects. Part of this > is > > the "Faster CPython" work, part of it is other things (e.g. PEP 657 -- > Fine > > Grained Error Locations in

[Python-Dev] Re: Making code object APIs unstable

2021-09-01 Thread Guido van Rossum
s compatibility for these two functions. That means: - Get rid of PyCode_NewWithPosArgs altogether - PyCode_New becomes unstable (and gets a new posinlyargcount argument) On Wed, Sep 1, 2021 at 11:52 AM Guido van Rossum wrote: > (context) > >> Guido van Rossum schrieb am 13.08.21 u

[Python-Dev] Re: Making code object APIs unstable

2021-09-02 Thread Guido van Rossum
rg/message/TDLCJHNQSPNE7UXEJ33PV2VNQOPUFUT7/ > 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-change-the-wo

[Python-Dev] Re: Discrepancy between what aiter() and `async for` requires on purpose?

2021-09-02 Thread Guido van Rossum
is defined, skip calling __iter__ in iter()". > > The optimisation that bypasses the __[a]iter__ method call feels more > legitimate in the actual for loop syntax, it just feels odd to me if the > builtin isn't forcing the call. > > Cheers, > Nick. > >> &g

[Python-Dev] Re: A better way to freeze modules

2021-09-02 Thread Guido van Rossum
Quick reaction: This feels like a bait and switch to me. Also, there are many advantages to using a standard format like zip (many formats are really zip with some conventions). Finally, the bytecode format you are using is “marshal”, and is fully portable — as is zip. On Thu, Sep 2, 2021 at 21:44

[Python-Dev] Re: Making code object APIs unstable

2021-09-06 Thread Guido van Rossum
On Fri, Sep 3, 2021 at 4:12 PM Victor Stinner wrote: > On Thu, Sep 2, 2021 at 11:15 PM Guido van Rossum wrote: > > FWIW I've applied for an exception from the two-release deprecation > policy from the SC: > > https://github.com/python/steering-council/issues/75 > >

[Python-Dev] Re: Making code object APIs unstable

2021-09-07 Thread Guido van Rossum
On Tue, Sep 7, 2021 at 10:00 AM Stefan Behnel wrote: > Guido van Rossum schrieb am 07.09.21 um 00:44: > > In addition, I just heard from the SC that they've approved the > exception. > > So we will remove these two APIs from 3.11 without deprecation. > > Erm, ha

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-09-09 Thread bas van beek
role in laying its foundation, as it allows for the expression of both dimensioability as well as basic shape manipulation . All in all, I'm very interested in where both PEP 646 and future PEPs will take us and look forward to further developments. Regards, Ba

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ/ > Code of Conduct: http://python.org/psf/codeofconduct

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
s people register things that don't follow the letter of the protocol, just to get things going. (This is common for complex protocols like Mapping, where some function you have no control over insists on a Mapping but only calls one or two common methods. Duck typing is alive and kicking! -

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 4:33 PM Brandt Bucher wrote: > Guido van Rossum wrote: > > On Tue, Sep 14, 2021 at 3:49 PM Brandt Bucher brandtbuc...@gmail.com > > wrote: > > > I think it's also worth noting that a missing "`__iter__` that returns > > > self&qu

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 9:03 PM Steven D'Aprano wrote: > On Tue, Sep 14, 2021 at 12:33:32PM -0700, Guido van Rossum wrote: > > My view of this is: > > > > A. It's not an iterator if it doesn't define `__next__`. > > > > B. It is strongly

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
t that only has __next__, > apart from "broken" :-( > It's still an iterator, since it duck-types in most cases where an iterator is required (notably "for", which is the primary use case for the iteration protocols -- it's in the first sentence of PEP 234'

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 11:44 PM Steven D'Aprano wrote: > On Tue, Sep 14, 2021 at 09:38:38PM -0700, Guido van Rossum wrote: > > > > I don't know what I would call an object that only has __next__, > > > apart from "broken" :-( > > > > &

[Python-Dev] Re: python3.10rc2 compilation on android/termux/clang12.0.1 fails

2021-09-15 Thread Guido van Rossum
-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/KEURSMCLUVI7VPKM6M2VUV4JIW6FP66Z/ > Code of Conduct: http

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
def __iter__(self): return A() Now this works: for x in S(): ... However this doesn't: for x in iter(S()): ... In Steven's view, A does not deserve to work in the former case: Because A is a "broken" iterator, he seems to want it rejected by the iter() call that is

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
> https://mail.python.org/archives/list/python-dev@python.org/message/TWSJKE4KKSW7YD3OCHKGKJC52VUG6FY5/ > 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/

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
On Mon, Sep 20, 2021 at 1:07 PM Patrick Reader <_...@pxeger.com> wrote: > > The current restrictions will also confuse some users (e.g. those used > to bash, and IIRC JS, where the rules are similar as what Pablo is > proposing). > > -- > > --Guido van Rossum (python

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
print(f"{source.removesuffix(".py")}.c: $(srcdir)/{source}") ^ SyntaxError: f-string: unmatched '(' ``` -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/0

[Python-Dev] Re: f-strings in the grammar

2021-09-21 Thread Guido van Rossum
s before") print(f"{source.removesuffix(".py")}.c: $(srcdir)/{source}") print("\t$(COMMAND)") So these two tools, at least, seem to be doing all right (maybe because they both come from the JavaScript culture, where ne

[Python-Dev] Re: f-strings in the grammar

2021-09-21 Thread Guido van Rossum
on just because it's in an f-string. I presume it was trickier at the time because we were coming from "{xxx}".format(...), where the parser doesn't know that the string is a format string. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun

[Python-Dev] Re: Changing exception text in micro releases

2021-09-24 Thread Guido van Rossum
In this case I am inclined not to backport. In general we should look at existing usage before making changes. Somebody’s code might break — but does it matter? That depends on a lot of factors. E.g. if parsing an error message has become a common way to get useful info out of the error that is no

[Python-Dev] Re: The Default for python -X frozen_modules.

2021-09-27 Thread Guido van Rossum
is `./configure --enable-optimizations`, which doesn't mention PGO -- IIUC it turns on PGO and LTO, if they're available. So my *actual* proposal (call it #2') is to use a separate compile-time flag, which is set by `./configure --enable-optimizations` regardless of whether P

[Python-Dev] Re: Worried about Python release schedule and lack of stable C-API

2021-09-28 Thread Guido van Rossum
What I have heard repeatedly, from people who are paid to know, is that most users don’t care about the latest features, and would rather stick to a release until it becomes unsupported. (Extreme example: Python 2.) Numpy isn’t random, it’s at the bottom of the food chain for a large ecosystem or

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
We’ll, typically you don’t explicitly mention ExceptionGroup — it’s implied by the ‘except*’ syntax. Introducing match semantics probably wouldn’t open up new functionality, you can already write ‘except (E1, E2):’. On Sun, Oct 3, 2021 at 09:00 Thomas Grainger wrote: > What about `except case Ex

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
iding any feedback on the use of 'except *'. So I think it's a bit late to be bikeshedding the syntax. This thread was meant to solicit feedback on how to *format* it: does the space go before or after the '*'. -- --Guido van Rossum (python.org/~guido)

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble wrote: > Therefore my vote is for requiring `except* E` and keeping `except *E` as > a SyntaxError. > You can't do that with our current lexer+parser. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun

[Python-Dev] Re: PEP 654 except* formatting

2021-10-04 Thread Guido van Rossum
The question was about which style to *recommend* (a la PEP-8). On Mon, Oct 4, 2021 at 8:03 AM Jonathan Goble wrote: > On Mon, Oct 4, 2021 at 1:24 AM Guido van Rossum wrote: > >> On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble wrote: >> >>> Therefore my vote is fo

[Python-Dev] Re: PEP 654 except* formatting

2021-10-06 Thread Guido van Rossum
some + expression group as e: … Argh. This would be very easy to overlook. As the senior author of PEP 654 I am going to go with "except*". Since it was shown that "except group" has ambiguous edge cases the proposals have gotten worse, which to me is a good sign that we

[Python-Dev] Re: Python multithreading without the GIL

2021-10-08 Thread Guido van Rossum
To be clear, Sam’s basic approach is a bit slower for single-threaded code, and he admits that. But to sweeten the pot he has also applied a bunch of unrelated speedups that make it faster in general, so that overall it’s always a win. But presumably we could upstream the latter easily, separately

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-08 Thread Guido van Rossum
u can't write "def f x: return x+1" and you can't write "f 42". Allowing the omission of the parentheses here would be inconsistent (even if some other languages allow it). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-08 Thread Guido van Rossum
hat's basically Question 2 - whether to just replace Callable in > the initial PEP (option 1) or to specify a more complete syntax from the > beginning (option 2). > > 5. Serhiy Storchaka > > > How could you replace Callable[..., int] and Callable[Concatenate[str, > P],

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-08 Thread Guido van Rossum
e that it must return something introspectable is the same.) Union objects have an `__args__` attribute that gives the underlying types, and a `__parameters__` attribute giving any type variables. Note that the implementation of this introspectable type should ultimately be in C. -- --Guido van Ross

Re: [Python-Dev] cffi in stdlib

2013-02-26 Thread Guido van Rossum
ense of > the house" for what Python4 means at this point :) > > --David > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://m

Re: [Python-Dev] cffi in stdlib

2013-02-26 Thread Guido van Rossum
AM, Brett Cannon wrote: > > > > On Tue, Feb 26, 2013 at 2:12 PM, Guido van Rossum wrote: >> >> Generally speaking, deferring something to Python 4 means "never". > > > Does that mean your aversion to double digit version numbers (i.e. 3.10) is >

Re: [Python-Dev] Python Language Summit at PyCon: Agenda

2013-03-03 Thread Guido van Rossum
Or at least just a use case that's poorly covered? TBH, your choice of words is ambiguous -- are you interested in overhauling the facilities for testing *of* the standard library (i.e. the 'test' package), or the testing facilities *provided by* the standard library (i.e. the unittest

Re: [Python-Dev] Disabling string interning for null and single-char causes segfaults

2013-03-04 Thread Guido van Rossum
#x27;, x is '' > (True, False) Code that relies on this is incorrect (the language doesn't guarantee interning) but nevertheless given the intention of the implementation, that behavior of encode() is also a bug. -- --Guido van Rossum (python.org/~guido)

Re: [Python-Dev] VC++ 2008 Express Edition now locked away?

2013-03-06 Thread Case Van Horsen
On Wed, Mar 6, 2013 at 2:20 AM, Terry Reedy wrote: > Clicking this link > http://www.microsoft.com/en-us/download/details.aspx?id=14597 > on this Developer Guide page > http://docs.python.org/devguide/setup.html#windows > now returns a > "We are sorry, the page you requested cannot be found." > pa

Re: [Python-Dev] VC++ 2008 Express Edition now locked away?

2013-03-06 Thread Case Van Horsen
On Wed, Mar 6, 2013 at 3:32 PM, Terry Reedy wrote: > On 3/6/2013 12:29 PM, Steve Dower wrote: >> >> From: Case Van Horsen > > >>> The "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1" >>> is still available for download. It includes

Re: [Python-Dev] Matching __all__ to doc: bugfix or enhancement?

2013-03-14 Thread Guido van Rossum
ng code that does: > > from timeit import * > > May break. The above may not be the recommended best practice in Python, but > it's perfectly valid and widely used. > > Eli > > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mai

Re: [Python-Dev] [Python-checkins] peps: New DSL syntax and slightly changed semantics for the Argument Clinic DSL.

2013-03-18 Thread Guido van Rossum
ConvArg { arg_name = path_converter, >arg_type = int (*converter)(PyObject *, void *) >arg_use_ptr = false }, > MainArg { arg_name = path, >arg_type = path_t, >

Re: [Python-Dev] can't assign to function call

2013-03-18 Thread Guido van Rossum
of brackets for indexing and a > dictionary lookup. However it is too late to discuss this idea. > > > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscri

Re: [Python-Dev] [Python-checkins] peps: Update for 436, explicitly supporting positional parameters forever, amen.

2013-03-18 Thread Guido van Rossum
rough as the Python default and the annotation would be left blank. Right. In fact, I think the decision of what (if anything) should be put in the annotation should be up to the converter class. It can be a specific method on the converter object. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] [Python-checkins] cpython (2.7): Issue #9090 : Error code 10035 calling socket.recv() on a socket with a timeout

2013-03-19 Thread Guido van Rossum
the same way? It has the same issue of popping up, rarely, when you least expect it, and messing with your code. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-

Re: [Python-Dev] IDLE in the stdlib

2013-03-20 Thread Guido van Rossum
x27;s Python core. > Getting things committed in Python is not easy, and even if we get a sudden > influx of good patches (which I doubt) these will take time to review and > get committed. In an outside project there's much less friction. > > IDLE would be a great first foray into t

Re: [Python-Dev] IDLE in the stdlib

2013-03-20 Thread Guido van Rossum
owever we should switch to bundling the separate project's output rather than bundling the increasingly broken version in the stdlib. What other distributors do is outside our control, but we ought to recommend them to do the same. -- --Guido van Rossum (python.org/~guido) __

Re: [Python-Dev] IDLE in the stdlib

2013-03-20 Thread Guido van Rossum
On Wed, Mar 20, 2013 at 12:38 PM, Barry Warsaw wrote: > On Mar 20, 2013, at 12:31 PM, Guido van Rossum wrote: > > >Agreed that the "sync into stdlib" think should not happen, or should at > >best be a temporary measure until we can remove idle from the source > >

Re: [Python-Dev] Can we triple quoted string as a comment?

2013-03-26 Thread Guido van Rossum
be used as comments. > > -- > ~Ethan~ > > __**_ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/**mailman/listinfo/python-dev<http://mail.python.org/mailman/listinfo

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-03 Thread Guido van Rossum
underlying base class to remove the special treatment. -- --Guido van Rossum (python.org/~guido ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-04 Thread Guido van Rossum
expect > that Foo(x) will return a Foo object, not a Bar object. Why should int > be any different? What have I missed here? > A class can define a __new__ method that returns a different object. E.g. (python 3): >>> class C: ... def __new__(cls): return 42 ... >>> C()

Re: [Python-Dev] relative import circular problem

2013-04-04 Thread Guido van Rossum
in a package whose __init__.py imports them in the desired order.) I don't really see what we could change to avoid breaking code in any particular case -- the burden is up to the library to do it right. I don't see a reason to forbid any of this either. -- --Guido van Rossum (python.org/

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-04 Thread Guido van Rossum
On Thu, Apr 4, 2013 at 8:01 AM, Chris Angelico wrote: > On Fri, Apr 5, 2013 at 1:59 AM, Guido van Rossum wrote: > > On Thu, Apr 4, 2013 at 7:47 AM, Chris Angelico wrote: > >> Is there any argument that I can pass to Foo() to get back a Bar()? > >> Would anyone expe

Re: [Python-Dev] relative import circular problem

2013-04-04 Thread Guido van Rossum
Redirecting to python-ideas. On Thu, Apr 4, 2013 at 9:26 AM, Richard Oudkerk wrote: > On 04/04/2013 4:17pm, Guido van Rossum wrote: >> >> I don't really see what we could change to avoid breaking code in any >> particular case -- the burden is up to the library to do

Re: [Python-Dev] relative import circular problem

2013-04-04 Thread Guido van Rossum
#x27;t want to compromise on the latter. I do think it would be fine if "from a import b" returned the attribute 'b' of module 'a' if it exists, and otherwise look for module 'a.b' in sys.modules. On Thu, Apr 4, 2013 at 1:28 PM, PJ Eby wrote: > On Thu, Apr

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-04-04 Thread Guido van Rossum
n C using an unsafe cast, and the code that checks for allowable subclasses of int actually ensures such a cast will work. But it still feels wrong; __int__ should be expected to do the work. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing lis

Re: [Python-Dev] relative import circular problem

2013-04-04 Thread Guido van Rossum
+1 on Brett and PJE just doing this. On Thu, Apr 4, 2013 at 3:38 PM, Brett Cannon wrote: > > > > On Thu, Apr 4, 2013 at 5:00 PM, PJ Eby wrote: >> >> On Thu, Apr 4, 2013 at 4:42 PM, Guido van Rossum wrote: >> > I do think it would be fine if "from a import

Re: [Python-Dev] Is file.readlines(sizehint=N) broken on 2.7?

2013-04-05 Thread Guido van Rossum
om/p/psutil/ > https://code.google.com/p/pysendfile/ > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/py

Re: [Python-Dev] The end of 2.7

2013-04-07 Thread Guido van Rossum
ven Cython) are feeling down on Python 3 because they do not have enough volunteers to help with the port (even though at least for IronPython and Jython, the new str/bytes model is much more suitable than the old), they should apply to the PSF for funding. I believe PyPy is already in the pro

[Python-Dev] casefolding in pathlib (PEP 428)

2013-04-11 Thread Guido van Rossum
re of them may reply-all to this message with more details. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/p

Re: [Python-Dev] casefolding in pathlib (PEP 428)

2013-04-11 Thread Guido van Rossum
On Thu, Apr 11, 2013 at 2:27 PM, Antoine Pitrou wrote: > On Thu, 11 Apr 2013 14:11:21 -0700 > Guido van Rossum wrote: >> Hey Antoine, >> >> Some of my Dropbox colleagues just drew my attention to the occurrence >> of case folding in pathlib.py. Basically, cas

Re: [Python-Dev] casefolding in pathlib (PEP 428)

2013-04-11 Thread Guido van Rossum
On Thu, Apr 11, 2013 at 4:09 PM, Cameron Simpson wrote: > On 11Apr2013 14:11, Guido van Rossum wrote: > | Some of my Dropbox colleagues just drew my attention to the occurrence > | of case folding in pathlib.py. Basically, case folding as an approach > | to comparing pathnames is fa

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
. But that's not the case here, is it? It's not a bug in the class, it's a bug in the call site. So I agree it ought to be TypeError. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://m

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
On Fri, Apr 12, 2013 at 9:34 AM, Guido van Rossum wrote: > To me, NotImplementedError means that a subclass didn't implement > something it should have implemented. But that's not the case here, is > it? It's not a bug in the class, it's a bug in the call site

Re: [Python-Dev] casefolding in pathlib (PEP 428)

2013-04-12 Thread Guido van Rossum
024 IIRC). But short names pretty much require consulting the filesystem, so we can probably ignore them. I guess the bottom line is that, no matter how hard pathlib tries, apps cannot always rely on the predictions about filename validity or equivalence made by pathlib -- we'll have to

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
On Fri, Apr 12, 2013 at 12:26 PM, Barry Warsaw wrote: > On Apr 12, 2013, at 09:43 AM, Guido van Rossum wrote: > >>I do wonder about this passage in the PEP: >> >>> Let's say you wanted to encode an enumeration value in a database. You >>> might want to

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
types: object() < object() > > Now, you could *further* require that the type of enum values be > sortablebut that point you really have no excuse for not allowing > enum values to be compared :) > > --David > _______ > Python-Dev mailing list > Python-Dev@python.org &g

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
On Fri, Apr 12, 2013 at 3:44 PM, Barry Warsaw wrote: > On Apr 12, 2013, at 02:34 PM, Guido van Rossum wrote: > >>So, pragmatically, if e and f are values of the same enum class, >>couldn't e f (where is any comparison operator) defer to >>e.value f.value ? Or is t

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
Well, even better. :-) On Fri, Apr 12, 2013 at 5:13 PM, Glenn Linderman wrote: > On 4/12/2013 3:59 PM, Guido van Rossum wrote: > > class Insect(Enum): > wasp = 1 > bee = 1 > ant = 2 > > We'd have Insect.wasp == Insect.bee < Insect.ant but Insect.wasp

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-12 Thread Guido van Rossum
ms that I get in Python 3 from > non-enums. That is, if enums X.a and X.b happen to both be ints, or both > strings, then comparisons should succeed, but if they are different types, I > should get a TypeError. > > The above applies to related enums. If they are unrelated (

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-13 Thread Guido van Rossum
int subclass that does better and use that -- IntEnum is just one example of how you can override the value type of Enum. (And yes, I am now +1 on documenting this mechanism.) -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-13 Thread Guido van Rossum
So clearly the ree expectation is that they compare equal (if the values are). On Apr 13, 2013 11:24 AM, "Scott Dial" wrote: > On 4/12/2013 10:51 PM, Steven D'Aprano wrote: > > And two examples from asm-generic/errno.h: > > > > #define EWOULDBLOCK EAGAIN /* Operation would block */ > > #defi

Re: [Python-Dev] Deciding against the CLA

2013-04-15 Thread Guido van Rossum
er what | > `\mnemonic means, you've got a problem.” —Larry Wall | > _o__) | > Ben Finney > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/p

Re: [Python-Dev] Destructors and Closing of File Objects

2013-04-15 Thread Guido van Rossum
; >-Nikolaus > > -- > »Time flies like an arrow, fruit flies like a Banana.« > > PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C > > ___ > Python-Dev mailing list > Python-Dev@python.org > http:/

Re: [Python-Dev] A decade as a core dev

2013-04-18 Thread Guido van Rossum
gh this list are priceless. > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-20 Thread Guido van Rossum
gt;> B.a >> B.b >> B.c >> >>> from flufl.enum import IntEnum >> >>> C = IntEnum('C', 'c b a') >> >>> C >> >> >>> for item in C: print(item) >> ... >> C.c >> C.b >

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-21 Thread Guido van Rossum
rg > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http:

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-21 Thread Guido van Rossum
we *will* get bug > reports/enhancement requests to fix it, on a regular basis. We can choose > to live with that, but we should admit that it will will happen :) I'm convinced. I also think that 2/3 compatibility is not as important as getting it right for the foreseeable future. --

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-22 Thread Guido van Rossum
--Guido van Rossum (sent from Android phone) On Apr 22, 2013 6:09 PM, "R. David Murray" wrote: > > On Tue, 23 Apr 2013 11:16:20 +1200, Greg Ewing < greg.ew...@canterbury.ac.nz> wrote: > > Victor Stinner wrote: > > > The last proposition is to add transform

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-22 Thread Guido van Rossum
rs to all of these, and your rhetoric is not appreciated. The special status is for the translation between bytes and Unicode characters (code points). There are many contexts where a byte stream is labeled (either separately or in-line) as being encoded using some specific encoding. -- --Guido va

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-23 Thread Guido van Rossum
that the builtin help() function always displays the class's > __doc__, even when called on an instance which has its own __doc__. > > Regards > > Antoine. > > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-23 Thread Guido van Rossum
On Tue, Apr 23, 2013 at 8:31 AM, R. David Murray wrote: > On Tue, 23 Apr 2013 08:11:06 -0700, Guido van Rossum wrote: >> I gotta say, I'm with Antoine here. It's pretty natural (also coming >> from other languages) to assume that the class used to define the >> enu

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-23 Thread Guido van Rossum
odec interfaces, without > enforcing type restrictions. The codec defines the supported > input and output types. As an implementation mechanism I see nothing wrong with this. I hope the codecs module lets you introspect the input and output types of a codec given by

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-23 Thread Guido van Rossum
ott > > -- > Scott Dial > sc...@scottdial.com > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/pyt

Re: [Python-Dev] Why can't I encode/decode base64 without importing a module?

2013-04-23 Thread Guido van Rossum
On Tue, Apr 23, 2013 at 9:04 AM, M.-A. Lemburg wrote: > On 23.04.2013 17:47, Guido van Rossum wrote: >> On Tue, Apr 23, 2013 at 8:22 AM, M.-A. Lemburg wrote: >>> Just as reminder: we have the general purpose >>> encode()/decode() functions in the codecs module: &g

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-23 Thread Guido van Rossum
agic, and the only consequences we can reason about are those that are documented as consequences of using this particular kind of magic. I'm not sure that we can implement a hack to prevent MyEnum.a.b from being an alias for MyEnum.b, but even if we cannot prevent that, I don't think we need t

Re: [Python-Dev] slow hg clone of python repo?

2013-04-24 Thread Guido van Rossum
mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
FWIW, If we're going ahead with the plan to make Colors.red an instance of Colors, maybe the class names used in examples should be singular, i.e. isinstance(Color.red, Color)? -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
27;t know what's going on, but it feels like we had this same discussion a week ago, and I still disagree. Disregarding, the C[i] notation, I feel quite strongly that in the following example: class Color(Enum): red = 1 white = 2 blue = 3 orange = 4 the values Color

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
On Thu, Apr 25, 2013 at 3:02 PM, Barry Warsaw wrote: > On Apr 25, 2013, at 02:54 PM, Guido van Rossum wrote: > >>I don't know what's going on, > > Mostly that this is my first opportunity to chime in on the subject. > >>but it feels like we had this sa

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
On Thu, Apr 25, 2013 at 3:29 PM, Barry Warsaw wrote: > On Apr 25, 2013, at 03:19 PM, Guido van Rossum wrote: >>I suppose you were going to propose to use isinstance() overloading, >>but I honestly think that Color.red.__class__ should be the same >>object as Col

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
#x27;t likely to be useful in this context. > 3. Inspired by namedtuple, move the current Enum constructor > functionality to an Enum._make() API (implemented either as a class > method in Enum or as an ordinary method on the metaclass) -- --Guido van Rossum (python.org/~guido) ___

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-25 Thread Guido van Rossum
values are ints and strings, and even the latter could be considered a luxury when compared to other languages' enums. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/lis

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-26 Thread Guido van Rossum
On Fri, Apr 26, 2013 at 10:33 AM, Glenn Linderman wrote: > On 4/25/2013 9:19 PM, Guido van Rossum wrote: > > On Thu, Apr 25, 2013 at 8:39 PM, Glenn Linderman > wrote: > > an enumeration of objects whose class defines __call__ would > not be so weird. > > Seriously? You

Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013-04-26 Thread Guido van Rossum
On Fri, Apr 26, 2013 at 11:17 AM, Eli Bendersky wrote: > On Fri, Apr 26, 2013 at 10:36 AM, Guido van Rossum wrote: >> > On 4/25/2013 9:19 PM, Guido van Rossum wrote: >> I think you've lost track of the Zen of Python. > > I feel that this thread has lost track of it l

<    12   13   14   15   16   17   18   19   20   21   >