Writing a CPython extension - calling another sibbling method ?

2019-11-17 Thread R.Wieser
Hello all, I'm trying to edit a binary extension to Python, and have a situation where I would like to create method which adds a single argument, and than jumps to / calls another method. Like this: static PyObject *py_proc1(PyObject *self, PyObject *args) { Py_RETURN_NONE } static Py

Re: nonlocal fails ?

2019-11-17 Thread Random832
On Sun, Nov 17, 2019, at 07:26, Richard Damon wrote: > I am not sure about C#, but in C++, a base language for C#, you can not > take the address of a variable of reference type, if you do, you get the > objected referred to, not the reference. References are essentially > constant pointers, and ca

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Hongyi Zhao
On Sun, 17 Nov 2019 20:28:55 +0100, Pieter van Oostrum wrote: > To be honest, I myself would use Emacs, with rgrep and wgrep to do this. Are these tools superior to grep? Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: low-level csv

2019-11-17 Thread Greg Ewing
On 18/11/19 9:30 am, Dave Cinege wrote: The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example: def csv_split (s): lex = shlex.shlex(s, posix=True) lex.whitespace_split = True lex.whitespace = ',' return list(lex)

Re: low-level csv

2019-11-17 Thread Dave Cinege
The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example: def csv_split (s): lex = shlex.shlex(s, posix=True) lex.whitespace_split = True lex.whitespace = ',' return list(lex) will split on commas while ho

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
Pieter van Oostrum writes: > It isn't that difficult with sed, only you have to chose a different > character than / in the substitute command, one that is not present in > both texts, e.g instead of s/a/b/ use s=a=b=. > > And then the special characters " ' () [ and $ must be escaped for the > s

Re: Launching a Script on the Linux Platform

2019-11-17 Thread Barry Scott
> On 12 Nov 2019, at 20:24, Wildman via Python-list > wrote: > > Yes, I prefer to envoke env in the shebang line instead of > depending on the path. Paths can change especially in a > multi-user system but env will always know where to find > the executable. The path to python will not chan

Re: How to delay until a next increment of time occurs ?

2019-11-17 Thread Barry Scott
> On 13 Nov 2019, at 22:36, Dietmar Schwertberger > wrote: > > On 13.11.2019 23:20, Dennis Lee Bieber wrote: >> For Windows it may require coding a busy-wait sleep function using the >> high-performance counter and computing a counter value (modulo?) on which >> to exit the loop. > time.perf_

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
Hongyi Zhao writes: > Hi, > > I have a lot of files which resides under a directory, and I want to > resive all of the content "([^/]+)$" in these files into '([^/]+)$'. > > I have tried with sed/xargs, but it seems so difficult for dealing with > the \ , is there any convinent method to to

revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Hongyi Zhao
Hi, I have a lot of files which resides under a directory, and I want to resive all of the content "([^/]+)$" in these files into '([^/]+)$'. I have tried with sed/xargs, but it seems so difficult for dealing with the \ , is there any convinent method to to this job with python? Regards --

Re: low-level csv

2019-11-17 Thread Skip Montanaro
On Sun, Nov 17, 2019 at 7:23 AM Antoon Pardon wrote: > > This is python 2.6->2.7 and 3.5->3.7 > > I need to convert a string that is a csv line to a list and vice versa. > I thought to find functions doing this in the csv module but that doesn't > seem to be the case. Take a look at the test case

Re: low-level csv

2019-11-17 Thread Dan Sommers
On 11/17/19 7:18 AM, Antoon Pardon wrote: This is python 2.6->2.7 and 3.5->3.7 I need to convert a string that is a csv line to a list and vice versa. I thought to find functions doing this in the csv module but that doesn't seem to be the case. I can of course write special classes that would

low-level csv

2019-11-17 Thread Antoon Pardon
This is python 2.6->2.7 and 3.5->3.7 I need to convert a string that is a csv line to a list and vice versa. I thought to find functions doing this in the csv module but that doesn't seem to be the case. I can of course write special classes that would allow for this using a csv.reader and csv.wr

Re: nonlocal fails ?

2019-11-17 Thread Richard Damon
On 11/17/19 1:33 AM, Random832 wrote: > On Fri, Nov 15, 2019, at 13:41, Dennis Lee Bieber wrote: >> C# documents those as something visible to the user at the language >> level... >> https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html >> """ >> Types in