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

2017-02-10 Thread Thomas Kluyver
On Fri, Feb 10, 2017, at 11:05 AM, Chris Angelico wrote: > * What would the __name__ be? In "def ham.spam():", is the name "spam" > or "ham.spam"? Or say you have "def x[0]():" - is the name "x[0]" or > something else? I'd say 'spam' in the first case, and a special value like '' in the latter.

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

2017-02-07 Thread Thomas Kluyver
On Tue, Feb 7, 2017, at 02:29 PM, Steve Dower wrote: > I think what we really want is a self-extractor that "installs" into > the user's AppData directory without prompting for admin. There's a PR in the works for Pynsist that will add a non-admin per-user install into AppData:

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

2017-02-07 Thread Thomas Kluyver
On Sat, Jan 28, 2017, at 11:26 AM, Paul Moore wrote: > I'm working on > a project to bundle a working zipapp with the embedded distribution to > make a standalone exe - would having something like that make any > difference in your environment? I'd be interested in this, and whether there's any

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

2017-01-31 Thread Thomas Kluyver
On Tue, Jan 31, 2017, at 02:32 PM, Stephen J. Turnbull wrote: > Personally, I don't think the explicit invocation is such a big deal > to need a standardized decorator in the stdlib. +1. It's one line either way, and the explicit call to super() seems clearer for people reading the code.

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:58 PM, Todd wrote: > On Wed, Jan 25, 2017 at 10:45 AM, Thomas Kluyver > <tho...@kluyver.me.uk> wrote: >> __You might not, but it seems like an attractive nuisance. You can't >> reliably use it as a test for .tar.gz files, but it would be easy

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:54 PM, Todd wrote: > Those [.tar.foo] are just examples that I encounter a lot, there can > be other cases where multiple extensions are used. The real issue is that there's no definition of what an extension is. You can have dots anywhere in a filename, and it's not

Re: [Python-ideas] pathlib suggestions

2017-01-25 Thread Thomas Kluyver
On Wed, Jan 25, 2017, at 03:33 PM, Todd wrote: > On Wed, Jan 25, 2017 at 10:18 AM, Petr Viktorin > wrote: >> But what if the .tar.gz file is called "spam-4.2.5-final.tar.gz"? >> Existing tools like glob and endswith() can deal with the ".tar.gz" >> extension reliably, but

[Python-ideas] Context manager to temporarily set signal handlers

2017-01-20 Thread Thomas Kluyver
Not uncommonly, I want to do something like this in code: import signal # Install my own signal handler prev_hup = signal.signal(signal.SIGHUP, my_handler) prev_term = signal.signal(signal.SIGTERM, my_handler) try: do_something_else() finally: # Restore previous signal handlers