Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-26 Thread Steven D'Aprano
On Mon, Jun 25, 2018 at 11:30:24AM +1200, Greg Ewing wrote: > Guido van Rossum wrote: > >Greg seem to be +0 or better for (a) > > Actually, I'm closer to -1 on (a) as well. I don't like := as a > way of getting assignment in an expression. The only thing I would > give a non-negative rating is som

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-26 Thread Steven D'Aprano
On Tue, Jun 26, 2018 at 05:42:43AM +1000, Chris Angelico wrote: > So. sublocal scopes, like in the earliest versions of PEP 572? > > The wheel turns round and round, and the same spokes come up. It isn't as if comprehensions (and generator expressions) run in a proper separate scope. It is

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Tue, Jun 26, 2018 at 10:54:12AM +1200, Greg Ewing wrote: > A decision still needs to be made about whether we *want* > semantics that leak some things but not others. My sense (or bias, if you prefer) is that the answer to that depends on how you word the question. If you talk about "leaking"

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Wed, Jun 27, 2018 at 08:30:00AM +0100, Paul Moore wrote: > On 27 June 2018 at 07:54, Steven D'Aprano wrote: > > Comprehensions already run partly in the surrounding scope. [...] > > Given the code shown: > > > > def test(): > > a = 1 > > b =

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Wed, Jun 27, 2018 at 05:52:16PM +1000, Chris Angelico wrote: > def test(): > a = 1 > b = 2 > vars = {key: locals()[key] for key in locals()} > return vars > > What would your intuition say? Should this be equivalent to dict(locals()) ? That example is so elegant it makes me wa

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Wed, Jun 27, 2018 at 08:00:20AM -0400, Eric V. Smith wrote: > On 6/27/2018 7:08 AM, Chris Angelico wrote: > >It gets funnier with nested loops. Or scarier. I've lost the ability > >to distinguish those two. > > > >def test(): > > spam = 1 > > ham = 2 > > vars = [key1+key2 for key1 in

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Wed, Jun 27, 2018 at 03:41:23PM +0200, Antoine Pitrou wrote: > > Why is this discussion talking about comprehensions at all? > Is there a decent use case for using assignments in comprehensions (as > opposed to language lawyering or deliberate obfuscation)? Yes. The *very first* motivating exa

Re: [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

2018-06-27 Thread Steven D'Aprano
On Wed, Jun 27, 2018 at 05:52:16PM +0300, Ivan Pozdeev via Python-Dev wrote: > >What this means in practice is that assignments will go to different > >scopes depending on *where* they are in the comprehension: > > > > [ expr for x in iter1 for y in iter2 if cond ...] > > [ BB fo

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-29 Thread Steven D'Aprano
On Thu, May 28, 2015 at 05:38:49PM +0100, Paul Moore wrote: > I suspect "single file executables" just aren't viewed as a desirable > solution on Unix. More of an anti-pattern than a pattern. A single file executable means that when you have a security update, instead of patching one library,

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-29 Thread Steven D'Aprano
On Thu, May 28, 2015 at 01:20:06PM -0400, Donald Stufft wrote: > I think it’s an issue for all platforms, even when there is a system Python > that can be used. > > Here’s why: > > * Even on Linux systems Python isn’t always a guaranteed thing to be > installed, >   for instance Debian works ju

Re: [Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

2015-05-29 Thread Steven D'Aprano
On Fri, May 29, 2015 at 07:08:43AM +1000, Nick Coghlan wrote: > On 29 May 2015 05:25, "Chris Barker" wrote: > > > > OK, I'm really confused here: > > > > 1) what the heck is so special about go all of a sudden? People have been > > writing and deploying single file executables built with C and ++,

Re: [Python-Dev] What were the complaints of binary code programmers that not accept Assembly?

2015-06-11 Thread Steven D'Aprano
Hi Françai, This list is for the development of the Python programming language, not Fortran, assembly, or discussions about the early history of programming. Possibly Stackoverflow or one of their related sites might be a better place to ask. Or you could ask on the python-l...@python.org mai

Re: [Python-Dev] Unicode 8.0 and 3.5

2015-06-18 Thread Steven D'Aprano
On Thu, Jun 18, 2015 at 08:34:14PM +0100, MRAB wrote: > On 2015-06-18 19:33, Larry Hastings wrote: > >On 06/18/2015 11:27 AM, Terry Reedy wrote: > >>Unicode 8.0 was just released. Can we have unicodedata updated to > >>match in 3.5? > >> > > > >What does this entail? Data changes, code changes, b

Re: [Python-Dev] Unicode 8.0 and 3.5

2015-06-18 Thread Steven D'Aprano
On Fri, Jun 19, 2015 at 01:55:07AM +0100, MRAB wrote: > On 2015-06-19 00:56, Steven D'Aprano wrote: > >At the very least, there is a change to the casefolding algorithm. > >Cherokee was classified as unicameral but is now considered bicameral > >(two cases, like English

Re: [Python-Dev] Importance of "async" keyword

2015-06-24 Thread Steven D'Aprano
On Wed, Jun 24, 2015 at 11:21:54PM +0200, Sven R. Kunze wrote: > Thanks, Yury, for you quick response. > > On 24.06.2015 22:16, Yury Selivanov wrote: > >Sven, if we don't have 'async def', and instead say that "a function > >is a *coroutine function* when it has at least one 'await' > >expressio

Re: [Python-Dev] Importance of "async" keyword

2015-06-25 Thread Steven D'Aprano
On Thu, Jun 25, 2015 at 05:55:53PM +0200, Sven R. Kunze wrote: > > On 25.06.2015 04:16, Steven D'Aprano wrote: > >On Wed, Jun 24, 2015 at 11:21:54PM +0200, Sven R. Kunze wrote: [...] > >>What is the difference of a function (no awaits) or an awaitable (> 1 &

Re: [Python-Dev] Importance of "async" keyword

2015-07-05 Thread Steven D'Aprano
On Sun, Jul 05, 2015 at 11:50:00PM +0200, Sven R. Kunze wrote: > Seems like we stick to this example once again. So, let me get this > straight: > > 1) I can add, subtract, multiply and divide real numbers. > 2) I can add, subtract, multiply and divide complex numbers. I don't think that this i

Re: [Python-Dev] How far to go with user-friendliness

2015-07-14 Thread Steven D'Aprano
On Tue, Jul 14, 2015 at 02:06:14PM +0200, Dima Tisnek wrote: > https://bugs.python.org/issue21238 introduces detection of > missing/misspelt mock.assert_xxx() calls on getattr level in Python > 3.5 > > Michael and Kushal are of the opinion that "assret" is a common typo > of "assert" and should be

Re: [Python-Dev] How far to go with user-friendliness

2015-07-14 Thread Steven D'Aprano
On Tue, Jul 14, 2015 at 11:09:50PM +1000, Nick Coghlan wrote: > Dima's right that the main defence against this kind of error is > actually linters and IDEs, but detecting this particular one at > runtime is harmless, so there's no particular reason *not* to do it > when it's possible to construct

[Python-Dev] Why wasn't I consulted [was How far to go with user-friendliness]

2015-07-14 Thread Steven D'Aprano
On Wed, Jul 15, 2015 at 10:59:50AM +1000, Nick Coghlan wrote: > Remember folks, "Why wasn't I consulted?!?!?!?" is one of the more > obnoxious behavours we can inflict on fellow open source maintainers > giving us the gift of their time and energy. Nick makes a good point, but it's more complicat

Re: [Python-Dev] How far to go with user-friendliness

2015-07-17 Thread Steven D'Aprano
On Fri, Jul 17, 2015 at 04:37:04PM +1000, Nick Coghlan wrote: > The specific typo that is checked is the only one that changes the > spelling without also changing the overall length and shape of the > word. I don't think your comment above is correct. assert => aasert aseert azzert essert a

Re: [Python-Dev] Status on PEP-431 Timezones

2015-07-27 Thread Steven D'Aprano
On Mon, Jul 27, 2015 at 10:54:02AM +0200, Lennart Regebro wrote: > On Mon, Jul 27, 2015 at 10:47 AM, Paul Moore wrote: > > I'm confused by your position. If it's 7am on the clock behind me, > > right now, then how (under the model proposed by the PEP) do I find > > the datetime value where it will

Re: [Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread Steven D'Aprano
On Wed, Aug 05, 2015 at 06:25:07PM +0300, John Doe wrote: > To pass by reference or by copy of - that is the question from hamlet. > ("hamlet" - a community of people smaller than a village python3.4-linux64) [snip question] John, you have already posted this same question to the tutor list, whe

Re: [Python-Dev] PEP-498: Literal String Formatting

2015-08-10 Thread Steven D'Aprano
On Sun, Aug 09, 2015 at 06:14:18PM -0700, David Mertz wrote: [...] > That said, there *is* one small corner where I believe f-strings add > something helpful to the language. There is no really concise way to spell: > > collections.ChainMap(locals(), globals(), __builtins__.__dict__). I think

Re: [Python-Dev] PEP-498: Literal String Formatting

2015-08-10 Thread Steven D'Aprano
On Sun, Aug 09, 2015 at 06:54:38PM -0700, David Mertz wrote: > Which brought to mind a certain thought. While I don't like: > > f'My name is {name}, my age next year is {age+1}' > > I wouldn't have any similar objection to: > >'My name is {name}, my age next year is {age+1}'.scope_form

Re: [Python-Dev] PEP-498: Literal String Formatting

2015-08-10 Thread Steven D'Aprano
On Mon, Aug 10, 2015 at 09:23:15PM +0200, Guido van Rossum wrote: [...] > Anyway, this generalization from print() is why I want arbitrary > expressions. Wouldn't it be silly if we introduced print() today and said > "we don't really like to encourage printing complicated expressions, but > maybe

Re: [Python-Dev] PEP 498 f-string: please remove the special case for spaces

2015-08-11 Thread Steven D'Aprano
On Tue, Aug 11, 2015 at 09:51:56PM +1000, Chris Angelico wrote: > On Tue, Aug 11, 2015 at 5:08 PM, Cameron Simpson wrote: > > On 11Aug2015 18:07, Greg Ewing wrote: > >> > >> Cameron Simpson wrote: > >>> > >>> To illustrate, there's a consumer rights TV snow here with a segment > >>> called "F.U.

Re: [Python-Dev] updating ensurepip to include wheel

2015-08-16 Thread Steven D'Aprano
On Sun, Aug 16, 2015 at 02:17:09PM +0100, Paul Moore wrote: > Sorry I'm late to this, but I would very much like to see wheel > installed with ensurepip on at least Windows. I seem to be missing something critical to this entire discussion. As I understand it, ensurepip is *only* intended to boo

Re: [Python-Dev] updating ensurepip to include wheel

2015-08-16 Thread Steven D'Aprano
On Sun, Aug 16, 2015 at 10:52:00AM -0400, Donald Stufft wrote: > > So what is the benefit of including wheel with ensurepip? > > pip has an optional dependency on wheel, if you install that optional > dependency than you’ll get the implicit wheel cache enabled by default > which can drastically

Re: [Python-Dev] Rationale behind lazy map/filter

2015-10-13 Thread Steven D'Aprano
On Tue, Oct 13, 2015 at 11:26:09AM -0400, Random832 wrote: > "R. David Murray" writes: > > > On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila > > wrote: > >> Maybe it's just python2 habits, but I assume I'm not the only one > >> carelessly thinking that "iterating over an input a second time w

Re: [Python-Dev] PEP 0484 - the Numeric Tower

2015-10-13 Thread Steven D'Aprano
On Tue, Oct 13, 2015 at 04:37:43PM -0700, Raymond Hettinger wrote: > We could have (and still could) make the choice to always coerce to > decimal (every float is exactly representable in decimal). Further, > any decimal float or binary float could be losslessly coerced to a > Fraction, but th

[Python-Dev] PEP 506 secrets module

2015-10-15 Thread Steven D'Aprano
Hi, As extensively discussed on Python-Ideas, the secrets module and PEP 506 is (I hope) ready for pronouncement. https://www.python.org/dev/peps/pep-0506/ There is code and tests here: https://bitbucket.org/sdaprano/secrets or you can run hg clone https://sdapr...@bitbucket.org/sdaprano/se

Re: [Python-Dev] PEP 506 secrets module

2015-10-16 Thread Steven D'Aprano
On Fri, Oct 16, 2015 at 08:57:24AM +0200, Victor Stinner wrote: > Hi, > > I like the PEP. IMHO it's a better solution than using a CPRNG for > random by default. > > I suggest to raise an error if token_bytes(n) if calls with n < 16 > bytes (128 bits). Well, I'm not sure that 16 is the good compr

Re: [Python-Dev] PEP 506 secrets module

2015-10-16 Thread Steven D'Aprano
On Fri, Oct 16, 2015 at 06:35:14PM +0300, Serhiy Storchaka wrote: > I suggest to add only randrange(). randint() is historical artefact, we > shouldn't repeat this mistake in new module. The secrets module is not > good way to generate dice rolls. In most other cases you need to > generate inte

Re: [Python-Dev] PEP 506 secrets module

2015-10-17 Thread Steven D'Aprano
On Sat, Oct 17, 2015 at 03:26:46AM +1100, Steven D'Aprano wrote: > On Fri, Oct 16, 2015 at 06:35:14PM +0300, Serhiy Storchaka wrote: > > > I suggest to add only randrange(). randint() is historical artefact, we > > shouldn't repeat this mistake in new module. The sec

Re: [Python-Dev] type(obj) vs. obj.__class__

2015-10-17 Thread Steven D'Aprano
On Sat, Oct 17, 2015 at 03:45:19PM -0600, Eric Snow wrote: > In a recent tracker issue about OrderedDict [1] we've had some > discussion about the use of type(od) as a replacement for > od.__class__. [...] > The more general question of when we use type(obj) vs. obj.__class__ > applies to both th

Re: [Python-Dev] type(obj) vs. obj.__class__

2015-10-18 Thread Steven D'Aprano
On Sun, Oct 18, 2015 at 05:35:14PM -0700, David Mertz wrote: > In any case, redefining a method in a certain situation feels a lot less > magic to me than redefining .__class__ That surprises me greatly. As published in the Python Cookbook[1], there is a one-to-one correspondence between the met

Re: [Python-Dev] type(obj) vs. obj.__class__

2015-10-18 Thread Steven D'Aprano
On Mon, Oct 19, 2015 at 11:41:44AM +1100, Chris Angelico wrote: > What does this provide that collections.deque(maxlen=size_max) > doesn't? I'm a little lost. The Ringbuffer recipe predates deque by quite a few years. These days I would consider it only useful in a pedagogical context, giving a

Re: [Python-Dev] [Python-checkins] Daily reference leaks (d7e490db8d54): sum=61494

2015-10-21 Thread Steven D'Aprano
On Wed, Oct 21, 2015 at 10:10:56AM -0700, Ethan Furman wrote: > On 10/21/2015 08:53 AM, Random832 wrote: > > >If a pure python class can cause a reference leak, doesn't that mean it > >is only a symptom rather than the real cause? Or is it that the use of > >@object.__new__ is considered "too clev

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-31 Thread Steven D'Aprano
CC'ing Python-Ideas. Follow-ups to Python-Ideas please. On Thu, Oct 29, 2015 at 09:22:15PM -0400, Terry Reedy wrote: > Leaving IDLE aside, the reason '' is added to sys.path is so that people > can import their own modules. This is very useful. Shadowing is the > result of putting it at the f

Re: [Python-Dev] Second milestone of FAT Python

2015-11-04 Thread Steven D'Aprano
On Wed, Nov 04, 2015 at 09:50:33AM +0100, Victor Stinner wrote: > Hi, > > I'm writing a new "FAT Python" project to try to implement optimizations in > CPython (inlining, constant folding, move invariants out of loops, etc.) > using a "static" optimizer (not a JIT). For the background, see the thr

Re: [Python-Dev] Support of UTF-16 and UTF-32 source encodings

2015-11-14 Thread Steven D'Aprano
On Sat, Nov 14, 2015 at 09:19:37PM +0200, Serhiy Storchaka wrote: > If the support of UTF-16 and UTF-32 is planned, I'll take this to > attention during refactoring. But in many places besides the tokenizer > the ASCII compatible encoding of source files is expected. Perhaps another way of look

Re: [Python-Dev] Python Language Reference has no mention of list comÃprehensions

2015-12-03 Thread Steven D'Aprano
On Thu, Dec 03, 2015 at 09:25:53AM -0800, Andrew Barnert via Python-Dev wrote: > > On Dec 3, 2015, at 08:15, MRAB wrote: > > > >>> On 2015-12-03 15:09, Random832 wrote: > >>> On 2015-12-03, Laura Creighton wrote: > >>> Who came up with the word 'display' and what does it have going for > >>> it

Re: [Python-Dev] Idea: Dictionary references

2015-12-17 Thread Steven D'Aprano
On Thu, Dec 17, 2015 at 12:53:13PM +0100, Victor Stinner quoted: > 2015-12-17 11:54 GMT+01:00 Franklin? Lee : > > Each function keeps an indirect, automagically updated > > reference to the current value of the names they use, Isn't that a description of globals()? If you want to look up a name

Re: [Python-Dev] Idea: Dictionary references

2015-12-18 Thread Steven D'Aprano
On Thu, Dec 17, 2015 at 09:30:24AM -0800, Andrew Barnert via Python-Dev wrote: > On Dec 17, 2015, at 07:38, Franklin? Lee > wrote: > > > > The nested dictionaries are only for nested scopes (and inner > > functions don't create nested scopes). Nested scopes will already > > require multiple look

Re: [Python-Dev] Speeding up CPython 5-10%

2016-01-29 Thread Steven D'Aprano
On Wed, Jan 27, 2016 at 01:25:27PM -0500, Yury Selivanov wrote: > Hi, > > > tl;dr The summary is that I have a patch that improves CPython > performance up to 5-10% on macro benchmarks. Benchmarks results on > Macbook Pro/Mac OS X, desktop CPU/Linux, server CPU/Linux are available > at [1].

Re: [Python-Dev] More optimisation ideas

2016-01-31 Thread Steven D'Aprano
On Sun, Jan 31, 2016 at 08:23:00PM +, Brett Cannon wrote: > So freezing the stdlib helps on UNIX and not on OS X (if my old testing is > still accurate). I guess the next question is what it does on Windows and > if we would want to ever consider freezing the stdlib as part of the build > proce

Re: [Python-Dev] More optimisation ideas

2016-02-04 Thread Steven D'Aprano
On Thu, Feb 04, 2016 at 07:58:30PM -0500, Terry Reedy wrote: > >>For folks that *do* know how to use the terminal: > >> > >>$ python3 -m inspect --details inspect > >>Target: inspect > >>Origin: /usr/lib64/python3.4/inspect.py > >>Cached: /usr/lib64/python3.4/__pycache__/inspect.cpython-34.pyc > >

Re: [Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement

2016-02-08 Thread Steven D'Aprano
On Mon, Feb 08, 2016 at 05:43:25PM -0500, Yury Selivanov wrote: > > > On 2016-02-08 5:19 PM, Terry Reedy wrote: > >On 2/8/2016 4:51 PM, Victor Stinner wrote: > >>2016-02-08 22:28 GMT+01:00 Alexander Walters : > >>>What incantation do you need to do to make that behavior apparent? > >> > >>I didn'

Re: [Python-Dev] Windows: Remove support of bytes filenames in theos module?

2016-02-10 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 12:41:08PM +1100, Chris Angelico wrote: > On Wed, Feb 10, 2016 at 12:37 PM, Steve Dower wrote: > > I really don't like the idea of not being able to use bytes in cross > > platform code. Unless it's become feasible to use Unicode for lossless > > filenames on Linux - last I

Re: [Python-Dev] why we have both re.match and re.string?

2016-02-10 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 10:59:18PM +0100, Luca Sangiacomo wrote: > Hi, > I hope the question is not too silly, but why I would like to understand > the advantages of having both re.match() and re.search(). Wouldn't be > more clear to have just one function with one additional parameters like > t

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-10 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 10:53:09PM +, Paul Moore wrote: > On 10 February 2016 at 22:20, Georg Brandl wrote: > > This came up in python-ideas, and has met mostly positive comments, > > although the exact syntax rules are up for discussion. > > +1 on the PEP. Is there any value in allowing unde

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-10 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 11:20:38PM +0100, Georg Brandl wrote: > This came up in python-ideas, and has met mostly positive comments, > although the exact syntax rules are up for discussion. Nicely done. But I would change the restrictions to a simpler version. Instead of five rules to learn: > T

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-10 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 03:45:48PM -0800, Andrew Barnert via Python-Dev wrote: > On Feb 10, 2016, at 14:20, Georg Brandl wrote: > > First, general questions: should the PEP mention the Decimal constructor? > What about int and float (I'd assume int(s) continues to work as always, > while int(s,

Re: [Python-Dev] Time for a change of random number generator?

2016-02-11 Thread Steven D'Aprano
On Thu, Feb 11, 2016 at 01:08:41PM +1300, Greg Ewing wrote: > The Mersenne Twister is no longer regarded as quite state-of-the art > because it can get into states that produce long sequences that are > not very random. > > There is a variation on MT called WELL that has better properties > in thi

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-11 Thread Steven D'Aprano
On Wed, Feb 10, 2016 at 08:41:27PM -0800, Andrew Barnert wrote: > And honestly, are you really claiming that in your opinion, "123_456_" > is worse than all of their other examples, like "1_23__4"? Yes I am, because 123_456_ looks like you've forgotten to finish typing the last group of digits,

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-11 Thread Steven D'Aprano
On Thu, Feb 11, 2016 at 08:07:56PM +1000, Nick Coghlan wrote: > Given that str.format supports a thousands separator: > > >>> "{:,d}".format(1) > '100,000,000' > > it might be reasonable to permit "_" in place of "," in the format specifier. +1 > However, I'm not sure when you'd use i

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-11 Thread Steven D'Aprano
On Thu, Feb 11, 2016 at 08:50:09PM +0200, Serhiy Storchaka wrote: > I have strong preference for more strict and simpler rule, used by most > other languages -- "only between two digits". Main arguments: > > 1. Simple rule is easier to understand, remember and recognize. I care > not about the

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016-02-11 Thread Steven D'Aprano
On Thu, Feb 11, 2016 at 06:03:34PM +, Brett Cannon wrote: > On Thu, 11 Feb 2016 at 02:13 Steven D'Aprano wrote: > > > On Wed, Feb 10, 2016 at 08:41:27PM -0800, Andrew Barnert wrote: > > > > > And honestly, are you really claiming that in your opinion, "

Re: [Python-Dev] PEP 515: Underscores in Numeric Literals (revision 3)

2016-02-13 Thread Steven D'Aprano
On Sat, Feb 13, 2016 at 09:48:49AM +0100, Georg Brandl wrote: > Hi all, > > after talking to Guido and Serhiy we present the next revision > of this PEP. It is a compromise that we are all happy with, > and a relatively restricted rule that makes additions to PEP 8 > basically unnecessary. > > I

Re: [Python-Dev] Hash randomization for which types?

2016-02-16 Thread Steven D'Aprano
On Tue, Feb 16, 2016 at 11:56:55AM -0800, Glenn Linderman wrote: > On 2/16/2016 1:48 AM, Christoph Groth wrote: > >Hello, > > > >Recent Python versions randomize the hashes of str, bytes and datetime > >objects. I suppose that the choice of these three types is the result > >of a compromise. Ha

Re: [Python-Dev] When should pathlib stop being provisional?

2016-04-05 Thread Steven D'Aprano
I haven't really been following this discussion, but a couple of comments... On Tue, Apr 05, 2016 at 11:47:32PM +, Brett Cannon wrote: > http://www.snarky.ca/why-pathlib-path-doesn-t-inherit-from-str Nice write-up, thanks. [...] > To me it seems to basically be a question of whether peopl

Re: [Python-Dev] When should pathlib stop being provisional?

2016-04-05 Thread Steven D'Aprano
On Wed, Apr 06, 2016 at 10:02:30AM +1000, Chris Angelico wrote: > My personal view on the text/bytes debate is that a path is > fundamentally a human concept, and consists therefore of text. The > fact that some file systems store (at the low level) bytes and some > store (I think) UTF-16 code uni

Re: [Python-Dev] When should pathlib stop being provisional?

2016-04-06 Thread Steven D'Aprano
On Tue, Apr 05, 2016 at 11:53:05PM -0700, Nathaniel Smith wrote: > This makes me twitch slightly, because NumPy has had a whole set of > problems due to the ancient and minimally-considered decision to > assume a bunch of ad hoc non-namespaced method names fulfilled some > protocol -- like all .su

Re: [Python-Dev] When should pathlib stop being provisional?

2016-04-06 Thread Steven D'Aprano
On Wed, Apr 06, 2016 at 11:30:32AM +0200, Petr Viktorin wrote: > Python was in a similar situation with the .next method on iterators, > which changed to __next__ in Python 3. PEP 3114 (which explains this > change) says: > > > Code that nowhere contains an explicit call to a next method can > >

Re: [Python-Dev] PEP 506 secrets module

2016-04-09 Thread Steven D'Aprano
I've just spotted this email from Guido, sorry about the delay in responding. Further comments below. On Thu, Jan 14, 2016 at 10:47:09AM -0800, Guido van Rossum wrote: > I think the discussion petered out and nobody asked me to approve it yet > (or I lost track of it). I'm almost happy to appr

Re: [Python-Dev] Challenge: Please break this! (a.k.a restricted mode revisited)

2016-04-10 Thread Steven D'Aprano
On Sun, Apr 10, 2016 at 08:12:30PM -0400, Jonathan Goble wrote: > On Sun, Apr 10, 2016 at 7:02 PM, Oscar Benjamin > wrote: > > I haven't looked at your sandbox but for a different approach try this one: > > > > L = [None] > > L.extend(iter(L)) > > > > On my Linux machine that doesn't just cras

Re: [Python-Dev] PEP 506 secrets module

2016-04-11 Thread Steven D'Aprano
On Sun, Apr 10, 2016 at 11:43:08AM -0700, Guido van Rossum wrote: > Hi Steven, > > No probIem with the delay -- it's still before 3.6.0. I do think it's > just about a record gap in the PEP review process. :-) > > I will approve the PEP as soon as you've updated the two function > names in the PE

Re: [Python-Dev] Challenge: Please break this! (a.k.a restricted mode revisited)

2016-04-12 Thread Steven D'Aprano
I haven't been following this thread in detail, so perhaps I have missed something, but I have a question... On Tue, Apr 12, 2016 at 02:05:06PM +0200, Victor Stinner wrote: > You don't understand that even if the visible "Python scope", "Python > namespace", or call it as you want (the code tha

[Python-Dev] Should secrets include a fallback for hmac.compare_digest?

2016-04-14 Thread Steven D'Aprano
Now that PEP 506 has been approved, I've checked in the secrets module, but an implementation question has come up regarding compare_digest. Currently, the module tries to import hmac.compare_digest, and if that fails, then it falls back to a Python version. But since compare_digest has been av

Re: [Python-Dev] Should secrets include a fallback for hmac.compare_digest?

2016-04-15 Thread Steven D'Aprano
On Fri, Apr 15, 2016 at 10:26:31AM +0200, Victor Stinner wrote: > It's easy to implement this function (in the native language of your Python > implemenation), it's short. I'm not sure that a Python version is really > safe. > > The secrets module is for Python 3.6, in this version the hmac alread

Re: [Python-Dev] When the infamous Bier trunk hits ... where is our Python backup?

2016-04-21 Thread Steven D'Aprano
On Thu, Apr 21, 2016 at 04:00:29AM -0700, Burkhard Meier wrote: > Well, > > Just a thought. I'm afraid I have no idea what you are referring to. -- Steve ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/pytho

Re: [Python-Dev] Terminal console

2016-04-26 Thread Steven D'Aprano
On Tue, Apr 26, 2016 at 08:45:20AM -0400, Franklin? Lee wrote: > On Apr 26, 2016 4:02 AM, "Paul Moore" wrote: > > > > On 25 April 2016 at 23:55, Franklin? Lee > wrote: > > > FWIW, Gmail's policies require: > > [...] > > > That link is currently the only obvious way to unsubscribe. > > > > I'm not

Re: [Python-Dev] Memory

2016-05-01 Thread Steven D'Aprano
On Sun, May 01, 2016 at 08:08:22AM -0500, Ryan Gonzalez wrote: > Well, I put this in Google Translate...and got this: > > The disk clatters > the Spontie giggles > ~ > hopefully > alliance insures ... > > Not sure if this a useless post or Translate just being weird. Leaning > towards the latter.

Re: [Python-Dev] Need help in OCR implementation with Python3.5.1 or pyCharm Community edition

2016-05-05 Thread Steven D'Aprano
On Thu, May 05, 2016 at 05:23:02PM +0100, MRAB wrote: > On 2016-05-05 16:26, Ryan Gonzalez wrote: > >On Thu, May 5, 2016 at 3:24 AM, Deepak Srivastava [ ... about three or four pages of quoting ... ] > >Questions like this are better suited for python-list. [...] > It looks to me that it's the u

Re: [Python-Dev] Tracker Etiquette

2016-05-08 Thread Steven D'Aprano
On Sat, May 07, 2016 at 04:06:51PM -0700, Ethan Furman wrote: > I just reviewed an issue on the tracker, and found that many, if not > all, of my comments made at the time I completely disagree with (both > now, and before -- I'm going to claim sleep deprivation). > > Obviously I should post a n

Re: [Python-Dev] file system path protocol PEP

2016-05-13 Thread Steven D'Aprano
On Thu, May 12, 2016 at 07:22:25PM +0200, Sjoerd Job Postmus wrote: > The whole point of adding `os.fspath` is to make it easier to use Path > objects. This is in an effort to gain greater adoption of pathlib in > libraries. Now, this is an excellent idea. > > However, if it were to reject bytes,

Re: [Python-Dev] File system path PEP, part 2

2016-05-13 Thread Steven D'Aprano
On Thu, May 12, 2016 at 08:53:12PM +, Brett Cannon wrote: > Second draft that takes Guido's comments into consideration. The biggest > change is os.fspath() now returns whatever path.__fspath__() returns > instead of restricting it to only str. Counter suggestion: - __fspath__() method may r

Re: [Python-Dev] File system path PEP, part 2

2016-05-13 Thread Steven D'Aprano
On Fri, May 13, 2016 at 03:43:29PM +, Brett Cannon wrote: > On Fri, 13 May 2016 at 04:00 Steven D'Aprano wrote: [...] > > - but os.fspath() will only return str; > > - and os.fspathb() will only return bytes; > I prefer what's in the PEP. I get where you coming

Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-27 Thread Steven D'Aprano
On Fri, May 27, 2016 at 04:01:11PM -0700, Guido van Rossum wrote: > Also -- the most important thing. :-) What to call these things? We're > pretty much settled on the semantics and how to create them (A = > NewType('A', int)) but what should we call types like A when we're > talking about them? "N

Re: [Python-Dev] Adding NewType() to PEP 484

2016-05-28 Thread Steven D'Aprano
On Fri, May 27, 2016 at 09:26:29PM -0700, Guido van Rossum wrote: > We discussed this over dinner at PyCon, some ideas we came up with: > > - Dependent types, harking back to a similar concept in Ada > (https://en.wikibooks.org/wiki/Ada_Programming/Type_System#Derived_types) > which in that langu

Re: [Python-Dev] Python parser performance optimizations

2016-05-29 Thread Steven D'Aprano
On Thu, May 26, 2016 at 10:19:05AM +, Artyom Skrobov wrote: [...] > The motivation for this patch was to enable a memory footprint > optimization, discussed at http://bugs.python.org/issue26415 My > proposed optimization reduces the memory footprint by up to 30% on the > standard benchmarks,

Re: [Python-Dev] About 'superobject' and descriptors

2013-10-23 Thread Steven D'Aprano
Hi Hakril, I think this question is probably off-topic for this list. This list is for development of the Python compiler, not for development with Python, and questions like this should probably go to python-l...@python.org (also mirrored as comp.lang.python if you have Usenet access). But I

Re: [Python-Dev] VAX NaN evaluations

2013-11-04 Thread Steven D'Aprano
On Mon, Nov 04, 2013 at 08:47:53PM +, John Klos wrote: [...] > The short answer is to skip those tests on VAXen. The better answer is to > patch any isnan functions to always return false on VAXen and patch any > code which tries to parse, for instance, float("NaN") to use something > uncomm

Re: [Python-Dev] Issue 19332: Guard against changing dict during iteration

2013-11-06 Thread Steven D'Aprano
On Tue, Nov 05, 2013 at 08:38:09PM -0800, Ethan Furman wrote: > http://bugs.python.org/issue19332 Duplicate of this: http://bugs.python.org/issue6017 The conclusion on that also was that it is not worth guarding against such an unusual circumstance. -- Steven

Re: [Python-Dev] Avoid formatting an error message on attribute error

2013-11-06 Thread Steven D'Aprano
On Wed, Nov 06, 2013 at 11:32:33PM +0100, Victor Stinner wrote: > Hi, > > I'm trying to avoid unnecessary temporary Unicode strings when > possible (see issue #19512). While working on this, I saw that Python > likes preparing an user friendly message to explain why getting an > attribute failed.

Re: [Python-Dev] The pysandbox project is broken

2013-11-12 Thread Steven D'Aprano
On Wed, Nov 13, 2013 at 12:58:42AM +0100, Victor Stinner wrote: > I now gave up on sandboxing Python. I just would like to warn other > core developers that trying to put a sandbox in Python is not a good > idea :-) Do you mean CPython? Do you think it would be productive to create an independen

Re: [Python-Dev] unicode Exception messages in py2.7

2013-11-14 Thread Steven D'Aprano
On Thu, Nov 14, 2013 at 04:55:19PM -0500, Tres Seaver wrote: > Fixing any bug is "changing behavior"; 2.7 is not frozen for bugfixes. It's not a given that the current behaviour *is* a bug. Exception messages in 2 are byte-strings, not Unicode. Trying to use Unicode instead is not, as far as I

Re: [Python-Dev] unicode Exception messages in py2.7

2013-11-14 Thread Steven D'Aprano
On Thu, Nov 14, 2013 at 09:09:06PM -0500, Terry Reedy wrote: > 1.5 was around for a long time; not sure if it is completely gone yet. It's not. I forget the details, but after the last American PyCon, somebody posted a message about a fellow they met who was still using 1.5 in production. --

Re: [Python-Dev] unicode Exception messages in py2.7

2013-11-14 Thread Steven D'Aprano
On Thu, Nov 14, 2013 at 04:02:17PM -0800, Chris Barker wrote: > On Thu, Nov 14, 2013 at 1:55 PM, Tres Seaver wrote: > > > Fixing any bug is "changing behavior"; 2.7 is not frozen for bugfixes. > > Thank you. > > > The real question is whether third-party code will break when the > > now-empty

Re: [Python-Dev] unicode Exception messages in py2.7

2013-11-14 Thread Steven D'Aprano
On Fri, Nov 15, 2013 at 02:28:48PM +1100, Cameron Simpson wrote: > > Non-ascii Unicode strings are just a special case of the more general > > problem of what to do if printing the exception raises. If > > str(exception.message) raises, suppressing the message seems like a > > perfectly reasona

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-15 Thread Steven D'Aprano
On Fri, Nov 15, 2013 at 05:13:34PM +1000, Nick Coghlan wrote: > A few things I noticed while implementing the recent updates: > > - as you noted in your other email, while MAL is on record as saying > the codecs module is intended for arbitrary codecs, not just Unicode > encodings, readers of the

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-15 Thread Steven D'Aprano
On Fri, Nov 15, 2013 at 10:22:28AM +0100, Antoine Pitrou wrote: > On Fri, 15 Nov 2013 09:03:37 +1000 Nick Coghlan wrote: > > > > > And add transform() and untransform() methods to bytes and str types. > > > In practice, it might be same codecs registry for all codecs just with > > > a new attribu

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-16 Thread Steven D'Aprano
On Sat, Nov 16, 2013 at 04:46:00PM +0100, Antoine Pitrou wrote: > I agree that conflating the two doesn't help the discussion. > While removing docstrings may be beneficial on memory-constrained > devices, I can't remember a single situation where I've wanted to > remove asserts on a production sy

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-16 Thread Steven D'Aprano
On Sun, Nov 17, 2013 at 01:50:31AM +1000, Nick Coghlan wrote: > No, that's the wrong question to ask. The onus is on *you* to ask "Who > is this feature for? Do they still need it? Can we meet their needs in > a different way?". You're the one proposing to break things, so it's > up to you to make

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-16 Thread Steven D'Aprano
On Sat, Nov 16, 2013 at 11:16:48AM -0500, Donald Stufft wrote: > Personally I think that none of the -O* should be removing asserts. It feels > like a foot gun to me. I’ve seen more than one codebase that would be > completely broken under -O* because they used asserts without even knowing > -O* ex

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Steven D'Aprano
On Sun, Nov 17, 2013 at 11:00:50AM +0100, Antoine Pitrou wrote: > On Sun, 17 Nov 2013 18:04:43 +1100 > Steven D'Aprano wrote: > > On Sat, Nov 16, 2013 at 04:46:00PM +0100, Antoine Pitrou wrote: > > > > > I agree that conflating the two doesn't help the discus

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Steven D'Aprano
On Sun, Nov 17, 2013 at 11:35:21AM +0100, Antoine Pitrou wrote: > You didn't answer my question: did you actually use -OO in production, > or not? Saying that -OO could have helped you optimize something you > didn't care about isn't a very strong argument for -OO :) Ah, sorry, I misunderstood yo

Re: [Python-Dev] Which direction is UnTransform? / Unicode is different

2013-11-20 Thread Steven D'Aprano
On Tue, Nov 19, 2013 at 05:28:48PM -0800, Jim J. Jewett wrote: > > > (Fri Nov 15 16:57:00 CET 2013) Stephen J. Turnbull wrote: > > > Serhiy Storchaka wrote: > > > > If the transform() method will be added, I prefer to have only > > > one transformation method and specify a direction by the

Re: [Python-Dev] PEP process entry point and ill fated initiatives

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 03:25:14PM +, Kristján Valur Jónsson wrote about the PEP process: > > > How about acknowledging that these waters are dark and murky and help > > > making things better? > > > > Well, how about? If Anatoly has a concrete proposal, surely he can propose a > > patch to

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