Re: join and split with empty delimiter

2019-07-18 Thread MRAB
On 2019-07-18 20:52, Ben Bacarisse wrote: Danilo Coccia writes: Il 18/07/2019 12:27, Ben Bacarisse ha scritto: [snip] Of course str.split('') could be defined to work the way you expect, but it's possible that the error is there to prompt the programmer to be more explicit. It is even more

Re: Embedding Python in C

2019-07-18 Thread Chris Angelico
On Fri, Jul 19, 2019 at 5:51 AM Christian Gollwitzer wrote: > Once you can do this, you can proceed to call a Python function, which > in C means that you invoke the function PyObject_CallObject(). A basic > example is shown here: > > https://docs.python.org/2/extending/embedding.html#pure-embeddi

Re: join and split with empty delimiter

2019-07-18 Thread Ben Bacarisse
Danilo Coccia writes: > Il 18/07/2019 12:27, Ben Bacarisse ha scritto: >> Irv Kalb writes: >> >>> 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(myLi

Re: Embedding Python in C

2019-07-18 Thread Christian Gollwitzer
Am 18.07.19 um 16:18 schrieb Jesse Ibarra: On Wednesday, July 17, 2019 at 2:20:51 PM UTC-6, Christian Gollwitzer wrote: What level of integration do you want to achieve? Do you want a) to call Python functions from Smalltalk b) call Smalltalk functions from Python c) pass callbacks around, e.g.

Re: join and split with empty delimiter

2019-07-18 Thread Danilo Coccia
Il 18/07/2019 12:27, Ben Bacarisse ha scritto: > Irv Kalb writes: > >> 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,

Re: Extendable Enum like Type?

2019-07-18 Thread Ethan Furman
On 07/18/2019 06:04 AM, Antoon Pardon wrote: I am experimenting with writing an Earley Parser. Now I would like to have the non-terminals from the grammer I am reading in, be represented bye an enum like type. So that if the grammer contains the following production: Term -> Term '+' Factor I ca

Re: Embedding Python in C

2019-07-18 Thread Jesse Ibarra
On Wednesday, July 17, 2019 at 2:20:51 PM UTC-6, Christian Gollwitzer wrote: > 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

Extendable Enum like Type?

2019-07-18 Thread Antoon Pardon
Something seems to have gone wrong with the formatting of my latest contribution, so let me try again. I am experimenting with writing an Earley Parser. Now I would like to have the non-terminals from the grammer I am reading in, be represented bye an enum like type. So that if the grammer contai

Extending an Enum type

2019-07-18 Thread Antoon Pardon
Hi, I am experimenting with writing an Earley Parser. Now I would like to have the non-terminals from the grammer I am reading in, be represented bye an enum like type. So that if the grammer contains the following production: Term -> Term '+' Factor I can reprensent the right hand side with a list

Re: join and split with empty delimiter

2019-07-18 Thread Richard Damon
On 7/18/19 6:27 AM, Ben Bacarisse wrote: > One reason might be that str.split('') is not unambiguous. For example, > there's a case to be made that there is a '' delimiter at the start and > the end of the string as well as between letters. '' is a very special > delimiter because every string th

Re: join and split with empty delimiter

2019-07-18 Thread Ben Bacarisse
Irv Kalb writes: > 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(myLis

Re: Embedding Python in C

2019-07-18 Thread Barry Scott
> On 17 Jul 2019, at 19:39, Jesse Ibarra wrote: > > 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