[issue38627] Add copy() method to pathlib

2019-10-29 Thread Sebastian Linke
Sebastian Linke added the comment: Docstring could be: Copy file content and permission bits of this path to the target path and return a new Path instance pointing to the target path. If target is a directory, the base filename of this path is added to the target and a new file corresponding

[issue38627] Add copy() method to pathlib

2019-10-28 Thread Sebastian Linke
New submission from Sebastian Linke : pathlib.Path() could wrap shutil.copy() with something like this: def copy(self, target): if not self.is_file(): # No support for directories here raise ValueError("Path must point to a regular file") # copy() appends fil

[issue35494] Inaccurate error message for f-string

2018-12-14 Thread Sebastian Linke
Sebastian Linke added the comment: The same behavior applies to f'{spam[}' and f'{spam(}'. Also to f'{spam{}', but that might be expected. This message is more clear: >>> f'{spam(' File "", line 1 SyntaxError: f-string: mismatched '(', '{', or '[' Perhap

[issue35494] Inaccurate error message for f-string

2018-12-14 Thread Sebastian Linke
New submission from Sebastian Linke : Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> spam = 'spam' >>> f'{s

[issue25898] Check for subsequence inside a sequence

2015-12-20 Thread Sebastian Linke
Sebastian Linke added the comment: Slightly modified the implementation to return the index rather than a boolean. -- Added file: http://bugs.python.org/file41374/subseq_index.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue25898] Check for subsequence inside a sequence

2015-12-18 Thread Sebastian Linke
Sebastian Linke added the comment: @Josh What is the point of using iterators here? If the user wants an iterator to be checked then he can throw that iterator right away because it was exhausted by the function. I think that in most cases the user wants to do some postprocessing

[issue25898] Check for subsequence inside a sequence

2015-12-17 Thread Sebastian Linke
New submission from Sebastian Linke: With the attached patch I propose to add a new function to the "collections" module. It is meant to be used for determining whether a given subsequence is part of a particular sequence (with respect to the ordering of the subsequence). Doing th