A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-April/143716.html below:

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

[Python-Dev] When should pathlib stop being provisional?Ethan Furman ethan at stoneleaf.us
Wed Apr 6 16:20:59 EDT 2016
On 04/06/2016 02:41 AM, Antoine Pitrou wrote:

> On a concrete point, inheriting str would make the API a horrible,
> confusing, dangerous mess missing regular string semantics (concatenation
> with +, for example, or indexing) with path-specific semantics and various
> grey areas (should .split() have path semantics or str semantics? what
> is the rule and how are people supposed to remember it?).

While I agree in principle..

> (of course, for PHP or Javascript programmers it may not sound like a
> problem. Let "adding" two IP addresses return the concatenation of
> their string representations...)

Like if had a subnet of '192.168' and a  host of '.11.16' and adding 
them together gave you '192.168.11.16'? (yeah, a bit weak)

Or, more appropriately:  a path of

   '/home/ethan/mystuff' + '_bak'

so I can make a copy?  Actually, that would be

   stuff = pathlib.Path('/home/ethan/mystuff')  # no issue here
   backup_stuff = stuff.with_name(stuff.name + '_bak')  # eww

Sure, you can make the argument that `with_suffix('.bak')` is cleaner, 
but it is not up to the stdlib to micromanage my code.

Oh, and I do not consort with PHP, and only do so with Javascript when 
forced.

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4