Re: Python dictionary size/entry limit?

2009-02-21 Thread Stefan Behnel
er served with one of the dbm databases that come with Python. They live on-disk but do the usual in-memory caching. They'll likely perform a lot better than your OS level swap file. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: descriptor 'replace' requires a 'str' object but received a 'unicode'

2009-02-21 Thread Stefan Behnel
#x27;) > TypeError: descriptor 'replace' requires a 'str' object but received a > 'unicode'" > > How can I solve this? By using unicode.replace() instead of str.replace(), i.e. Omschrijving = Omschrijving.replace("priv?", 'privé') Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ordinal not in range

2009-02-21 Thread Stefan Behnel
Jaap van Wingerde wrote: > Stefan Behnel wrote: >> Omschrijving = Omschrijving.replace("priv?", 'privé') actually, make that Omschrijving = Omschrijving.replace(u"priv?", u'privé') (mind the u"...") > > import c

Re: Python dictionary size/entry limit?

2009-02-22 Thread Stefan Behnel
r caching? > BTW, the target platform is Linux. Their interfaces are mostly compatible to Python dicts. Just keep your code independent at the beginning and benchmark it against all of them. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Stefan Behnel
Steven D'Aprano wrote: > What does the S stand for? The S stands for simple. http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: what's so difficult about namespace?

2008-11-26 Thread Stefan Behnel
he more general interest appears to be spreading controversial topics over a vast number of newsgroups. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C/API simple debugging

2008-11-26 Thread Stefan Behnel
7;d use gdb for debugging these things. It does have a learning curve, but in change gives you a lot more than just "print-debugging". Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: zope vs openACS

2008-11-26 Thread Stefan Scholl
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Stefan Scholl a écrit : >> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> On Nov 19, 1:50 am, gavino <[EMAIL PROTECTED]> wrote: >>>> what is nicer about each? >>> Yes. >> >> And

Re: what's so difficult about namespace?

2008-11-26 Thread Stefan Behnel
eme lisp, Emacs lisp, PHP? Think before you write. It's exactly the same thing. How would you get all Emacs users in the world to upgrade? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: iterating over a variable which could be None, a single object, or a list

2008-11-27 Thread Stefan Behnel
e of returning None, where it would now return an empty list. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Exhaustive Unit Testing

2008-11-27 Thread Stefan Behnel
ons that are not worth testing due to obvious triviality, is pretty hubristic. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any project whose patches are all available?

2008-11-27 Thread Stefan Behnel
e talking about two completely unrelated things: reloading code into the Python interpreter, and keeping track of changes in the development of code. I think what you have in mind is that smaller changes make code reload easier than bigger changes, especially API changes. Stefan -- http://mail.p

Re: Is there any project whose patches are all available?

2008-11-27 Thread Stefan Behnel
Stefan Behnel wrote: > I think what you have in mind is that smaller changes make code reload > easier than bigger changes, especially API changes. ... or ABI changes in the general case, although that's not a major difference in the Python context. Stefan -- http://mail.python.

Re: Reverse zip() ?

2008-12-02 Thread Stefan Behnel
,2,3] >>> zip(l,l) [(1, 1), (2, 2), (3, 3)] >>> zip(*zip(l,l)) [(1, 2, 3), (1, 2, 3)] Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Reverse zip() ?

2008-12-02 Thread Stefan Behnel
st, tuple)) else list(some_iterable))) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API

2008-12-05 Thread Stefan Behnel
;, kwlist, > &PyFunction_Type, &hook)) > return NULL; You have to release the GIL around the following function call, so that the thread above can acuire it while you wait for the function to return in this thread here (which I assume you do). > LONG ok

Re: Small problem with Psyco

2008-12-05 Thread Stefan Behnel
xtension type that inherits from its C equivalent at the C level. I assume that psyco does something similar here. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't you just love writing this sort of thing :)

2008-12-06 Thread Stefan Behnel
mathematics is > a notation. > > And mathematics, too, is a predominantly functional, not a procedural, > notation. Could that be why so many people are frightened of functional > constructs, like my code example and things like lambdas? Because they look > too much like mathe

Re: Python is slow

2008-12-12 Thread Stefan Behnel
David Cournapeau wrote: > I want faster function > calls to use with numpy: do you know of any solution ? http://cython.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is slow

2008-12-12 Thread Stefan Behnel
, but translate directly to fast pointer > arithmetics. http://docs.cython.org/docs/numpy_tutorial.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API and memory allocation

2008-12-17 Thread Stefan Behnel
o reduces the amount of memory handling you have to care about. http://cython.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API and memory allocation

2008-12-18 Thread Stefan Behnel
on byte strings is 0 terminated, so strlen() will work. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API and memory allocation

2008-12-19 Thread Stefan Behnel
st byte strings I've seen didn't, though. And if you know that they don't contain any null bytes (UTF-8 serialised XML, for example, or ASCII encoded text, or ...), 's' is just fine. If you need content *and* length, use 's#'. Matter of use case, as usual. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Stefan Behnel
eaker: is this now valid english? > > "One of Python’s great strengths" > ^ > "and also teaches Python’s functional programming features" > ^ > "The book’s approach is wholly practical" >^

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Stefan Behnel
first reaction was to recognise how stupid you'd have to be to make that a static method that ignores the string it's called on. :) I think '...'.format() makes sense given that we already have '...'.join(). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a locked buffer from objects (PEP 3118)

2008-12-27 Thread Stefan Behnel
to free the GIL or not. > And while we are at it :-) Is "PyArg_Parse('[syz]*'..." the only way to > get a locked buffer-view from string/byte objects? What kind of locking do you need? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-30 Thread Stefan Behnel
Mark Thomas wrote: > The main difference is that lxml doesn't have CSS selector syntax Feel free to read the docs: http://codespeak.net/lxml/cssselect.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-30 Thread Stefan Behnel
like chardet: http://chardet.feedparser.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-30 Thread Stefan Behnel
e web. Does Python have anything similar, i.e. > something that will not only do XPath queries, but will do so on > imperfect HTML? lxml.html is your friend. http://codespeak.net/lxml/lxmlhtml.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in C

2008-12-30 Thread Stefan Behnel
akineko wrote: > The more you work on Python, the harder you can go back to C or C++ > world. > > I use SWIG, instead. I think SWIG is a good way to mix two worlds. If you find it hard to go from Python back to C, you should have a look at Cython. http://cython.org/ St

Re: Which SOAP module?

2009-01-04 Thread Stefan Behnel
rver I think you > have to rely on the ZSI (http://pywebsvcs.sourceforge.net/) > project. In retrospect my first steps in this library were rather > painful but som year ago it was the most sophisticated library. Use soaplib (for client and/or server), it's a lot less painful. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C or C++

2009-01-06 Thread Stefan Behnel
eleases). However, I'd recommend Cython instead, as it gives you very fast and portable code that works with all CPython versions. And Cython code is not any harder to write at all. http://cython.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Any news on when some libraries will be ported to Python 3.0?

2009-01-07 Thread Stefan Behnel
t; Mechanize. I could also use DB. > Has there been any word on Beautiful Soup? At least for new code, you can use lxml instead. Being written (mostly) in Cython, it compiles and works in Py3. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with cPickle and cElementTree

2008-10-09 Thread Stefan Behnel
ok at lxml.objectify. Note that it's only partially compatible with ElementTree, so you will have to change your code (lxml.etree is mostly compatible, but it doesn't support pickling). It's a very easy-to-use XML library, though. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing my own Python interpreter

2008-10-14 Thread Stefan Behnel
st. In case you come to the conclusion that reimplementing Python is too big for a final year project, you might as well find a couple of good ideas in Cython's list of potential enhancements. Check the Wiki. http://cython.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API with *args and **kw

2008-10-14 Thread Stefan Behnel
fault" Consider using Cython instead, it will make your life a lot easier. The above is valid Cython code that the Cython compiler translates into optimised C code. http://cython.org/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: xml.etree.ElementTree and XPath

2008-10-18 Thread Stefan Behnel
quot;node": print el.tag which works in both ET and lxml.etree. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6, 3.0, and truly independent intepreters

2008-10-24 Thread Stefan Behnel
ready? Maybe you meant Windows 1.0? SCNR-ly, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Urllib vs. FireFox

2008-10-24 Thread Stefan Behnel
t; > Why do they differ? The browser sends a different client identifier than urllib, and the server sends back different page content depending on what client is asking. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml removing tag, keeping text order

2008-10-25 Thread Stefan Behnel
> There's a drop_tag() method in lxml.html (lxml/html/__init__.py) that does what you want. Just copy the code over to your code base and adapt it as needed. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: project in python

2008-10-25 Thread Stefan Behnel
omes that they are willing to answer you. There are a lot of projects out there that might make an interesting starting point for you. Check PyPI. http://pypi.python.org/pypi?%3Aaction=browse Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: XML-RPC

2008-10-26 Thread Stefan Behnel
asit wrote: > what is XML-RPC System Doesn't Wikipedia tell you that? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: parse a table in HTML page.

2008-10-28 Thread Stefan Behnel
ng to parse: > elognormal text > > Output: > [[['elog', 'normal text']]] You should try lxml.html. It gives you various tools like XPath to look for specific elements and helper functions to find the links in an HTML document. http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML File Parsing

2008-10-28 Thread Stefan Behnel
rseError: bad end tag: "", at > line 515, column 45 Your HTML page is not HTML, i.e. it is broken. Python's HTMLParser is not made for parsing broken HTML. However, you can use the parse of lxml.html to fix up your HTML for you. http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: beutifulsoup

2008-10-29 Thread Stefan Behnel
Peter Pearson wrote: > Like you, I struggle with BeautifulSoup Well, there's always lxml.html if you need it. http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: remote unzip

2008-11-01 Thread Stefan Behnel
ile) > for f in unzip.namelist(): > if f.endswith('.xml'): > output.write(unzip.read(unzip)) > xmlfiles.append(output.getvalue()) > > sftp.close() > ssh.close() I suppose this code doesn't work for you? What's the output you get? "don't seem to be able" is not a very helpful problem description. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: encoding in lxml

2008-11-03 Thread Stefan Behnel
ding="utf-8". That way, when it's not UTF-8, you will get an exception at parse time, which allows you to reparse the document with another encoding (say, ISO-8859-1) to get the correct content. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python_and_WSDL

2008-11-04 Thread Stefan Behnel
Dejan Pangercic wrote: > question is, does anyone know about any up2date equivalent for > connecting to WSDL from python? It seems like you missed soaplib. Compared to other Python SOAP libraries, it's pretty easy to use. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: convert to XMLRPC

2008-11-06 Thread Stefan Behnel
ely copy the attributes of your objects into the E factory of lxml, either with generic code, or with specialised code for each (sub-)object. http://codespeak.net/lxml/tutorial.html#the-e-factory There's also a separate implementation for plain ElementTree (the xml.etree package) by Fred

Re: need money for comp. shit?

2008-11-06 Thread Stefan Behnel
bslobodi wrote: > [spam stripped] Sorry, I didn't find comp.shit on Gmane. Did you mean comp.shell or something in that line? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Workflow engine?

2008-11-08 Thread Stefan Behnel
I think I'd manage to write a web > framework too - do you really think it would be a good idea to start > writing another one? I think Tino was more referring to the fact that state machines are too trivial to write in Python to merit a whole framework. http://www.google.de/search?q=python+state+machine Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 - is this true?

2008-11-09 Thread Stefan Behnel
entertainment show was more expensive than the average Marx-Brothers sketch). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 - is this true?

2008-11-09 Thread Stefan Behnel
bda x:(type(x),x)) > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: type() < type() However, for an arbitrary ordering of types, id(type(o1)) <= id(type(o2)) will work well enough. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree XML Namspace

2008-11-15 Thread Stefan Behnel
u need validation? http://codespeak.net/lxml/validation.html http://codespeak.net/lxml/objectify.html#asserting-a-schema Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Cython Installation on Windows

2008-11-18 Thread Stefan Behnel
disutils.cfg should have the > following lines) > > [build] > compiler=mingw32 Not quite the perfect place to report this (the Cython mailing list would have been just right), but thanks anyway. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions ... slow

2008-11-18 Thread Stefan Behnel
it into C code, and then benchmark that. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: XML -> Tab-delimited text file (using lxml)

2008-11-19 Thread Stefan Behnel
collect[child.get('ValueId')] = child.get('value') print "%s\t%s\t%s\t%s" % ((id,) + tuple( collect[key] for key in ['name','description','image'])) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: zope vs openACS

2008-11-21 Thread Stefan Scholl
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Nov 19, 1:50 am, gavino <[EMAIL PROTECTED]> wrote: >> what is nicer about each? > > Yes. And No. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C-API Object Allocation

2009-02-24 Thread Stefan Behnel
on a try. http://cython.org Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dictionary size/entry limit?

2009-02-25 Thread Stefan Behnel
y smaller > (about 2**30). Which, in practice, means that the size is limited by the available memory. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: removing duplication from a huge list.

2009-02-27 Thread Stefan Behnel
ta are lines of a file, and keeping the original order isn't > important, then the first to try may be to use the unix (or cygwin on > Windows) commands sort and uniq. or preferably "sort -u", in case that's supported. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to parse form in client side?

2009-02-27 Thread Stefan Behnel
eed to parse this html_source file, at client side. Is there > a module to handle this? Can somebody help? Thanks! lxml.html has good form handling support: http://codespeak.net/lxml/lxmlhtml.html#forms Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Define a constant in Python C extension

2009-02-27 Thread Stefan Behnel
fredbasset1...@gmail.com wrote: > I'm writing a C extension for Python, is it possible to define > constants in the C code and have them visible from Python? Have you looked at Cython? It allows you to define e.g. enums as "public" and will generate the rest for you. http

Re: Performance of Python 3

2009-03-01 Thread Stefan Behnel
use someone shows me benchmark results of some code that I absolutely don't need in my daily work. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of Python 3

2009-03-01 Thread Stefan Behnel
Isaac Gouy wrote: > On Mar 1, 8:10 am, Stefan Behnel wrote: >> As long as that gives you improvements of >> 100-1000 times almost for free, I wouldn't bother too much with changing >> the platform just because someone shows me benchmark results of some code >> th

Re: Performance of Python 3

2009-03-02 Thread Stefan Behnel
Isaac Gouy wrote: > On Mar 1, 11:24 am, Stefan Behnel wrote: >> Isaac Gouy wrote: >>> On Mar 1, 8:10 am, Stefan Behnel wrote: >>>> As long as that gives you improvements of >>>> 100-1000 times almost for free, I wouldn't bother too much with changing

Asking for prophecy

2009-03-06 Thread Stefan Spoettl
vangard of the community don't like to use at least 2.6 for bridging to the future Python? Is this the mutiny against the empery of the BDFL or is the vangard just asking for some more time? If I want to attest my personal attachment to the king by using 3.0, what will happen? Will I be deser

Re: Parsing unicode (devanagari) text with xml.dom.minidom

2009-03-07 Thread Stefan Behnel
with the xml.etree package that comes with Python2.5 and later (it's also avalable for older versions). It's a lot easier to use, more memory friendly and also much faster. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing unicode (devanagari) text with xml.dom.minidom

2009-03-08 Thread Stefan Behnel
ing to cElementTree before major code gets written is almost certainly a good idea here. Stefan -- http://mail.python.org/mailman/listinfo/python-list

comparing (c)ElementTree and minidom (was: Parsing unicode (devanagari) text with xml.dom.minidom)

2009-03-08 Thread Stefan Behnel
mentTree as the (likely) shorter and more readable code (which usually translates into shorter development and debugging times) and the higher execution speed. Honestly, I haven't seen a reason in a while why preferring minidom over any of the ElementTree derivates would be a good idea when st

Re: where is the PyString_AsString in Python 3.0?

2009-03-08 Thread Stefan Behnel
b); > > how do I transfer the exc_type in a char* ? Are you sure you want the exc_type and not the exc_value? The only major thing I'd do with the type of an exception is to let Python check for it using PyErr_ExceptionMatches(). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: where is the PyString_AsString in Python 3.0?

2009-03-08 Thread Stefan Behnel
BigHand wrote: > Finally I got the results now. This did take me 10 hours to solve > this. the docs of 3.0.. You will have to get used to Unicode. The code you used against the C-API mimics almost exactly the steps you'd use at the Python level. Stefan -- http://mail.python.

Re: xml input sanitizing method in standard lib?

2009-03-10 Thread Stefan Behnel
This thread is about unallowed characters in XML. The set of allowed characters is defined here: http://www.w3.org/TR/xml/#charsets And, as Terry Reedy pointed out, the "unicode.translate" method should get you where you want. Just define a dict that maps the characters that you want

Re: can python import class or module directly from a zip package

2009-03-10 Thread Stefan Behnel
Flank wrote: > can python import class or module directly from a zip package Yes, just put the .zip file into your PYTHONPATH. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree: How to return only unicode?

2009-03-14 Thread Stefan Behnel
these methods return > ordinary strings instead of unicode. So sometimes I get str, > sometimes I get unicode. Can one change this globally so that they > only return unicode? That's a convenience measure to reduce memory and processing overhead. Could you explain why this is a prob

Re: ElementTree: How to return only unicode?

2009-03-15 Thread Stefan Behnel
Torsten Bronger wrote: > Hallöchen! und zurück! > Stefan Behnel writes: > >> Torsten Bronger wrote: >> >>> [...] >>> >>> My problem is that if there is only ASCII, these methods return >>> ordinary strings instead of unicode. So s

Re: Regarding the lxml import error only in a web-request

2009-03-20 Thread Stefan Behnel
hose *instead* of installing libxml2/libxslt separately, or build lxml with the "--auto-rpath" option to make it remember the path where the libraries were installed when it was compiled. BTW, you do not need the Python bindings for those two libraries installed, in case y

Re: Downloading binary files - Python3

2009-03-21 Thread Stefan Behnel
m its server, without preventing other threads from receiving data from their server at the same time. That should get your bandwidth usage up. You may have to take care that you do not run too many threads against the same server (which may get upset and block your requests, depending on the site)

[ANN] lxml 2.2 released

2009-03-21 Thread Stefan Behnel
ha1. Have fun, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] lxml 2.2 released

2009-03-21 Thread Stefan Behnel
t; My understanding is that we can replace our use of elmentree and > htmlparser with lxml. Yes, although the API of HTMLParser is different from lxml's own HTML parser and tree interface (which is basically trivial). > Congrats on your latest release! Thanks! Stefan -- http://mail.p

Re: iteration without storing a variable

2009-03-25 Thread Stefan Behnel
0000): a += "A" ' real0m0.140s user0m0.132s sys 0m0.008s Stefan (BTW, this is using Python 2.5.2 on Ubuntu Linux etc.pp., but no-one's interested in these details anyway, right?) -- http://mail.python.org/mailman/listinfo/python-list

Re: iteration without storing a variable

2009-03-25 Thread Stefan Behnel
n many aspects (as is Py2.6 compared to 2.5 or 2.4, BTW), so I think version numbers matter a lot in this case. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: xml to xhtml

2009-04-02 Thread Stefan Behnel
your application independent of a particular web server (and testable even without a web server). If you want to do XSLT in Python, lxml is a very good choice: http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Generation

2009-04-03 Thread Stefan Behnel
t; "Python.org") > > tabbed_file(mypage, open('myfile.html', 'w')) See here for another example that uses lxml.html: http://codespeak.net/lxml/lxmlhtml.html#creating-html-with-the-e-factory Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml and xslt extensions

2009-04-04 Thread Stefan Behnel
; print result > > displays the entire document. To make use of the keyword options > xml_declaration, pretty_print, encoding, I tried using the .write > method of result to a StringIO but it produces the same clipped > result. Guess Ill have to edit the .docinfo attributes on the result > and return the string .docinfo is basically read-only. The result of the XSLT is serialised as requested by the xsl:output element in the stylesheet. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyXML and Python-2.6

2009-04-07 Thread Stefan Behnel
;, so > perhaps the SIG page could be updated. > > Is there a guide to porting projects that depend on PyXML to Python-2.6? Depending on how large your project is (and how well you encapsulated the XML code), a partial rewrite using ElementTree or lxml might be worth it. You'

Re: xml.dom.minidom getElementsByTagName white space issue

2009-04-09 Thread Stefan Behnel
tell what you are getting is invalid XML. > So I think the answer is "you can't do that". > > (cf: http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameChar) Yes, that is correct. You should check why you are getting this (i.e. who sends you this) and have them fix it. There is nothing you can (or should!) do on your side to work around this. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Question to python C API

2009-04-15 Thread Stefan Behnel
ok at Cython. It allows you to write C extensions in a Python-like language, so all of the above become trivial, e.g. cdef class MyExtensionType(object): def __init__(self, bint some_c_bool): print type(self) is MyExtensionType print some_c_bool == 1 C

Re: Question to python C API

2009-04-16 Thread Stefan Behnel
al language for wrapping external C libraries, and for fast C modules that speed up the execution of Python code. """ If you want a fast wrapper module that is easy to write and maintain, while having all the freedom to design the Python-level API the way you want, I don't thi

Re: Question to python C API

2009-04-16 Thread Stefan Behnel
that you can easily hand-tune to your needs. You basically have all the freedom of the Python language with all the freedom of the C language. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access C structures

2009-04-17 Thread Stefan Behnel
hat you can import and use from Python. http://cython.org Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Question to python C API

2009-04-18 Thread Stefan Behnel
bled python V3 That's the core problem. :) Like many other Python packages, Cython doesn't currently run in Py3. You can run it in any Py2 version starting from 2.3, and the code it generates will run on 2.3 through 3.1a1. But the Cython compiler itself requires 2.x. This is being fixed up as we speak, and the 2to3 conversion tool works pretty well on the source by now, so there's a fair chance that Cython 0.12 will run on Py3. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] pyxser-0.2r --- Python XML Serialization

2009-04-18 Thread Stefan Behnel
Daniel Molina Wegener wrote: > * Every serilization is made into unicode objects. Hmm, does that mean that when I serialise, I get a unicode object back? What about the XML declaration? How can a user create well-formed XML from your output? Or is that not the intention? Stefan -- h

Re: [ANN] pyxser-0.2r --- Python XML Serialization

2009-04-19 Thread Stefan Behnel
Daniel Molina Wegener wrote: > Stefan Behnel > on Sunday 19 April 2009 02:25 > wrote in comp.lang.python: > > >> Daniel Molina Wegener wrote: >>> * Every serilization is made into unicode objects. >> Hmm, does that mean that when I serialise, I get

Re: PEP 401

2009-04-19 Thread Stefan Behnel
10-20 years before Python on Parrot reaches 2.7 feature completeness. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] pyxser-0.2r --- Python XML Serialization

2009-04-19 Thread Stefan Behnel
for a couple of cases, Python unicode strings are very inconvenient for serialised XML. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] pyxser-0.2r --- Python XML Serialization

2009-04-19 Thread Stefan Behnel
many string conversion under libxml2, the program gets more > slow performance by using a different encoding than the default encoding. It's not that much slower, though. http://codespeak.net/lxml/performance.html#parsing-and-serialising Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 401

2009-04-20 Thread Stefan Behnel
t aware of the tradition of "April >> Fools": >> >> http://en.wikipedia.org/wiki/April_fool >> >> Look at the date of the PEP and the status. > > Heck, just look at its number and mentally insert one slash or dash. My first thought was that the PEP number

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
nd will generally increase the performance of your binding, as it will require less calls for larger operations in C space. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: best "void" return of a member function

2009-04-20 Thread Stefan Behnel
Stefan Behnel wrote: > you might want to try to wrap it in a more Pythonic > look&feel style, that wraps operations and use-cases rather than plain > functions. That should make it easier to hide things like memory allocation > and other C implementation details from users, an

<    8   9   10   11   12   13   14   15   16   17   >