x27;m happy to see and talk to the
many, many users out there whom we could help to help their users get their
work done.
Happy anniversary, Cython!
Stefan
PS: The list of Cython implemented packages on PyPI is certainly
incomplete, so please add the classifier to yours if it's m
hrieb Peter Otten:
On 08/02/2021 22:33, Stefan Ritter wrote:
Hi,
It would be highly appreciated if you could offer me some advice to
solve a problem I'm currently facing:
I have a Windows 10 ADM64 desktop and a Windows 10 AMD64 Laptop.
I wrote some code to insert text in a .txt-file. It works
st regards,
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
tion should be the other way around.
But what is the reason (meaning) for the statement as it is?
Best regards,
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Jesse Ibarra schrieb am 22.07.19 um 18:12:
> On Saturday, July 20, 2019 at 1:11:51 PM UTC-6, Stefan Behnel wrote:
>> Jesse Ibarra schrieb am 20.07.19 um 04:12:
>>> Sorry, I am not understanding. Smalltlak VW 8.3 does not support Python.
>>> I can only call Pyhto
ond step 1), which is about
5 lines of Python C-API code if you write it yourself. Everything else can
be implemented in Cython and Python.
Stefan
[1]
https://docs.python.org/3/extending/embedding.html?highlight=PyImport_appendinittab#extending-embedded-python
--
https://mail.python.org/mailman/listinfo/python-list
ternal program (in case you really need to do
that and can't live with starting Python instead of Smalltalk), here's an
example:
https://github.com/cython/cython/tree/master/Demos/embed
It uses the "--embed" argument to Cython that generates a C (main) function
to start up the
y up to here) – are you sure the
above is a good user interface? Did you consider splitting the function
into two, one that takes arguments and one that takes none?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
designed to keep users from having to
learn all these things and instead lets you do them in Python.
https://cython.org/
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
t;th")
… in which case I would also 'precompute' the ".get" and give the resulting
callable a properly readable name all-together:
find_special_day_ordinal = mapper(
[1, 21, 31], "st",
[2, 22], "nd",
[3, 23], "rd",
Cameron Simpson schrieb am 23.01.19 um 00:21:
> from __future__ import absolute_imports, print_function
>
> gets you a long way.
... and: division.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
This could be implemented via a sequence of
generators or coroutines in Python. Such an approach is often used in
simulations (e.g. SimPy and other "discrete event" simulators), where exact
control over the concurrency pattern is desirable.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
I could.
I understand that it came to life as an exercise, and you probably won't
make production use of it. Actually, I doubt that there is a shortage of
prime detection libraries. ;) Still, thanks for the writeup. It's helpful
to see comparisons of "code how people write it" under different runtimes
from time to time.
Stefan
[1] http://cython.org/
--
https://mail.python.org/mailman/listinfo/python-list
that's the print
statement, which is really parsed as (Py2) statement here, not as (Py3)
function. In normal cases, the language level does not matter for the first
statement in the source (because, why would you have a print() there?), so
it took us a while to find this bug.
pip-installing Cython will get you the latest release, where this bug is
resolved.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
very unlikely to change within the Py3.7.x releases,
but they are hopefully going to change for 3.8. See PEP 580. Your feedback
on it is welcome.
https://www.python.org/dev/peps/pep-0580/
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
, you can say
doc.find(".//{http://some/namespace}Body";)
and there is also an .iterfind() method for incremental searches and
.findall() to return all matches as a list.
2) You can use the XPath subclass "ETXPath", which internally translates
qualified tag names to a pr
in the future, give
Cython a try. It can generate all the glue code safely for you, and
probably also generates faster wrapper code than you would write yourself.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
ent beast, because Python code can always be interrupted by
thread switches (between each byte code execution). C code cannot, unless
it starts executing byte code (e.g. for calculating a key's hash value) or
explicitly allows a thread switch at a given point.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
dynamism."
>
> You did refer us to http://lambda-the-ultimate.org/node/1519> on
> this forum. That contains a quote attributed to John Aycock with the
> meaning you paraphrase above.
And since the link in that article seems broken, here's the cited paper:
https://legacy
To: Steven D'Aprano
From: "Stefan Ram"
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>It has been a long, long time since Python has been a "simple" language
>suitable for rank beginners, if it ever was. Py
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Still, one must not forget that learning Python encompasses
>all the hard work it takes to learn how to program in every
>language.
"Beginner", however, is a very
To: Richard Damon
From: "Stefan Ram"
To: Richard Damon
From: r...@zedat.fu-berlin.de (Stefan Ram)
Richard Damon writes:
>Now, if I have a parser that doesn't use the locale, but some other rule
>base than I just need to provide it with the right rules, which is
>bas
To: Stefan Ram
From: "Stefan Ram"
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>def f():
>def g():
>g.x += 1
>return g.x
>g.x = 0
>return g
Or, "for all g to sha
To: Steven D'Aprano
From: "Stefan Ram"
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>def f():
>static x = 0
>def g():
>x += 1
>return x
>return g
What one can do today:
ma
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>It has been a long, long time since Python has been a "simple" language
>suitable for rank beginners, if it ever was. Python is not Scratch.
Python is simpler insofar as you c
To: Richard Damon
From: r...@zedat.fu-berlin.de (Stefan Ram)
Richard Damon writes:
>Now, if I have a parser that doesn't use the locale, but some other rule
>base than I just need to provide it with the right rules, which is
>basically just defining the right locale.
Here&
To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)
Steven D'Aprano writes:
>def f():
>static x = 0
>def g():
>x += 1
>return x
>return g
What one can do today:
main.py
def g():
g.x += 1
return g.x
g.x = 0
pri
To: Stefan Ram
From: r...@zedat.fu-berlin.de (Stefan Ram)
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>def f():
>def g():
>g.x += 1
>return g.x
>g.x = 0
>return g
Or, "for all g to share the same x":
main.py
def f():
's really just
about avoiding a call to "copy.deepcopy()" in certain special cases at the
cost of adding new syntax, then I have to agree that we'd better avoid
adding the syntax instead.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
ltin sequence types? The '**' operator cannot just recursively call
'**' on the items in the list, because they may not support it. Or they may
support it, but not in the expected way.
And limiting this to lists of lists seems rather arbitrary. What about
subtypes of lists?
\digit\Anaconda3\lib\encodings\cp1252.py", line 23, in decode
> return codecs.charmap_decode(input,self.errors,decoding_table)[0]
>
> UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 202:
> character maps to
>
>
> I suspect the issue is that it's using cp1252.py, which I don't think is
> UTF-8 as specified in the XML prolog. Is this an iterparse problem, or am I
> using it wrongly?
You are not showing enough of the stack trace to properly diagnose this
problem, but seeing your code, my educated guess is that the problem is the
encoding of the file *path name* and not the *content* of the XML file.
I.e. it probably cannot even open the file.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
t the parser uses.
Note, however, that the library that the OP uses is not lxml but xml.etree,
i.e. the ElementTree XML support in the standard library.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
print('x after foo', x)
class z:
v = 12345
def bar(y):
z.v = 2 * y # this is global
print('z.v in bar', z.v)
print('z.v before bar', z.v)
bar(0)
print('z.v after bar', z.v)
Cheers
Ste
ly just reverse engineering the Python code
from the C-API code), but it's a one-time investment that can reduce the
long-term maintenance cost a lot, often improves the performance, and
usually also leads to nicer Python APIs, as what you get in the end is more
obvious from the code, so you c
Peter Otten schrieb am 09.03.2018 um 14:11:
> Stefan Behnel wrote:
>
>> Andrew Z schrieb am 07.03.2018 um 05:03:
>>> Hello,
>>> with 3.6 and latest greatest lxml:
>>>
>>> from lxml import etree
>>>
>>> tree = etree.parse(
Steven D'Aprano schrieb am 09.03.2018 um 12:41:
> On Fri, 09 Mar 2018 10:22:23 +0100, Stefan Behnel wrote:
>
>> Andrew Z schrieb am 07.03.2018 um 05:03:
>>> Hello,
>>> with 3.6 and latest greatest lxml:
>>>
>>> from lxm
tial Sample.xml:
>
>
> http://www.example.com";>
>
>md_status_nonpro="true" type="INDIVIDUAL" prefix="jadoe">
>
>
>
> it seems to not be happy with the empty tag .
> But i'm not sure why and how to go about it.
Could you explain why you want to do that?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
always be careful when evaluating benchmarks and their results, and
to take good care that the benchmarks match the intended need, which is to
help us understand and solve a real-world performance problem [1].
Stefan
[1] That's also the problem in the post above and in the original
benchmarks it
The code it generates is
probably also faster and safer than what you are currently writing (no
offence, just experience from reading and writing a lot of such code).
http://cython.org/
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
bhattacharya.kush...@gmail.com schrieb am 17.01.2018 um 12:03:
> Is there any python framework or any tool as which can generate C code from
> python code as it is .
http://cython.org/
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Cai Gengyang writes:
Statement 0:
>count = 0
Statement 1:
>if count < 5:
> print "Hello, I am an if statement and count is", count
Statement 2:
>while count < 10:
> print "Hello, I am a while and count is", count
> count += 1
There are three statements here.
They are executed
Ram) (Stefan Ram)
Greg Tibbet writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
>&
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Then you can use pickle or custom methods to save and
>restore the object, or get the state from an iterator
>and create a new iterator with that state later.
One does not always have to write a custom class,
for example:
main.py
impo
Greg Tibbet writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
>"""Draw an ellipse."""
>ink, fill = sel
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Then you can use pickle or custom methods to save and
>restore the object, or get the state from an iterator
>and create a new iterator with that state later.
One does not always have to write a custom class,
for example:
main.py
impo
Greg Tibbet writes:
>I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
>of Java and trying to learn this new-fangled Python language!
Which actually is older than Java.
>def ellipse(self, xy, fill=None, outline=None):
>"""Draw an ellipse."""
>ink, fill = sel
e: it's much
easier to write extension modules in Cython than in plain C and C-API code.
Much easier. There is a learning curve, sure, but it unburdens you from so
many pitfalls and boilerplate code that it's always worth switching. And
you also get faster code as a side-effect. How's that for a tradeoff. :)
Stefan
(Cython core developer)
--
https://mail.python.org/mailman/listinfo/python-list
Stefan Ram schrieb am 26.09.2017 um 17:56:
> Why do we newbies write »print 2«? Here's another hint.
> This is an original transcript of what happened to me today:
>
> |>>> import( operator )
> | File "", line 1
> |import( operator )
>
t is the tooling for this? Is there some documentation, maybe a
> mailingslist-diskussion or a but-report?
https://docs.python.org/devguide/committing.html#what-s-new-and-news-entries
https://github.com/larryhastings/blurb
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Stefan Ram schrieb am 19.09.2017 um 17:00:
> D'Arcy Cain writes:
>> of course, I use calculators and computers but I still understand the
>> theory behind what I am doing.
>
> I started out programming in BASIC. Today, I use Python,
> the BASIC of the 21st cen
ng foreign
dependencies low is also "better" in some cases.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Steve D'Aprano schrieb am 02.09.2017 um 02:31:
> - the German eszett, ß, which has two official[1] uppercase forms: 'SS'
> and an uppercase eszett
I wonder if there is an equivalent to Godwin's Law with respect to
character case related discussions and the Ge
out how to release them explicitly if they find out that they hurt
and then additionally manage to debug where they are stored. Py2.x did the
latter, and guess how many users knew about it?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
he core and the stdlib would just not work correctly in
> multithread environment without GIL.
And the same applies to external extension modules. The GIL is really handy
when it comes to reasoning about safety and correctness of algorithms under
the threat of thread concurrency. Especially in
Hi!
Germany has three major Python events planned this year:
- PyCon-Web in München (May 27-28th)
- Python-Camp in Köln (April 8-9th)
- PyCon-DE in Karlsruhe (October, dates TBA).
http://pyconweb.org/
https://python-verband.org/informieren/events/pythoncamp-2017
Stefan
Stephane Wirtel via
n such a fashion returns this error:
>
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0:
> invalid start byte
Same thing as above: I don't see how this error message matches the code
you show here. The exception you get might be a Python 2.x problem in the
first place.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
er loop
Note that this is the worst benchmark ever. Any non-dump C compiler will
happily apply Young Gauß and calculate the result in constant time.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Ganesh Pal schrieb am 01.09.2016 um 17:24:
> Thanks stefan and Gollwitzer , good to know there are many ways to do this
> i.e via cython or SWIG but the C/Python API
> <https://docs.python.org/2/c-api/> is probably the most widely used method
It certainly was, years ago, but I
es . We
> have bunch of C code that's already available and C -Python seems to suit
> me better
>From your response it's not obvious whether you are aware that Cython also
makes it substantially easier to *interface* CPython with external C code,
in the same way that it makes it easy (but not necessary) to *avoid*
writing C in the first place. So I thought I'd just mention that this is
not a reason to rule it out as an excellent option.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
aising a proper IndexError for invalid index arguments
(and it supports negative indexing). I also wouldn't be surprised if it's
visibly faster than your C implementation.
Unless your intention is to explicitly learn how to use the CPython C-API,
you should give Cython a try instead.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Stefan Behnel schrieb am 22.08.2016 um 08:03:
> Steven D'Aprano schrieb am 22.08.2016 um 07:35:
>> if sys.version < '3':
>> import mymodule2 as mymodule
>> else:
>> import mymodule3 as mymodule
>
> This condition is going to fail when P
Steven D'Aprano schrieb am 22.08.2016 um 07:35:
> if sys.version < '3':
> import mymodule2 as mymodule
> else:
> import mymodule3 as mymodule
This condition is going to fail when Python 30.0 comes out.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
n parallel or concurrently, but there's really nothing
special about that use case.
Does that answer your question?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
t uses a direct
name import, renaming the function at the same time is easy enough. I often
do that with "os.path.join", for example, which turns into "join_path" on
import. Same problem, easy solution.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
ly one that can be queried with xpath) at
> a time for each record of a document representing a list of objects.
> Does anything like that exist?
http://lxml.de/parsing.html#incremental-event-parsing
https://docs.python.org/3/library/xml.etree.elementtree.html#pull-api-for-non-blocking-parsing
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
tp://cython.org/
http://docs.cython.org/
In a nutshell, it lets you write beautiful Python code instead of ugly C
code full of leaks and crashes, and then takes care of making it faster
than the usual C-API calls you'd write by hand. It has some extended syntax
for extension types and oth
et the CFLAGS environment variable, e.g.
CFLAGS="-O3 -march=native" pip install --no-use-wheel numpy
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
32 -m stefan
Before you write, think, after you read.
Am 01.04.16 um 00:26 schrieb Victor Stinner:
> Hi,
>
> Python 3 becomes more and more popular and is close to a dangerous point
> where it can become popular that Python 2. The PSF decided that it's
> time to elaborate a new s
mul)
)
`pipe` also allows you to us named arguments which would be difficult
if you use operator overloading:
pipe("sentaoisrntuwyo", (sorted, {"reverse": True}))
Beste Grüße,
Stefan
On Wed, Mar 16, 2016 at 4:39 PM, Steven D'Aprano wrote:
> On Thu, 17 Mar 2016 02:22
satsatsastatbadstssdhhhnbb", set, (sorted, {"reverse": True}))
['t', 's', 'n', 'h', 'd', 'b', 'a']
Cheers,
Stefan
[0] https://github.com/sotte/pelpe
[1]
http://elixir-lang.org/getting-started/enumerables-and-
n code.
I strongly recommend not to resort to writing real C code here (using the
C-API of CPython). It will be slower and will contain more bugs.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
t about the basics of input validation.
It really helps in trust building to find such comments from time to time.
Stefan
[1] mainframes on the Internet, anyone?
--
https://mail.python.org/mailman/listinfo/python-list
t has all its (necessary) dependencies
available in Python 3.x, I can't see a general reason to keep supporting
both language versions.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
a Python object interface to the XML tree, similar to what
data binding would give you. And you can stick your own Element object
implementations into it if you feel a need to simplify the API itself
and/or adapt it to a given document format.
http://lxml.de/objectify.html
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
welcome to Python (and to this list). The usual way to reply here is
inline, after stripping anything that's not relevant to your reply.
AllanPfalzgraf schrieb am 25.08.2015 um 15:03:
> From: Stefan Behnel:
>> Al Pfalzgraf schrieb am 18.08.2015 um 15:07:
>>> If a lo
ldn't bother too much finding it out. It's unlikely to hurt real-world
code. (And in fact, the more interesting case where things are happing
several times in a row rather than being a negligible constant one-time
effort seems to be substantially faster in your timings. Congratulations!)
> is there a solution?
Is there a problem?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
he usual C-API overhead.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
our application a command-line tool or so that needs to start
and terminate quickly?
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico schrieb am 31.07.2015 um 09:37:
> On Fri, Jul 31, 2015 at 5:26 PM, Stefan Behnel wrote:
>> Your C code seems to be only about 1500 lines, not too late to translate
>> it. That should save you a couple of hundred lines and at the same time
>> make it work wi
e
make it work with Python 3 (which it currently doesn't, from what I see).
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
ive the class you call it on as first
argument (i.e. "Super" and "object" above), not the class you want to
instantiate (i.e. "Sub" or "Super").
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
XML, by the way, also to CSV and other tabular formats.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
en implementing the desired feature in an
existing compiler would be a one-time investment with a much smaller
overall impact on further maintenance costs?
Not Invented Here Syndrome, I guess...
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
ava code that should be reasonably maintainable.
If you want to integrate Python code with Java code, take a look at Jython
instead. If that's not what you want, then feel free to unveil your intentions.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
doc.mefi...@gmail.com schrieb am 07.06.2015 um 10:56:
> And I can't use Cython, because I have C++ module, and I have to use it.
That's not a valid reason. Cython supports C++ code just fine.
http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html
Stefan
--
https://ma
dn't know and now got interested, the relevant term
here is "stable sorting". It means that elements that compare equal keep
their relative order. That's a general property of Python's sort algorithm.
All that "reverse=True" does is to change "lower than"
x27;d always recommend using Cython over a wrapper generator
like SWIG. Once you get to the points where it becomes interesting, you'll
always end up having more fun writing a Cython based integration layer than
fighting your up-hill battle against the way the wrapper generator wants
you to design it.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
, here's a Cython [1] version of
your code:
# put this in a file called "foo.pyx"
def gcd(int x, int y):
while x > 0:
y, x = x, y % x
return y
Compile it ("cythonize -b foo.pyx") and you'll get an extension module that
execut
y done for you_, same as you get a JIT
> for free, and pluggable garbage collectors for free, etc. etc.
So here the cost of security is actually rewriting the entire language
runtime and potentially also major parts of its ecosystem? Not exactly a
cheap price either.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico schrieb am 29.05.2015 um 09:41:
> On Fri, May 29, 2015 at 4:18 PM, Stefan Behnel wrote:
>>> Lua's a much weaker language than Python is, though. Can it handle
>>> arbitrary-precision integers? Unicode? Dare I even ask,
>>> arbitrary-prec
Chris Angelico schrieb am 28.05.2015 um 20:51:
> On Fri, May 29, 2015 at 4:41 AM, Stefan Behnel wrote:
>> davidf...@gmail.com schrieb am 26.05.2015 um 04:24:
>>> Has anyone on this list attempted to sandbox Python programs in a
>>> serious fashion? I'd be
by intercepting all Python attribute lookups.
It doesn't add much to your application to embed Lua (or even LuaJIT) in
Python, and it gives users a nicely object oriented language to call and
orchestrate your Python objects.
Stefan
[1] https://pypi.python.org/pypi/lupa
--
https://mail.pyt
a somewhat biased expert, but
using Cython to generate a statically compiled and optimised C++ wrapper is
really your best choice. IMHO, it provides the best results/tradeoffs in
terms of developer effort, runtime performance and overall end user experience.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
executing a
Python function by some mostly equivalent but more general Python code. So,
you're basically replacing a function call by another function call to
eval(), plus some extra generic setup overhead.
Python functions know exactly what they have to do internally in order to
execute. eval() cannot make the same streamlined assumptions.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Marko Rauhamaa wrote:
> Anyway, Python has os.system() that does the quick and dirty thing you
> might be looking for.
Always invokes shell ==> overhead for .exe files
--
https://mail.python.org/mailman/listinfo/python-list
This discussion is getting really interesting and far beyond the actual topic :)
I want to add some additional thoughts on Popen:
Marko Rauhamaa wrote:
> Stefan Zimmermann:
>
> > And last but not least, Popen behavior on Windows makes it difficult
> > to write OS-independent
And last but not least, Popen behavior on Windows makes it difficult to write
OS-independent Python code which calls external commands that are not binary by
default:
2 examples:
1. I wrote a coffeetools package which wraps the CoffeeScript compiler in a
Python API. The 'coffee' command is a N
Nice to see that my topic gains that interest :)
And I see that I should have gone more into detail about what I'm actually
trying to point out.
Chris Angelico wrote:
> Hmm... hm... Ha! Found the difference. I had an explicit shebang on my
> script; yours just starts out with shell commands. That
that is a heavy
overhead for .exe files.
Currently I use pywin32 and call Popen([win32api.FindExecutable('command')[1]])
as a workaround. This has zero overhead.
It should be default for Popen to call FindExecutable internally.
Was this discussed before?
Is it worth a PEP?
Or at least
ly
put into it.
So, if you want to parse from XML instead, use ElementTree:
https://docs.python.org/3/library/xml.etree.elementtree.html
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
1 - 100 of 2239 matches
Mail list logo