unicode in multi-line strings

2008-09-18 Thread Jiri Barton
Hello, I have a problem with international characters in multi-line strings. Works: '''á''' Works: ''' a''' Does not work: ''' á''' By does not work I mean the infamous 'ascii' codec can't encode character u'\xe1' in position 4: ordinal not in range(128) I'm using Ubuntu 8.04 with Pytho

Re: Why is this?

2005-08-10 Thread Jiri Barton
Yes, now it is clear! As always, I should have RTFM, the operator* is not just a syntactic sugar and thus does not make copies. You know, my actual scenario was with four variables at the time: a, b, c, d = [], [], [], [] so I was even more tempted to use the previous and wrong approach:-) Than

Why is this?

2005-08-10 Thread Jiri Barton
Hi everyone, I have a problem with initialization. >>> a, b = [[]]*2 >>> a.append(1) >>> b [1] Why is this? Why does not this behave like the below: >>> a, b = [[], []] >>> a.append(1) >>> b [] And, just to add to my confusion: >>> [[]]*2 [[], []] >>> [[], []] == [[]]*2 True Thanks in advance

Distributing closed source modules

2005-03-24 Thread Jiri Barton
Hi, I'd like to be able to distribute some python modules of my system (plugins) without the source. So far, I have done this by including only the *.pyc files. However, I have recently found they are platform dependent and python version dependent. This approach has been very convenient because

Re: escape single and double quotes

2005-03-24 Thread Jiri Barton
Hey there, str.replace('"', '\\"').replace("'", "\\'") HTH, jbar -- http://mail.python.org/mailman/listinfo/python-list