[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-07 Thread Steven D'Aprano
On Tue, Sep 07, 2021 at 08:09:33PM -0700, Barry Warsaw wrote: > I think Nick is on board with bytes.fromint() and no bchr(), and my > sense of the sentiment here is that this would be an acceptable > resolution for most folks. Ethan, can you reconsider? I haven't been completely keeping up wit

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-09 Thread Steven D'Aprano
On Thu, Sep 09, 2021 at 10:57:26AM +0200, Victor Stinner wrote: > I propose to rename PEP 467 method bytes.fromint(n) to => > bytes.fromchar(n) <= to convert an integer to a single *character*: it > fails if n is not in the [0; 255] range. "char" comes from > "character", as "bchr()" means "bytes

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-09 Thread Steven D'Aprano
On Wed, Sep 08, 2021 at 05:06:08PM -, Brandt Bucher wrote: > Steven D'Aprano wrote: > > To me, it sounds like should be the opposite of int.from_bytes. > > >>> int.from_bytes(b'Hello world', 'little') > > 121404708502361365413651784

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-09 Thread Steven D'Aprano
On Thu, Sep 09, 2021 at 12:29:46AM +0100, Rob Cliffe via Python-Dev wrote: > Why not byte() ? Too easy to typo it as bytes(). -- Steve ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org ht

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

2021-09-14 Thread Steven D'Aprano
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 recommended that iterators also define `__iter__`. > > In "standards" language, I think (A) is MUST and (B) is merely OUGHT o

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

2021-09-14 Thread Steven D'Aprano
If it helps, I have tons of code that tests for iterators using: iter(obj) is obj That has been a documented requirement for the iterator protocol forever. Its in the PEP. "A class that wants to be an iterator should implement two methods: a next() method that behaves as described above, a

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

2021-09-14 Thread Steven D'Aprano
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" :-( > > > > It's still an iterator, since it duck-types in most cases where an iterator > is required (notably "for", which is the primary

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

2021-09-15 Thread Steven D'Aprano
On Tue, Sep 14, 2021 at 04:50:05PM -0700, Guido van Rossum wrote: > TBH I don't think there is an *actual* problem here. I think it's just > about choosing the right wording for the glossary (which IMO does not have > status as a source of truth anyway). +1 -- Steve ___

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

2021-09-15 Thread Steven D'Aprano
On Wed, Sep 15, 2021 at 08:57:58AM -0700, Guido van Rossum wrote: [...] > Yes, we all understand that. The reason I invoked "duck typing" is that as > long as you don't use the iterator in a situation where iter() is called on > it, it works fine. Just like a class with a readline() method works f

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

2021-09-15 Thread Steven D'Aprano
On Wed, Sep 15, 2021 at 04:01:31PM -0700, Guido van Rossum wrote: > Steven's class A is the kind of class a custom sequence might return from > its __iter__ method. E.g. > > class S: > def __iter__(self): > return A() Correct, where A itself has a `__next__` method but no `__iter__`

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

2021-09-25 Thread Steven D'Aprano
On Sun, Sep 26, 2021 at 01:14:18AM +0200, jack.jan...@cwi.nl wrote: > I’m getting increasingly worried about the future of Python, That Python will become even more popular? TIOBE: second place, 0.16% below C. PYPL: first place, 12.3% above Java. RedMonk: equal second with Java. https://www.t

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

2021-10-03 Thread Steven D'Aprano
On Sun, Oct 03, 2021 at 04:47:57PM +0100, Irit Katriel via Python-Dev wrote: > We wonder if people have a view on which of the following is clearer/better: > > 1. except *E as e: // except *(E1, E2) as e: That looks like you're unpacking the tuple (E1, E2), and that's just misleading and wrong

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

2021-10-03 Thread Steven D'Aprano
On Sun, Oct 03, 2021 at 11:34:55AM -0700, Guido van Rossum wrote: > I also think that the bar should be pretty high before we reopen the > *syntax* -- the PEP was approved without anyone (neither the SC, nor > Nathaniel, nor anyone else) providing any feedback on the use of 'except > *'. So I thin

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

2021-10-04 Thread Steven D'Aprano
On Mon, Oct 04, 2021 at 09:03:54AM -0700, Guido van Rossum wrote: > The question was about which style to *recommend* (a la PEP-8). Quote: "At the moment * is a separate token so both are allowed, but we could change that (e.g., make except* a token)" If that is mistaken, that's fine, no harm d

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

2021-10-04 Thread Steven D'Aprano
On Mon, Oct 04, 2021 at 07:31:10PM +0100, Steve Dower wrote: > To me, the "*name" looks most similar to how we write "*args" in a > function definition, so I'd go for that. That's exactly why we *shouldn't* go for that option. That is going to confuse a lot of people that it is sequence unpackin

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

2021-10-05 Thread Steven D'Aprano
On Tue, Oct 05, 2021 at 11:17:25AM -0400, Calvin Spealman wrote: > On Tue, Oct 5, 2021 at 10:51 AM Patrick Reader <_...@pxeger.com> wrote: > > > On 03/10/2021 16:47, Irit Katriel via Python-Dev wrote: > > > > 1. except *E as e: // except *(E1, E2) as e: > > 2. except* E as e: // except* (E1, E

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

2021-10-08 Thread Steven D'Aprano
Hi Sam, On Thu, Oct 07, 2021 at 03:52:56PM -0400, Sam Gross wrote: > I've been working on changes to CPython to allow it to run without the > global interpreter lock. I'd like to share a working proof-of-concept that > can run without the GIL. Getting Python to run without the GIL has never been

Re: [Python-Dev] A new webpage promoting Compiler technology for CPython

2013-02-15 Thread Steven D'Aprano
e-Python implementation of a Python bytecode execution virtual machine", and SPARK, which has been stuck in version 0.7 pre-alpha for years. I am astonished that you think PyPy is too immature or niche for this list. http://compilers.pydata.org/ -- Steven __

Re: [Python-Dev] Fwd: PEP 426 is now the draft spec for distribution metadata 2.0

2013-02-19 Thread Steven D'Aprano
t;some-package-manager install spam.py". For the avoidance of doubt, this is *not* a veiled request for "everything" to be in the stdlib, since that is impractical and stupid, just a reminder that the stdlib is still important and that no matter how easy packaging becomes, it will

Re: [Python-Dev] XML DoS vulnerabilities and exploits in Python

2013-02-20 Thread Steven D'Aprano
cases which are not impacted by your security rules. Bugfix releases shouldn't break those use cases, which means the security features should be mostly opt-in for 2.7 and 3.3. I think that is reasonable. Insecure by default or not, code should not suddenly stop working becau

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

2013-02-28 Thread Steven D'Aprano
ribution clause from Apache 2.0 license If you are correct, that may be a real issue that needs to be resolved. If this issue has been discussed before, can you point me to a previous discussion please? -- Steven ___ Python-Dev mailing list Python-Dev@

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

2013-02-28 Thread Steven D'Aprano
job. In any case, until Anatoly replies with details, this counts as nothing more than an unsubstantiated, vague accusation. Over to you Anatoly... -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

Re: [Python-Dev] Introducing Electronic Contributor Agreements

2013-03-06 Thread Steven D'Aprano
'm not going to start acting differently towards others. I view legally covering our ass by having someone fill in a form is worth the potential loss of some contribution in the grand scheme of things. Pardon my ignorance, but how does a CLA protect us i

Re: [Python-Dev] FileCookieJars

2013-03-08 Thread Steven D'Aprano
27;t even instantiate the subclass, that's a pretty major violation for no apparent benefit :-) -- Steven ___ 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] can't assign to function call

2013-03-18 Thread Steven D'Aprano
On 19/03/13 00:50, Neal Becker wrote: def F(x): return x x = 2 F(x) = 3 F(x) = 3 SyntaxError: can't assign to function call Do we really need this restriction? There do exist other languages without it. What meaning would you give to "F(x) = 3", and wh

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

2013-03-18 Thread Steven D'Aprano
reverse the order of the arg, val in any such hypothetical __setcall__, so as to support functions with zero or more arguments: f(*args, **kwargs) = val <=> f.__setcall__(val, *args, **kwargs) -- Steven ___ Python-Dev mailing list

Re: [Python-Dev] IDLE in the stdlib

2013-03-20 Thread Steven D'Aprano
of a beginner on the tu...@python.org mailing list being utterly confused by Python's Unicode handling because the Windows command prompt is unable to print Unicode strings. Thanks Terry. -- Steven ___ Python-Dev mailing list Python-Dev@

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

2013-04-03 Thread Steven D'Aprano
e shouldn't care whether the type of the instance is the superclass or subclass, at least not in general.) -1 on forcing __int__, __str__, __float__ etc. to return instances of the built-in types. -- Steven ___ Python-Dev mailing list Pytho

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

2013-04-03 Thread Steven D'Aprano
n = int(something) assert type(n) is int I haven't cared about checking type identity since "Unifying types and classes" way back in Python 2.2, and I don't see why we should enforce a more restrictive rule now. -- Steven ___ Pytho

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

2013-04-03 Thread Steven D'Aprano
27;m always game to learn something. Challenge accepted. # Force a string subclass s to a built-in string. ''.join(s) # Force an int subclass n to a built-in int. (0).__add__(n) # And similarly for float subclass. 0.0.__add__(x) -- Steven ___

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

2013-04-03 Thread Steven D'Aprano
aren't constant, and can be rebound by anything, but others apparently don't care. You hate the idea that int() might return an instance of a subclass, and I think that's a feature, not a bug. -- Steven ___ Python-Dev mail

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

2013-04-04 Thread Steven D'Aprano
tee to return a builtin int. I thought it already did make that guarantee. -- Steven ___ 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] The end of 2.7

2013-04-07 Thread Steven D'Aprano
By memory, which may not be entirely accurate.] -- Steven ___ 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] The end of 2.7

2013-04-07 Thread Steven D'Aprano
en or eight years, and didn't migrate to Python 2 until 2.3. Why? Because that's what came standard on my Linux distro of choice. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Un

Re: [Python-Dev] The end of 2.7

2013-04-07 Thread Steven D'Aprano
On 08/04/13 07:41, Barry Warsaw wrote: I talked to someone at Pycon who was still using Python 1.5, which is probably older than some of the people on this list ;). Awesome! :-) -- Steven ___ Python-Dev mailing list Python-Dev@python.org http

Re: [Python-Dev] Multiline Strings confusion it tutorial

2013-04-12 Thread Steven D'Aprano
next time. I've done it this time. -- Steven ___ 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-12 Thread Steven D'Aprano
e.g. Colours.red < Insects.ant) then I think TypeError is appropriate. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python

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

2013-04-12 Thread Steven D'Aprano
hbyts4t%28v=vs.80%29.aspx And two examples from asm-generic/errno.h: #define EWOULDBLOCK EAGAIN /* Operation would block */ #define EDEADLOCK EDEADLK What's the justification for this restriction? I have looked in the PEP, and didn

Re: [Python-Dev] Deciding against the CLA

2013-04-14 Thread Steven D'Aprano
to contribute to the distribution As someone who cannot in good faith sign the CLA, that characterisation is far from accurate: I would very much like to contribute to the Python distribution, and so have not decided as you describe. Could you explain, briefly, why you cannot sign

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

2013-04-20 Thread Steven D'Aprano
On 21/04/13 05:42, Barry Warsaw wrote: On Apr 13, 2013, at 12:51 PM, Steven D'Aprano wrote: I think that's too strong a restriction. I would expect to be able to do this: class Insect(Enum): wsap = 1 # Oops, needed for backward compatibility, do not remove. wasp = 1 #

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

2013-04-21 Thread Steven D'Aprano
= Insect.wasp Hmmm, I must have missed this. That satisfies my use-cases. Objection withdrawn. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman

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

2013-04-22 Thread Steven D'Aprano
t is no burden to have to import a module and call an external function for some transformations, why have encode and decode methods at all? If you haven't read this, you should: http://lucumr.pocoo.org/2012/8/11/codec-confusion/ -- Steven ___

Re: [Python-Dev] NoneType(None) raises exception

2013-04-25 Thread Steven D'Aprano
on. On the other hand, NoneType(x) for any other x ought to fail. -- Steven ___ 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 Steven D'Aprano
thing or a bad thing, I leave up to others to decide... -- Steven ___ 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-26 Thread Steven D'Aprano
m if you believe that subclassing == taxonomy hierarchy. It isn't. http://pyvideo.org/video/879/the-art-of-subclassing -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://

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

2013-04-27 Thread Steven D'Aprano
lf.original = obj class Example(metaclass=MetaEnum): red = 1 blue = 2 green = lambda: 'good lord, even functions can be enums!' def __init__(self, count=3): self.count = count food = skip('spam') @skip def spam(self): return self.coun

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Steven D'Aprano
2013-April/125641.html Even if the Enum class doesn't support this feature, I ask that it be written in such a way that a subclass could add it (i.e. please expose a public method for deciding what to exclude). -- Steven ___ Python-Dev mailing

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Steven D'Aprano
On 29/04/13 10:29, Ethan Furman wrote: On 04/28/2013 04:37 PM, Steven D'Aprano wrote: On Sun, Apr 28, 2013 at 12:32 PM, Ethan Furman wrote: - should an enum item be selectable via __call__ instead of __getitem__ (i.e. Seasons(3) is AUTUMN) Does anyone know why this is even an issu

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-28 Thread Steven D'Aprano
carry over to actual enums. Should I reset my thinking and use == with flufl.enums? -- Steven ___ 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] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Steven D'Aprano
tee: isinstance(Color.red, Color) # True, possibly using __instancecheck__ Since red is not defined by MoreColor, there's no reason to expect that it will be a MoreColor instance. As far as I understand it, there is no guarantee that isinstance(MoreColor.red, MoreColor) will be true,

Re: [Python-Dev] enum discussion: can someone please summarize open issues?

2013-04-29 Thread Steven D'Aprano
should be prohibited. I objected, and Nick pointed out that although declaring two enums with the same value inside the class is prohibited, aliases are supported by adding them from the outside: class Color(Enum): red = 1 blue = 2 Color.green = Color.red which satisfies me.

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Steven D'Aprano
the base type and not vice versa." Confusing for who, and why? You're going to confuse *somebody* no matter what you do. Either: - confuse people who try to subclass enums, and can't; or - confuse people who try to subclass enums, and can, but then get confused by the result.

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Steven D'Aprano
and Kotlin allow subclassing enums in exactly the way we're talking about. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/pytho

Re: [Python-Dev] Enumeration items: `type(EnumClass.item) is EnumClass` ?

2013-04-29 Thread Steven D'Aprano
Mailman for many years, and I would like to hear Barry's opinion on this. -- Steven ___ 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] Enumeration items: mixed types?

2013-04-29 Thread Steven D'Aprano
erent from having a list [1, 'really big country', (8273.199, 517)]. Lists can deal with it, but if you pass a list of arbitrary types to something that expects a list of ints, it will complain. -- Steven ___ Python-Dev mailing list Python

Re: [Python-Dev] Getting a list of registered codecs

2013-04-30 Thread Steven D'Aprano
> > FWIW, I picked this up when I was looking at writing a simple encoding > converter, and I wanted to add a flag to list what conversions were > supported. This may be of help: http://hg.python.org/releasing/3.3.1/file/tip/Tools/uni

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Steven D'Aprano
ented behaviour is completely different from the documented behaviour. What gives? Given the vast number of words written about enum values being instances of the enum class, I'm surprised that your proto-PEP doesn't seem to mention one word about that. All it says is that enum values are

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Steven D'Aprano
On 02/05/13 01:09, Ethan Furman wrote: New repo to avoid confusion: https://bitbucket.org/stoneleaf/ref435 Apparently I have to log in before I can even see the repo. Not going to happen. -- Steven ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] PEP-435 reference implementation

2013-05-01 Thread Steven D'Aprano
ed to work, and the documentation warns against it. http://docs.python.org/3/library/functions.html#locals -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.o

Re: [Python-Dev] Enum: subclassing?

2013-05-01 Thread Steven D'Aprano
to add or extend methods, no different to any other class. -- Steven ___ 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 reference implementation

2013-05-01 Thread Steven D'Aprano
t duplicates something in Color. flag_colors will now contain both duplicates, since enum values from different enums never compare equal, but that's probably not what you want. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://

Re: [Python-Dev] Tightening up the specification for locals()

2013-05-02 Thread Steven D'Aprano
eeds to write to locals(), they can target an implementation that provides that feature. -- Steven ___ 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] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

2013-05-03 Thread Steven D'Aprano
ople don't like the special attribute scheme). The problem is that this is not an expression, it is a statement. The advantage of the convenience function is not just that it is shorter, but that it is an expression. -- Steven ___ Python-D

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Steven D'Aprano
f file associations. Many official Microsoft file extensions are four or more letters, e.g. docx. I don't see any value in making long-lasting decisions on file extensions based on (transient?) bugs that aren't our responsibility. -- Steven _

Re: [Python-Dev] PEP 4XX: pyzaa "Improving Python ZIP Application Support"

2013-05-03 Thread Steven D'Aprano
On 04/05/13 15:13, Stephen J. Turnbull wrote: Steven D'Aprano writes: > > Rather than risk obscure bugs, I would suggest restricting the extensions > > to 3 characters. For the “Windowed Python ZIP Applications” case, could we > > use .pzw as the extension instead

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Steven D'Aprano
statement, not an expression. As for pickling, the usual restrictions on pickling apply. It's not like the functional API creates new and unexpected restrictions. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.

Re: [Python-Dev] PEP 435 - requesting pronouncement

2013-05-05 Thread Steven D'Aprano
ility with (e.g.) C enums is an important use-case for these, and in that case you likely will care about the actual value. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] PEP 435: pickling enums created with the functional API

2013-05-07 Thread Steven D'Aprano
or: Can't pickle : attribute lookup __main__.Foo failed I don't think it is unreasonable to chalk it up to a limitation of pickle, and say that unless you can meet certain conditions, you won't be able to pickle your instance. Either way, approval of PEP 435 should

Re: [Python-Dev] this python string literals documentation couldn't explain me: single quote presence inside double quoted string and viceversa. Can Anyone explain me?

2013-05-08 Thread Steven D'Aprano
s, it is not the literal BNF grammar used by the compiler to compile Python's parser. For brevity and simplicity, some definitions may be simplified. -- Steven ___ 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] Best practices for Enum

2013-05-14 Thread Steven D'Aprano
t the object's repr." Bad: "Doctests look at an object's repr, unless the object is an Enum, when it will look at the enum's value." If I want a test that checks the enum's value, then I will write a doctest that explicit

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Steven D'Aprano
er to use those new features; even with older Python's via unittest2 on pypi. And that's great, it really is, I'm not being sarcastic. But unit testing is not in competition to doc testing, they are complimentary, not alternatives. If you're not using both, then you

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Steven D'Aprano
7;t offer me facilities to edit interactive prompt session snippets. Your text editor doesn't allow you to edit text? Even Notepad allows that! Seriously, what editor are you using that doesn't allow you to edit pasted snippets? -- Steven __

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-20 Thread Steven D'Aprano
vant details don't help, they hinder, and I suggest that the KeyError is irrelevant. -- Steven ___ 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] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Steven D'Aprano
On 20/05/13 23:38, Antoine Pitrou wrote: On Mon, 20 May 2013 23:32:10 +1000 Steven D'Aprano wrote: On 20/05/13 20:45, Antoine Pitrou wrote: On Sat, 18 May 2013 23:41:59 -0700 Raymond Hettinger wrote: We should continue to encourage users to make thorough unit tests and to leave doc

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-23 Thread Steven D'Aprano
, providing the cause of failure is still appreciated by the user who's trying to figure out what, exactly, went wrong. For the record, that is the implementation used in Python 3.3.0rc3, so "at some point" is actually very recently. -- Steven

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-23 Thread Steven D'Aprano
, anyone with the conceit that their library or module may someday be in the standard library cannot afford to use annotations at all. So I'm tentatively +1 on allowing the annotation form in addition to the decorator argument form. -- S

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions

2013-05-23 Thread Steven D'Aprano
llowing multiple types to be registered in one call. -- Steven ___ 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 443 - Single-dispatch generic functions

2013-05-24 Thread Steven D'Aprano
On 24/05/13 15:09, Nick Coghlan wrote: On Fri, May 24, 2013 at 8:40 AM, Steven D'Aprano wrote: I don't think that they will. Being able to register multiple types with a single call reads very naturally to me, while multiple decorators still looks weird. Even after many years of seei

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions (including ABC support)

2013-05-25 Thread Steven D'Aprano
rator, taking a type paramater Typo: /s/paramater/parameter/ and decorating a function implementing the operation for that type.""" Otherwise, +1 on the doc changes suggested. Thanks PJ and Łukasz for seeing this one through. -- Steven

Re: [Python-Dev] PEP 409 and the stdlib

2013-05-28 Thread Steven D'Aprano
the invalid character, and I hope that we all agree that it is, then the binascii.Error message should explicitly show that character, rather than rely on the implementation implicitly showing it as a side-effect. -- Steven ___ Python-Dev mail

Re: [Python-Dev] PEP 443 - Single-dispatch generic functions (including ABC support)

2013-05-28 Thread Steven D'Aprano
enerics? :-) I'm vaguely leaning towards @singledispatch and @singledispatch.method for the colour of this bike shed. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://

Re: [Python-Dev] Let's get rid of unbound methods

2013-06-04 Thread Steven D'Aprano
: ... def spam(self): ... pass ... py> X.spam py> X().spam > -- Steven ___ 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] doctest and pickle

2013-06-07 Thread Steven D'Aprano
t __main__ __main__.Fruit = Fruit although that's the sort of thing that makes me think it's time to turn this into a unittest rather than a doctest. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/m

Re: [Python-Dev] stat module in C -- what to do with stat.py?

2013-06-21 Thread Steven D'Aprano
additional work as a result. It's not just established Python implementations. A pure-python standard library makes a good foundation for any future implementations. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.or

Re: [Python-Dev] stat module in C -- what to do with stat.py?

2013-06-21 Thread Steven D'Aprano
very implementation. Even if the re-implementations are individually trivial, it's still a cost for no real gain. Keeping the pure Python implementation also lowers the bar for adding new functions in the future, and for documentation changes. -- Steven __

Re: [Python-Dev] [Python-checkins] cpython (3.3): Add -b and -X options to python man page.

2013-06-24 Thread Steven D'Aprano
to CPython, but just > because it becomes really hard to choose a random letter to add a new > option... I prefer long options, but Python only supports the long > option --help. Is that a policy though? Couldn't Python support long options, or is it prohibited? -- Steven ___

Re: [Python-Dev] End of the mystery "@README.txt Mercurial bug"

2013-06-25 Thread Steven D'Aprano
On 26/06/13 08:44, Victor Stinner wrote: And then I ran "make distclean"... Victor, you're a cruel, cruel man. You've told us everything except the solution to the mystery. -- Steven ___ Python-Dev mailing list Python

Re: [Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores

2013-07-14 Thread Steven D'Aprano
cepted for the std lib unless they have a leading underscore. I suppose for backwards compatibility reasons, we probably can't go through the std lib and rename private modules to make it clear they are private, but we don't have to accept new

Re: [Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores

2013-07-14 Thread Steven D'Aprano
On Mon, Jul 15, 2013 at 10:30:02AM +1000, Nick Coghlan wrote: > On 15 July 2013 09:48, Steven D'Aprano wrote: > > On 14/07/13 21:09, Nick Coghlan wrote: > > > >> Slight adjustment to the proposed wording to ensure completely > >> undocumented &g

Re: [Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores

2013-07-14 Thread Steven D'Aprano
On Mon, Jul 15, 2013 at 10:01:17AM +1000, Cameron Simpson wrote: > On 15Jul2013 09:48, Steven D'Aprano wrote: > | I'd go further, and say that no more private modules should be > | accepted for the std lib unless they have a leading underscore. I > | suppose for backwards

Re: [Python-Dev] Why is the return value of __contains__ coerced to boolean, but that of __lt__ and the like is not?

2013-07-14 Thread Steven D'Aprano
it only ever calls the container: x in y => y.__contains__(x) but never x.__contained_by__(y) -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python

Re: [Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores

2013-07-15 Thread Steven D'Aprano
ve better things to do than PEP9-ify old, working, stable code, but if you want to provide regression tests and a working patch, I'll let you do so" might be an even better one :-) -- Steven ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores

2013-07-16 Thread Steven D'Aprano
es with single-underscore methods, which I take as private. It also has a function simplegeneric, which is undocumented and not listed in __all__. In in the absence of even a comment saying "Don't use this", I take it as an oversight, not policy tha

Re: [Python-Dev] Why does PEP 8 advise against explicit relative imports?

2013-07-16 Thread Steven D'Aprano
dard library* to use explicit relative imports, and that's what PEP 8 is supposed to cover, right? :) If a third-party package uses relative imports, are you suggesting that those rel imports should be turned into absolute imports as a precondition of it being moved into the std lib? -- Steve

[Python-Dev] String terminology [was Re: Misc re.match() complaint]

2013-07-17 Thread Steven D'Aprano
icode strings are 8-bit, as they can be with Python 3.3's flexible string format. I prefer to stick to Unicode or text string, versus byte string. Pedants who point out that "byte" does not necessarily mean 8-bits, and therefore we should talk about octets, will be slapped w

Re: [Python-Dev] Dash

2013-07-18 Thread Steven D'Aprano
d recommends "10 to 50 volts". Optimistically, I think it would probably be safe[1] to replace " -- " or " --- " in text with "\N{THIN SPACE}\N{EM DASH}\N{THIN SPACE}" (or \N{HAIR SPACE} if you prefer) without human review, but for any other changes, I w

Re: [Python-Dev] Dash

2013-07-19 Thread Steven D'Aprano
an the em-dash and is used for quotations in some European languages; – swung dash ⁓ is normally found in dictionaries (paper, not Python) to stand in for the word being defined. But of course different fonts follow these rules to a greater or lesser degree. -- Steven _

Re: [Python-Dev] importing modules

2013-07-29 Thread Steven D'Aprano
than ask here. Regards, -- Steven ___ 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 8 modernisation

2013-08-01 Thread Steven D'Aprano
se if you keep the editor relatively narrow, since now you have a few lines that require horizontal scrolling, which is awful, or line-wrapping, neither of which are palatable. -- Steven ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Steven D'Aprano
imports, but became substantially more :) Before this entire thread be buried in a mountain of controversy over the 79-99 line length issue, let me say thanks Nick and the others for your work on this. -- Steven ___ Python-Dev mailing list Python-Dev

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