[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Brian Skinn
Me too. I'm a relative python-ideas newb, though, so I don't really know the back catalog. On Sat, Nov 30, 2019, 18:46 Christopher Barker wrote: > > > On Sat, Nov 30, 2019 at 3:02 AM Brian Skinn wrote: > >> That aside, absolutely +1 for curating such a list. E

[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Brian Skinn
Ah, right -- relatively straightforward rule. But, one that's going to require a lot of careful thought to track down exactly how a name will resolve across an inheritance tree. Seems like a lot of extra complexity and potential for confusion for a comparatively small benefit. Also, I have to t

[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Brian Skinn
What happens when aliases collide with proper attributes? Could you have an attribute 'foo', combined with an attribute 'bar' with alias 'foo'? If so, how would that work? What happens when a subclass of Foo adds an attribute that masks an alias defined for an attribute of Foo? Dragons. Compli

[Python-ideas] Re: Access to member name/names via context during Enum instance initialization

2019-11-30 Thread Brian Skinn
Steve, It looks like what you're trying to achieve is an Enum with more than a singleton `.value` exposed on each sub-item. I was able to achieve something that *looks* like your example using an Enum mixin with a custom class: > from enum import Enum class Labeler: @property def la

[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Brian Skinn
That aside, absolutely +1 for curating such a list. Excellent idea. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Mes

[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Brian Skinn
Why, we could even number them, call them Python-Issues Common Threads, abbreviate that as "PICT", and then refer to them as, e.g., "PICT-114"!! :-D :-D :-D :-D ... |-[ ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an ema

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Brian Skinn
@jayvdb on GitHub and I are working on a new version of one of my packages, stdio-mgr (https://github.com/bskinn/stdio-mgr), with a dramatically expanded API and capabilities. Context managers feature heavily in the planned design; part of the design plan is to allow instantiation of a StdioMan

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Brian Skinn
Andrew Barnert wrote: > What does it do for zipimported modules, bootstrapped modules, modules > distributed as a .pyc file without the .py source, etc., plain old .py filed > but that are > found in an unusual way (a 3.x equivalent of Appleā€™s 2.7 Extras directory, or > even a > custom importlib

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-08 Thread Brian Skinn
Jonathan Fine wrote: > Suppose we had a similar 'which' command in Python. It wouldn't by > itself stop things going wrong. But when they do go wrong, it might > help diagnose the problem. This thread got me thinking about something exactly along these lines. It looks like the needed information

[Python-ideas] Re: add a .with_stem() method to pathlib objects

2019-10-29 Thread Brian Skinn
I feel like the semantics of PurePath.suffix (https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffix) and PurePath.stem define this pretty unambiguously. I.e., it should be: p = Path("foo.bar.txt") p.with_stem("quux") "quux.txt" p.with_stem("baz.quux") "baz.quux.txt" ___

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-24 Thread Brian Skinn
Steven D'Aprano wrote: > We're talking about an operator to copy-and-update a dict, not invade > Iraq. [grin] Fair enough. In the interim, actually, I realized some semantic downsides of using pipe. If a user happens to draw an analogy to logical 'or', the 'which one wins' semantics is differ

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-24 Thread brian . skinn
Christopher Barker wrote: > if | is implemented, I'll bet you dollars to donuts that it will get used > far less than if + were used. > (though some on this thread would think that's a good thing :-) ) > -CHB (Non-beginner, |-preferrer) I think Christopher is correct here, but only to a point. I

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-21 Thread brian . skinn
Agreed -- Anyone who uses numpy a lot might make the same assumption, because numpy vectorizes. Anybody who doesn't might expect an extension-equivalent: >>> import numpy as np >>> a1 = np.arange(2,6) >>> a2 = np.arange(4,0,-1) >>> a2 array([4, 3, 2, 1]) >>> a1 array([2, 3, 4, 5]) >>> a1 + a2 arr

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-21 Thread brian . skinn
**Strongly** disagree. I would anticipate using this feature a LOT, and would be excited to see it added. (I would love to replace things like "d2 = d1.copy(); d2.update(d3)" with just "d2 = d1 | d3". In-place "d2 |= d3" is nice in its terseness, but isn't a huge benefit.) But, I completely agr

[Python-ideas] Re: Conditional dict declarations

2019-09-05 Thread brian . skinn
Okie, looks like my code got munched in the web view -- how do I make it not do that? ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: Conditional dict declarations

2019-09-05 Thread brian . skinn
I thought of something similar, but where the dict-literal construction is desired: >>> foo = True >>> bar = False >>> baz = False >>> d = { ... 'foo' if foo else None: 1, ... 'bar' if bar else None: 2, ... 'baz' if baz else None: 3, ... } >>> d {'foo': 1, None: 3} >>> d.pop(None) 3 >>> d {

[Python-ideas] Re: [Distutils] Re: Linux binary wheels?

2019-08-20 Thread Brian Skinn
On Tue, Aug 20, 2019 at 6:14 AM Matthew Brett wrote: > Hi, > > On Tue, Aug 20, 2019 at 11:10 AM Brian Skinn > wrote: > > > > > > > > On Tue, Aug 20, 2019, 06:05 Matthew Brett > wrote: > >> > >> Hi, > > > > > >> Se