Making 'compiled' modules work with multiple python versions on Linux

2024-03-28 Thread Olivier B. via Python-list
I have a python module that includes some C++ code that links with the
Python C API

I have now modified the c++ code so that it only uses the Limited API,
and linked with python3.lib instead of python311.lib.

I can now use that python module with different python versions on Windows

But on Linux, it seems that linking to libpython3.so instead of
libpython3.11.so.1.0 does not have the same effect, and results in
many unresolved python symbols at link time

Is this functionality only available on Windows?
-- 
https://mail.python.org/mailman/listinfo/python-list


A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list

Hello

Suppose I have these 3 strings:

s1 = "AZERTY"
s2 = "QSDFGH"
s3 = "WXCVBN"

and I need an itertor who delivers

A Q W Z S C E D C ...

I didn't found anything in itertools to do the job.

So I came up with this solution:


list(chain.from_iterable(zip("AZERTY", "QSDFGH", "WXCVBN")))

['A', 'Q', 'W', 'Z', 'S', 'X', 'E', 'D', 'C', 'R', 'F', 'V', 'T', 'G', 
'B', 'Y', 'H', 'N']


Do you havbe a neat solution ?
--
https://mail.python.org/mailman/listinfo/python-list


Re: A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list

Le 28/03/2024 à 17:45, ast a écrit :


A Q W Z S C E D C ...


sorry
A Q W Z S X E D C


--
https://mail.python.org/mailman/listinfo/python-list


Re: A missing iterator on itertools module?

2024-03-28 Thread ast via Python-list

Le 28/03/2024 à 18:07, Stefan Ram a écrit :

ast  wrote or quoted:

s1 = "AZERTY"
s2 = "QSDFGH"
s3 = "WXCVBN"
and I need an itertor who delivers
A Q W Z S C E D C ...
I didn't found anything in itertools to do the job.
So I came up with this solution:
list(chain.from_iterable(zip("AZERTY", "QSDFGH", "WXCVBN")))


   Maybe you meant "zip(s1,s2,s3)" as the definition of s1, s2,
   and s3 otherwise would not be required. Also the "list" is not
   necessary because "chain.from_iterable" already is an iterable.
   You could also use "*" instead of "list" to print it. So,

import itertools as _itertools
s =[ "AZERTY", "QSDFGH", "WXCVBN" ]
print( *_itertools.chain.from_iterable( zip( *s )))

   . But these are only minor nitpicks; you have found a nice solution!


Why did you renamed itertools as _itertools ?
--
https://mail.python.org/mailman/listinfo/python-list