Re: Counting Python threads vs C/C++ threads

2019-07-17 Thread Barry Scott
> On 16 Jul 2019, at 20:48, Dan Stromberg wrote: > > > > On Tue, Jul 16, 2019 at 11:13 AM Barry Scott > wrote: > I'm going to assume you are on linux. > Yes, I am. Ubuntu 16.04.6 LTS sometimes, Mint 19.1 other times. > > On 16 Jul 2019, at 18:35, Dan Strombe

Re: Counting Python threads vs C/C++ threads

2019-07-17 Thread Thomas Jollans
On 17/07/2019 09.58, Barry Scott wrote: > >> On 16 Jul 2019, at 20:48, Dan Stromberg wrote: >> >> >> >> A question arises though: Does threading.active_count() only show Python >> threads created with the threading module? What about threads created with >> the thread module? > Only pythons t

Why an InitVar pseudo field in dataclasses cannot have a default_factory?

2019-07-17 Thread Jacobo de Vera
Hi all, I was surprised by an error when trying to set a default_factory for an InitVar pseudo-field in a dataclass. Inspecting the code in dataclasses.py led me to this: # Special restrictions for ClassVar and InitVar. if f._field_type in (_FIELD_CLASSVAR, _FIELD_INITVAR): if f.defau

Re: OT: Is there a name for this transformation?

2019-07-17 Thread kamaraju kusumanchi
On Wed, Jul 10, 2019 at 3:08 PM Peter J. Holzer wrote: > > On 2019-07-10 08:57:29 -0400, kamaraju kusumanchi wrote: > > Given a csv file with the following contents > > > > 20180701, A > > 20180702, A, B > > 20180703, A, B, C > > 20180704, B, C > > 20180705, C > > > > I would like to transform the

Embedding Python in C

2019-07-17 Thread jesse . ibarra . 1996
I am using Python3.6: [jibarra@redsky ~]$ python3.6 Python 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information. I am referencing:https://docs.python.org/3.6/extending/embedding.html#beyond

Re: Embedding Python in C

2019-07-17 Thread Barry Scott
> On 17 Jul 2019, at 16:57, jesse.ibarra.1...@gmail.com wrote: > > I am using Python3.6: > > [jibarra@redsky ~]$ python3.6 > Python 3.6.8 (default, Apr 25 2019, 21:02:35) > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux > Type "help", "copyright", "credits" or "license" for more information

Re: Embedding Python in C

2019-07-17 Thread Jesse Ibarra
On Wednesday, July 17, 2019 at 11:55:28 AM UTC-6, Barry Scott wrote: > > On 17 Jul 2019, at 16:57, wrote: > > > > I am using Python3.6: > > > > [jibarra@redsky ~]$ python3.6 > > Python 3.6.8 (default, Apr 25 2019, 21:02:35) > > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux > > Type "help", "

Re: Embedding classes' names

2019-07-17 Thread DL Neil
On 16/07/19 10:57 PM, Cameron Simpson wrote: On 16Jul2019 10:20, Chris Angelico wrote: On Tue, Jul 16, 2019 at 10:17 AM DL Neil wrote: When used, do you embed a class's name within its own code, as a literal? [...] So, what about other situations where one might need to access the class's o

Re: Embedding Python in C

2019-07-17 Thread Christian Gollwitzer
Am 17.07.19 um 20:39 schrieb Jesse Ibarra: My options seem rather limited, I need to make a Pipeline from (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does not support Python directly I have to settle with the C/Python API (https://docs.python.org/3.6/ext

Re: super() in Python 3

2019-07-17 Thread DL Neil
On 16/07/19 10:08 PM, אורי wrote: Hi, 1. When we use super() in Python 3, we don't pass it the first argument (self). Why? What happens if the first argument is not self? def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) I think it would make more sense to use someth

join and split with empty delimiter

2019-07-17 Thread Irv Kalb
I have always thought that split and join are opposite functions. For example, you can use a comma as a delimiter: >>> myList = ['a', 'b', 'c', 'd', 'e'] >>> myString = ','.join(myList) >>> print(myString) a,b,c,d,e >>> myList = myString.split(',') >>> print(myList) ['a', 'b', 'c', 'd', 'e'] W

Re: join and split with empty delimiter

2019-07-17 Thread Chris Angelico
On Thu, Jul 18, 2019 at 7:06 AM Irv Kalb wrote: > If I join the list with the empty string as the delimiter: > > >>> myList = ['a', 'b', 'c', 'd'] > >>> myString = ''.join(myList) > >>> print(myString) > abcd > > That works great. But attempting to split using the empty string generates > an err

Re: join and split with empty delimiter

2019-07-17 Thread Tim Daneliuk
On 7/17/19 4:24 PM, Chris Angelico wrote: > Agreed. There are a number of other languages where splitting on an > empty delimiter simply fractures the string into characters (I checked > Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful > feature. +1. Not only that, it makes the la

Re: join and split with empty delimiter

2019-07-17 Thread MRAB
On 2019-07-18 00:24, Tim Daneliuk wrote: On 7/17/19 4:24 PM, Chris Angelico wrote: Agreed. There are a number of other languages where splitting on an empty delimiter simply fractures the string into characters (I checked Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful feature.

Re: Embedding Python in C

2019-07-17 Thread dieter
Jesse Ibarra writes: > ... > My options seem rather limited, I need to make a Pipeline from (Smalltalk -> > C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does > not support Python directly I have to settle with the C/Python API > (https://docs.python.org/3.6/extending/em