Re: [Python-ideas] Restore the __members__ behavior to python3 for C extension writers

2017-06-19 Thread Nick Coghlan
ion of suitable descriptors, then the interpreter will automatically take care of populating the results of `dir()` correctly. However, if you're genuinely dynamically adding attributes in `__getattr__`, then you're going to need to add code to report them from `__dir__`

Re: [Python-ideas] ImportError raised for a circular import

2017-06-19 Thread Nick Coghlan
ute lookup code and the IMPORT_FROM opcode implementation, rather than being able to isolate the changes to the import machinery itself. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Pytho

Re: [Python-ideas] Make functools.singledispatch register method return original function.

2017-06-17 Thread Nick Coghlan
ames like "_fun_for_int" and "_fun_for_list" is *significantly* more informative than seeing multiple distinct functions all called "_" or "__". Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Language proposal: variable assignment in functional context

2017-06-17 Thread Nick Coghlan
e as PEP 465's matrix multiplication, but it's also not hard to be more compelling than the limited set of examples I had previously collected :) -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-idea

Re: [Python-ideas] Restore the __members__ behavior to python3 for C extension writers

2017-06-16 Thread Nick Coghlan
the same pattern people use to call a base type's __getattr__ or __getattribute__ for the subclass implementation of those methods, just without multiple inheritance support (since calling super() from C is painful). Cheers, Nick. -- Nick Coghlan | ncogh...@

Re: [Python-ideas] Restore the __members__ behavior to python3 for C extension writers

2017-06-14 Thread Nick Coghlan
/* Add any additional attributes to the dir_result list */ return dir_result; Fully supporting multiple inheritance is more work (as your link shows), and often not needed. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] ImportError raised for a circular import

2017-06-14 Thread Nick Coghlan
hecked that ImportError & AttributeError have compatible binary layouts, so dual inheritance from them works :) -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://m

Re: [Python-ideas] ImportError raised for a circular import

2017-06-13 Thread Nick Coghlan
process of being imported and raise a new CircularImportError that inherited from both AttributeError and ImportError when that was the case. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Pytho

Re: [Python-ideas] Run length encoding

2017-06-10 Thread Nick Coghlan
than using the generator expression return len(list(iterable)) Cheers, Nick. P.S. itertools._grouper objects don't currently provide a length hint, and it would be tricky to add one, since it would need to be based on the number of remaining items in the original sequence, which would it turn d

Re: [Python-ideas] Run length encoding

2017-06-10 Thread Nick Coghlan
tem_count)) It's only encode that is currently missing a clear self-evidently correct spelling, and I think that's more due to the lack of an obvious spelling for "tell me how many items are in this iterable, exhausting it if necessary" than it is to anything else. Cheers, Nick

Re: [Python-ideas] Dictionary destructing and unpacking.

2017-06-08 Thread Nick Coghlan
itation that they're not there? Absolutely, at least for me. Cheers, Nick. P.S. Just clearly not irritating enough for me to actually put a patch together and push for a final decision one way or the other regarding adding them ;) -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia __

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-05 Thread Nick Coghlan
ted to fix the "random has no attribute randint" problem, without any other side effects, we could potentially special case __main__.__file__ in the import system such that we always ignored it, even if it could technically satisfy the current import request. Che

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-05 Thread Nick Coghlan
ged all the gaps. Providing a separate binary with different defaults baked in at build time doesn't magically fix everything (since you still need to change shebang lines to refer to that binary), but it does make it much easier to *stay* in system mode once you're there. Cheers, Nick. -- Nick Cog

Re: [Python-ideas] π = math.pi

2017-06-04 Thread Nick Coghlan
tion of their names. That said, all the potential counter-examples that come to mind are in the documentation, but *not* in the corresponding docstrings (e.g. the Euro symbol used in in the docs for chr() and ord()). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com |

Re: [Python-ideas] Defer Statement

2017-06-04 Thread Nick Coghlan
attribute initialization" in https://docs.python.org/3/howto/index.html that walked through from the basics of using read-only properties with double-underscore prefixed result caching, through helper functions & methods decorated with lru_cache, and all the way up to using __class__ assignmen

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-04 Thread Nick Coghlan
t module as it expected - the developer of such a script would have to write "from . import socket" in order to reimport the main script as a module. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-

Re: [Python-ideas] Defer Statement

2017-06-04 Thread Nick Coghlan
On 3 June 2017 at 22:24, Nick Coghlan <ncogh...@gmail.com> wrote: > So while I'm definitely sympathetic to the use case (otherwise > ExitStack wouldn't have a callback() method), "this would be useful" > isn't a sufficient argument in this particular case - what's ne

Re: [Python-ideas] π = math.pi

2017-06-04 Thread Nick Coghlan
doesn't allow for Unicode identifiers in the first place. https://github.com/python/peps/pull/285 is a PR to explicitly document the standard library API restriction in the "Names to Avoid" part of PEP 8. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia __

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-03 Thread Nick Coghlan
lanned to avoid being unduly disruptive. It's entirely feasible at a technical level, though - https://bugs.python.org/issue29929 describes one way to move away from "import X" for __main__ relative imports and towards "from . import X", which essentially involves turning __main__

Re: [Python-ideas] Defer Statement

2017-06-03 Thread Nick Coghlan
nagement tool when that's what they need, and to consider what could be done to help resolve that (with adding a new kind of statement being just one of the options evaluated). Cheers, Nick. P.S. Nikolas Rauth has a more in-depth write-up of the utility of ExitStack here: https://www.rath.org/on-the

Re: [Python-ideas] π = math.pi

2017-06-03 Thread Nick Coghlan
h the AST. So a frontend that added "A @ B" support to Python 2.7 (for example), would need to translate it into something like "numpy.dot(A, B)" or "matmul(A, B)" at the Python AST level. It would then be up to that function to emulate Python 3's __matmul__ specia

Re: [Python-ideas] π = math.pi

2017-06-03 Thread Nick Coghlan
eration). Matrix multiplication turned out to be a genuine expection, since all the other binary operators had well defined meanings as elementwise-operators, so borrowing one of them for matrix multiplication meant losing access to the corresponding elementwise operation, and there typically

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-02 Thread Nick Coghlan
PEP 432 is still a private API, although it would require several more config settings to be migrated to the new structure first). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@pyth

Re: [Python-ideas] tweaking the file system path protocol

2017-05-28 Thread Nick Coghlan
constructor protocols suggest that this is better characterised as an oversight in the design of the more recent protocols, since neither PEP explicitly discusses the problem, both PEPs were specifically designed to permit the use of objects that *don't* inherit from the relevant builtin types (

Re: [Python-ideas] Exposing CPython's subinterpreter C-API in the stdlib.

2017-05-27 Thread Nick Coghlan
On 27 May 2017 at 03:30, Guido van Rossum <gu...@python.org> wrote: > On Fri, May 26, 2017 at 8:28 AM, Nick Coghlan <ncogh...@gmail.com> wrote: >> >> [...] assuming the rest of idea works out >> well, we'd eventually like to move to a tiered model where the GIL &

Re: [Python-ideas] Exposing CPython's subinterpreter C-API in the stdlib.

2017-05-26 Thread Nick Coghlan
models that Python doesn't currently offer great primitives to support (they're mainly a matter of using threads in certain ways, which means they not only run afoul of the GIL, but you also don't get any assistance from the interpreter in strictly enforcing object ownership rules). Cheers, Nick

Re: [Python-ideas] Exposing CPython's subinterpreter C-API in the stdlib.

2017-05-25 Thread Nick Coghlan
f software that folks run directly under mod_wsgi isn't necessarily reflective of the full extent of variation in the kinds of code that Python developers write in general. Cheers, Nick. [1] https://github.com/python/cpython/blob/master/Programs/_testembed.c#L41 -- Nick Coghlan | ncogh...

Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-20 Thread Nick Coghlan
tructures as easy to work with as database backed ones. For folks that *aren't* familiar with ORMs yet, then declarative classes provide a potentially smoother learning curve, since the "declarative class" aspects can be better separated from the "object-relational mapping" aspec

Re: [Python-ideas] PEP 526: why ClassVar instead of ClassAttr?

2017-05-17 Thread Nick Coghlan
an a normal runtime value. So a "type variable" and a "type attribute" are also very different things (assuming that the latter is being used as an equivalent to "class attribute"). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia __

Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-15 Thread Nick Coghlan
or some ideas on how something like attrs might be adapted to provide better standard library tooling for more concise and readable class definitions. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-i

Re: [Python-ideas] Add a .chunks() method to sequences

2017-05-05 Thread Nick Coghlan
rks in at least 3.5+: >>> data = b'abcdefghijklmnop' >>> data.hex() '6162636465666768696a6b6c6d6e6f70' >>> view = memoryview(data).cast('b', (4, 4)) >>> for row in view.tolist(): ... print(' '.join(entry.hex() for entry

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Nick Coghlan
terators, similar to the way itertools.groupby works (i.e. producing subiterators of variable length rather than a fixed length tuple the way the grouper() recipe in the docs does). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _

Re: [Python-ideas] Add a .chunks() method to sequences

2017-05-02 Thread Nick Coghlan
quot; has come up before, and it's conceivable such an algorithm might find a home there. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-02 Thread Nick Coghlan
On 2 May 2017 at 21:31, Steven D'Aprano <st...@pearwood.info> wrote: > On Mon, May 01, 2017 at 11:38:20PM +1000, Nick Coghlan wrote: >> However, a much simpler alternative would be to just support two >> keyword arguments to hex(): "delimiter" (as you suggest) and &

Re: [Python-ideas] Decorators for running a function in a Process or Thread

2017-05-01 Thread Nick Coghlan
ction never runs in the *current* thread, and instead always runs in a different one. One of the problems for the proposal is that we don't have the notion of a "default executor", the way we do with the default event loop in asyncio, so functions decorated with these would need to accept an additiona

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-01 Thread Nick Coghlan
d "chunk_size" (defaulting to 1, so you get per-byte chunking by default) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/lis

Re: [Python-ideas] Proposed PEP 484 addition: describe a way of annotating decorated declarations

2017-05-01 Thread Nick Coghlan
rect, while all typecheckers (and human readers) would be able to just believe the argument rather than having to run through all the decorator transformations? Make sense to me. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia __

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-29 Thread Nick Coghlan
rms (e.g in the `types` module, or in the modules defining the relevant protocols), it should be relatively straightforward to create mixin classes that use __init_subclass__ to implicitly apply the explicit decorators. The same doesn't hold the other way around - given a mixin, it's tricky to conv

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-29 Thread Nick Coghlan
On 29 April 2017 at 03:00, Mike Miller <python-id...@mgmiller.net> wrote: > On 2017-04-28 06:07, Nick Coghlan wrote: >> For a *lot* of classes, what we want to be able to define is: >> >> - a set of data fields >> - a basic initialiser to set those fields by name

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-28 Thread Nick Coghlan
library maintainers (in the same way that most folks already delegate the behaviour of their metaclasses), or else they can continue to write out all those supported methods by hand if they really want or need the fine-grained control. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com |

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-28 Thread Nick Coghlan
hink we should be considering the kinds of helpers we can provide as class decorators to take the boilerplate and tedium out of defining well-behaved classes. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ide

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-27 Thread Nick Coghlan
Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Binary arithmetic does not always call subclasses first

2017-04-27 Thread Nick Coghlan
they *haven't* replicated the quirk described in the OP, it's a solid data point suggesting there aren't a lot of major projects relying on it. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailin

Re: [Python-ideas] Thread-safe generators

2017-04-16 Thread Nick Coghlan
On 17 April 2017 at 08:00, Paul Moore <p.f.mo...@gmail.com> wrote: > On 15 April 2017 at 10:45, Nick Coghlan <ncogh...@gmail.com> wrote: >> So I'd be opposed to trying to make generator objects natively thread >> aware - as Stephen notes, the GIL is an implementati

Re: [Python-ideas] Thread-safe generators

2017-04-15 Thread Nick Coghlan
it can be used with arbitrary iterators (not just generators), and can be more easily generalised to other synchronisation models (such as multiprocessing). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas

Re: [Python-ideas] Discourage operator.__dunder__ functions

2017-04-14 Thread Nick Coghlan
weak that > we should simply treat it as a historical artifact. +1 from me, with this rationale. The specifics sounds pretty good to me, too - happy to review a PR if you put one together :) Cheers, Nick. P.S. To be completely honest, I'd forgotten the dunder names in operator were there :)

Re: [Python-ideas] Make `import a.b.c as m` is equivalent to `m = sys.modules['a.b.c']`

2017-04-08 Thread Nick Coghlan
x.y), so adding such a reinterpretation would either move the discrepancy to having "import x.y.z as m" work in cases where "import x.y.z" fails, or else require adding a way for the compiler to indicate that the resolved attribute must *also* exist in sys.modules, in addition to being a

Re: [Python-ideas] Relative import of self or parent package?

2017-04-08 Thread Nick Coghlan
on par with that already offered for peer module references. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Nick Coghlan
On 31 March 2017 at 15:12, Nick Coghlan <ncogh...@gmail.com> wrote: > So *if* we were to add anything to the language here, it would be to > add `itertools.repeat_call` as a new iteration primitive, since it > isn't entirely straightforward to construct that operation out of

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Nick Coghlan
def repeat_call(callable, n): for __ in range(n): yield callable() Cheers, Nick. P.S. The common problems shared by all of the `repeat_call` formulations in this post are that they don't set __length_hint__ appropriately, and hence lose efficiency when using them to build

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Nick Coghlan
On 31 March 2017 at 04:08, Pavol Lisy <pavol.l...@gmail.com> wrote: > On 3/30/17, Nick Coghlan <ncogh...@gmail.com> wrote: >> On 31 March 2017 at 00:23, Pavol Lisy <pavol.l...@gmail.com> wrote: >>> Just for curiosity - if PEP-501 will be accepted then how many t

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Nick Coghlan
strings and other sequences, InterpolationTemplate wouldn't define a multiplication operator. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.or

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Nick Coghlan
the language needing to learn a special case syntax. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of

Re: [Python-ideas] What about regexp string litterals : re".*" ?

2017-03-29 Thread Nick Coghlan
e inverse of str.format) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Adding an 'errors' argument to print

2017-03-27 Thread Nick Coghlan
On 27 March 2017 at 13:10, Steve Dower <steve.do...@python.org> wrote: > On 26Mar2017 0707, Nick Coghlan wrote: >> >> Perhaps it would be worth noting in the table of error handlers at >> https://docs.python.org/3/library/codecs.html#error-handlers that >> backs

Re: [Python-ideas] Proposal: Query language extension to Python (PythonQL)

2017-03-26 Thread Nick Coghlan
On 26 March 2017 at 21:40, Pavel Velikhov <pavel.velik...@gmail.com> wrote: > On 25 Mar 2017, at 19:40, Nick Coghlan <ncogh...@gmail.com> wrote: >> Right, the target audience here *isn't* folks who already know how to >> construct their own relational queries in S

Re: [Python-ideas] Adding an 'errors' argument to print

2017-03-26 Thread Nick Coghlan
ckslashreplace is used by the `ascii()` builtin and the associated format specifiers, as well as noting the format specifiers in the documentation of the builtin function? Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___

Re: [Python-ideas] Proposal: Query language extension to Python (PythonQL)

2017-03-25 Thread Nick Coghlan
he Python grammar, which not only makes the query language difficult to update, but also makes Python's base syntax harder for new users to learn. By contrast, when DSLs are handled as interpolation templates with delayed rendering, then the rendering function gets to provide runtime documentation, and the

Re: [Python-ideas] PEP: Python Documentation Translations

2017-03-22 Thread Nick Coghlan
there would be redirects back to the /en/ versions in place when there is no translation for a particular version (e.g. the older security-fix only branches). I'm not sure it matters all that much either way, but the PEP should be explicit. Cheers, Nick. -- Nick Coghlan | ncogh

Re: [Python-ideas] for/except/else

2017-03-01 Thread Nick Coghlan
minated by > a break statement. > > The idea is certainly not new. In fact, Nick Coghlan, in his blog post > http://python-notes.curiousefficiency.org/en/latest/python_ > concepts/break_else.html, uses it to provide a mental model for the > meaning of the else following for/while, but, a

Re: [Python-ideas] math.nextafter

2017-02-24 Thread Nick Coghlan
t, where the default step was defined by the internal representation (i.e. it would increment by the smallest possible value). I'm not sure of any use cases outside exploring the behaviour of numerical algorithm implementations in the presence of mathematical discontinuities, though. Cheers, Nick.

Re: [Python-ideas] site.py uses os.sep to determine platform

2017-02-12 Thread Nick Coghlan
replicate the separator setting (and os.path module selection) logic that figures that out in the first place. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https:

Re: [Python-ideas] Fwd: Define a method or function attributeoutsideof a class with the dot operator

2017-02-12 Thread Nick Coghlan
owever, even with that, I'm still only +0 on the idea - if folks really want it, `types.new_class` can already be used to creatively to address most of these things, and it's not exactly a problem that comes up very often in practice. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane,

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-10 Thread Nick Coghlan
(Actually doing this may require elevating super and __class__ to true keyword expressions, rather than the pseudo-keywords they are now) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-id

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-10 Thread Nick Coghlan
ions (and injecting the right __class__ cell reference for zero-argument super() support is a compelling technical argument in favour of this feature over ordinary attribute binding operations), but there's a lot more to the proposal than just relaxing a syntact

Re: [Python-ideas] Using Python for end user applications

2017-02-09 Thread Nick Coghlan
ritten in JavaScript rather than C/C++, and the language independent in-process bindings got fairly dramatically worse along the way :) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-idea

Re: [Python-ideas] A decorator to call super()

2017-02-01 Thread Nick Coghlan
quot;method modifiers" feature to Python 3: https://frasertweedale.github.io/elk/modifiers.html Cheers, Nick. P.S. I don't know of anyone actually using Elk in production, but it's a good project to explore for anyone interested in more structured approaches to managing method overrides --

Re: [Python-ideas] [docs] https://docs.python.org/fr/ ?

2017-02-01 Thread Nick Coghlan
issue trackers, but it shouldn't be any worse than what we see with occasionally redirecting people to the Python Packaging Authority issue trackers for various purposes. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia

Re: [Python-ideas] Is it Python 3 yet?

2017-01-26 Thread Nick Coghlan
t's just a matter of someone finding the time to poke at the docs build config and how RTFD did it in order to see how to set that up, and then backporting it to *all* the 3.x and 2.x branches that use Sphinx for their docs (even the ones that are otherwise closed to updates). Cheers, Nick. --

Re: [Python-ideas] globals should accept parenteses for extending beyond 1 line

2017-01-26 Thread Nick Coghlan
cm2() as b, cm3() as c): ... Relative to tuples-as-context-managers, such an approach would also avoid reintroducing the old resource management problems that saw contextlib.nested removed and replaced with contextlib.ExitStack.

Re: [Python-ideas] Ideas for improving the struct module

2017-01-21 Thread Nick Coghlan
ct ways that CPython itself uses C structs (matching the heritage of the module's name), even though the primary practical motivation and use case is common over-the-wire protocols. Cheers, Nick. P.S. "the reference interpreter does this" and "the standard library does this&quo

Re: [Python-ideas] Things that won't change (proposed PEP)

2017-01-12 Thread Nick Coghlan
anges should likely be consolidated into that page, and the FAQ entry simplified into a link to a new subsection on that page. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Nick Coghlan
hose unfortunate facts of computing at this point) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

Re: [Python-ideas] RFC: PEP 540 version 3 (Add a new UTF-8 mode)

2017-01-12 Thread Nick Coghlan
tion for the PEP 540 approach, I think it's the right way to go. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] RFC: PEP 540 version 3 (Add a new UTF-8 mode)

2017-01-11 Thread Nick Coghlan
d potentially even "Yes exception, yes mojibake" in cases where the implicit ASCII-based decoding could be encountered PEP 538 would then be a follow-on PEP that attempts to resolve the ASCII locale encoding problem not only for CPython itself, but also for any other C/C++ components sharin

Re: [Python-ideas] PEP 540: Add a new UTF-8 mode

2017-01-07 Thread Nick Coghlan
host (rather than exchanging UTF-8 encoded data over a network connection), getting an exception is preferable to silently corrupting the data stream (I think I'll add something along those lines to PEP 538 as a new "Core Design Principles" section) Cheers, Nick. [1] https://docs.p

[Python-ideas] PEP 538: Coercing the legacy C locale to C.UTF-8

2017-01-07 Thread Nick Coghlan
8 Version: $Revision$ Last-Modified: $Date$ Author: Nick Coghlan <ncogh...@gmail.com> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 28-Dec-2016 Python-Version: 3.7 Abstract An ongoing challenge with Python 3 on \*nix systems is the conflict between needing to

Re: [Python-ideas] incremental hashing in __hash__

2016-12-31 Thread Nick Coghlan
posing a "hash.from_iterable" callable that produces the same result as "hash(tuple(iterable))" without actually creating the intermediate tuple. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] AtributeError inside __get__

2016-12-30 Thread Nick Coghlan
ort property >> >> and toy with it that way. >> >> What module would be appropriate, though? >> > > Well, DynamicClassAttribute is kept in the types module, so that's > probably the place to put optionalproperty as well. > I'd also be OK with ju

Re: [Python-ideas] incremental hashing in __hash__

2016-12-30 Thread Nick Coghlan
all currently released versions of Python, not just to 3.7+ 2. It provides more scope for people to experiment with their own variants of the idea before committing to a *particular* version somewhere in the standard library Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane,

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-30 Thread Nick Coghlan
of C99 then I think that's the > best approach. > I checked PEP 7 to see exactly which features we've added to the approved C dialect, and designated initialisers are already on the list: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html So I believe that would allow the ini

Re: [Python-ideas] Function arguments in tracebacks

2016-12-30 Thread Nick Coghlan
think this kind of change may make a lot of sense as an RFE for pdb's "where" command (with the added bonus that projects like pdbpp could make it available to earlier Python versions as well). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _

Re: [Python-ideas] AtributeError inside __get__

2016-12-30 Thread Nick Coghlan
sn't *really* present, even though the property is defined at the class level - the deprecation warning would indicate that the affected properties should switch to using optionalproperty instead Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia

Re: [Python-ideas] AtributeError inside __get__

2016-12-25 Thread Nick Coghlan
his is one of the many cases where IDEs with some form of static structural checking really do make development easier - the "self.nonexisting" would be flagged as non-existent directly in the editor, even before you attempted to run the code. Cheers, Nick. -- Nick Coghlan | nco

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-21 Thread Nick Coghlan
On 21 December 2016 at 20:01, Erik Bray <erik.m.b...@gmail.com> wrote: > On Wed, Dec 21, 2016 at 2:10 AM, Nick Coghlan <ncogh...@gmail.com> wrote: > > Option 2: Similar to option 1, but using a custom type alias, rather than > > using a C99 bool directly >

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-20 Thread Nick Coghlan
nd PyThread_tss_delete APIs to accept a "Py_ensure_t *init_flag" in addition to their current arguments. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-20 Thread Nick Coghlan
ontroversy, but rather as an easier to find reference for the design rationale than a mailing list thread or a tracker issue. (I'd also be happy to volunteer as BDFL-Delegate, since I'm already reviewing the patch on the tracker) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-19 Thread Nick Coghlan
r effect) I don't see any obvious way around that either, as even using a small struct for native pthread TLS keys would still face the problem of how to initialise the pthread_key_t field. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___

Re: [Python-ideas] Enhancing vars()

2016-12-13 Thread Nick Coghlan
Armed with those, the "give me all the attributes from __dir__" command would be: attrs = dict.from_attrs(obj, dir(obj)) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ide

Re: [Python-ideas] PEP: Distributing a Subset of the Standard Library

2016-12-07 Thread Nick Coghlan
motivated to implement it, and we already have the logic to track which optional modules weren't built in order to generate the message at the end of the build process. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___

Re: [Python-ideas] PEP: Distributing a Subset of the Standard Library

2016-12-05 Thread Nick Coghlan
On 5 December 2016 at 19:56, Tomas Orsava <tors...@redhat.com> wrote: > On 12/03/2016 05:08 AM, Nick Coghlan wrote: >>> >>> Though I believe the default sys.excepthook function is currently written >>> in >>> C, so it wouldn't be very easy for dis

Re: [Python-ideas] Better error messages [was: (no subject)]

2016-12-04 Thread Nick Coghlan
k on empowering them *anyway*. I just don't personally think that's feasible on a volunteer basis - you need professional service providers that are familiar not only with the specific concepts and technologies being taught, but also with the bureaucratic context that the particular schools

Re: [Python-ideas] Better error messages [was: (no subject)]

2016-12-04 Thread Nick Coghlan
s backing them up. But for cases like the Australian Digital Curriculum, it makes sense for schools to look into the local service providers rather than asking teachers to make do with what they can download from the internet (while the latter option is viable in some cases, it really does require

Re: [Python-ideas] Better error messages [was: (no subject)]

2016-11-30 Thread Nick Coghlan
ms should be OK, though. While some veteran programmers may find such prompts a bit condescending, they'd be better equipped than beginners to opt in to alternative exception display options that omit the hints. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _

Re: [Python-ideas] PEP: Distributing a Subset of the Standard Library

2016-11-29 Thread Nick Coghlan
On 30 November 2016 at 04:33, Brett Cannon <br...@python.org> wrote: > On Tue, 29 Nov 2016 at 06:49 Nick Coghlan <ncogh...@gmail.com> wrote: >> >> On 29 November 2016 at 20:54, Tomas Orsava <tors...@redhat.com> wrote: >> > With a metapath hoo

Re: [Python-ideas] PEP: Distributing a Subset of the Standard Library

2016-11-29 Thread Nick Coghlan
lower to fail, but that could be mitigated in various ways). Specific applications could also implement their own missing module handling by providing a __missing__.py file alongside their __main__.py, and relying on directory and/or zipfile execution, or else by monkeypatching the __missing__ module

Re: [Python-ideas] PEP: Distributing a Subset of the Standard Library

2016-11-29 Thread Nick Coghlan
anaged to be competitive performance-wise with the previous C implementation, and faster when importing from a network filesystem :) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ide

Re: [Python-ideas] (no subject)

2016-11-29 Thread Nick Coghlan
er errors are uninformative because the parser doesn't keep track of the state needed to generate nicer messages), but it seems to typically be true for runtime errors where we don't even report the type or representation of a misbehaving value. Cheers, Nick. -- Nick Cogh

Re: [Python-ideas] Decorator to avoid a mistake

2016-11-29 Thread Nick Coghlan
the full extent of Python's dynamic nature, as it can expect the user to be cooperating with the tool to some degree, and "you're not cooperating" can be a valid error to throw. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Decorator to avoid a mistake

2016-11-26 Thread Nick Coghlan
ked overrides All an override marker would have to do to enable that introspection is to set a particular attribute on the method definition. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-ideas mailing

<    1   2   3   4   5   6   >