Re: print string as raw string

2009-02-17 Thread Mirko Dziadzka
Mirko Dziadzka wrote: > Hi all > > I'm trying to find a way to output strings in the raw-string format, e.g. > > print_as_raw_string(r"\.") should output r"\." instead of "\\." Ok, lets make a better example: >>> re_list = {

Re: print string as raw string

2009-02-17 Thread Mirko Dziadzka
Diez B. Roggisch wrote: >> I'm trying to find a way to output strings in the raw-string format, e.g. >> >> print_as_raw_string(r"\.") should output r"\." instead of "\\." >> >> Is there a better way than writing your own print function? Some magic >> encoding? > > There is no need to do this. R

print string as raw string

2009-02-17 Thread Mirko Dziadzka
Hi all I'm trying to find a way to output strings in the raw-string format, e.g. print_as_raw_string(r"\.") should output r"\." instead of "\\." Is there a better way than writing your own print function? Some magic encoding? Mirko -- http://mail.python.org/mailman/listinfo/python-list

Threads, GIL and re.match() performance

2008-06-25 Thread Mirko Dziadzka
Hi all I understand that the C implementation of Python use a global interpreter lock to avoid problems, so doing CPU bound tasks in multiple threads will not result in better performance on multi-CPU systems. However, I assumed that calls to (thread safe) C Library functions release the global i

Re: metaclasses and performance

2007-06-21 Thread Mirko Dziadzka
Lenard Lindstrom <[EMAIL PROTECTED]> wrote: > I don't know if C asserts are active in release Python, but for > new-style classes one thing that happens during attribute lookup is that > an object's class is asserted to be an instance of type. Thank's for the explanation. My Linux distribution

metaclasses and performance

2007-06-19 Thread Mirko Dziadzka
Hi all I'm playing around with metaclasses and noticed, that there is small but mesurable a performance difference in the code shown below. With a more complex example I get a 5 percent performance penalty for using a metaclass. Until today I assumed, that a metaclass has no performance impact at