[issue24132] Direct sub-classing of pathlib.Path

2018-03-28 Thread Christophe BAL
Christophe BAL added the comment: Hello. What about AbstractPath instead of _PurePath ? Le 28/03/2018 à 02:30, qb-cea a écrit : > qb-cea added the comment: > > Hi all, > > I made a pull request proposing a fix for this issue. There is still quite a > lot to be done: &g

[issue24132] Direct sub-classing of pathlib.Path

2017-11-08 Thread Christophe BAL
Christophe BAL added the comment: Mistyping : /search for class PPath/ with two P. Le 08/11/2017 à 13:59, Christophe BAL a écrit : > Christophe BAL added the comment: > > For the moment, you can take a look at this little script that acheives > subclassing of Path : > https:

[issue24132] Direct sub-classing of pathlib.Path

2017-11-08 Thread Christophe BAL
Christophe BAL added the comment: For the moment, you can take a look at this little script that acheives subclassing of Path : https://github.com/bc-python/mistool/blob/master/mistool/os_use.py (search for class Path). Le 08/11/2017 à 09:55, Paul Moore a écrit : > Paul Moore added

[issue24132] Direct sub-classing of pathlib.Path

2015-05-06 Thread Christophe BAL
Christophe BAL added the comment: OK. I will try to find a way to achieve an easier and cleaner way to sub class pathlib.Path and co. What is the good way to propose a patch ? *Christophe BAL* *Enseignant de mathématiques en Lycée **et développeur Python amateur* *---* *French math teacher in

[issue24132] Direct sub-classing of pathlib.Path

2015-05-06 Thread Christophe BAL
Christophe BAL added the comment: Are you the author of path lib ? *Christophe BAL* *Enseignant de mathématiques en Lycée **et développeur Python amateur* *---* *French math teacher in a "Lycée" **and **Python **amateur developer* 2015-05-06 21:01 GMT+02:00 Paul Moore : > >

[issue24132] Direct sub-classing of pathlib.Path

2015-05-06 Thread Christophe BAL
Christophe BAL added the comment: I don't agree with you. I prefer to add new functionalities to the paths I use. This is the power of OOP. It is easier and cleaner to use *mypath.common_with(otherpath)* than *common_with(**mypath, **other path)* . Python is highly OOP, so you can&

[issue24132] Direct sub-classing of pathlib.Path

2015-05-06 Thread Christophe BAL
Christophe BAL added the comment: Here are for example two extra methods that I have implemented. def __sub__(cls, path): """ This magic method allows to use ``onepath - anotherpath`` instead of the long version ``onepath.relative_to(anotherpath)`` given by

[issue24132] Direct sub-classing of pathlib.Path

2015-05-06 Thread Christophe BAL
Christophe BAL added the comment: Hello. I will give a real example in 5 hours after my job. I will try tomorrow a solution to ease the subclassing using another dedicazted class PathPlus, sorry for the name. The idea would be to use this new class for customization, and also to define

[issue24132] Direct sub-classing of pathlib.Path

2015-05-05 Thread Christophe BAL
Changes by Christophe BAL : -- title: Direct sub-classing of pathless.Path -> Direct sub-classing of pathlib.Path ___ Python tracker <http://bugs.python.org/issu

[issue24132] Direct sub-classing of pathless.Path

2015-05-05 Thread Christophe BAL
New submission from Christophe BAL: Hello. I have noticed a problem with the following code. from pathlib import Path class PPath(Path): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) test = PPath("dir", "test.txt") This gives the fol

[issue24108] fnmatch.translate('*.txt') fails

2015-05-01 Thread Christophe BAL
Christophe BAL added the comment: Oups, sorry I want to say that you are totally RIGHT, and I am definitely WRONG. :-) -- ___ Python tracker <http://bugs.python.org/issue24

[issue24108] fnmatch.translate('*.txt') fails

2015-05-01 Thread Christophe BAL
Christophe BAL added the comment: You're totally wrong and I am wrong. There is still the tiny problem of the documentation. Thanks for all. *Christophe BAL* *Enseignant de mathématiques en Lycée **et développeur Python amateur* *---* *French math teacher in a "Lycée" **and **P

[issue24108] fnmatch.translate('*.txt') fails

2015-05-01 Thread Christophe BAL
Christophe BAL added the comment: Ok. But in that case, the official documentation should be updated because it saids that string regex is *'.*\\.txt\\Z(?ms)'* and not *'.*\\.txt$'*. On the other hand, using this writing seems a bit strange. The 2nd one should do the j

[issue24108] fnmatch.translate('*.txt') fails

2015-05-01 Thread Christophe BAL
New submission from Christophe BAL: Hello. I find the following bug on Python 3.4. >>> import fnmatch, re >>> regex = fnmatch.translate('*.txt') >>> regex '.*\\.txt\\Z(?ms)' The string regex should be '.*\\.txt$'. -- com