Re: problem with str()

2007-03-15 Thread Petr Prikryl
"Alex Martelli" wrote > Steve Holden wrote: >... > > >> Get yourself a stuffed bear, and next time you have this kind of problem > > >> spend a few minutes explaining to the bear exactly how your program > > >> can't possibly be wrong. Works like a charm. > > > > > > A rubber ducky works muc

Sorry (was Re: Cteni unicode retezcu ze souboru UTF-8 s BOM?)

2007-03-15 Thread Petr Prikryl
Sorry for the mess, The message should have been sent to the Czech Python mailing list. My fault. pepr "Petr Prikryl" wrote... > Ahoj všeci, > Tak nějak prakticky poprvé se dostávám k tomu, > jak přečíst unicode řetězce ze souboru, který > je uložen ve formátu UTF-8 se s

Q: Cteni unicode retezcu ze souboru UTF-8 s BOM?

2007-03-14 Thread Petr Prikryl
Ahoj všeci, Tak nějak prakticky poprvé se dostávám k tomu, jak přečíst unicode řetězce ze souboru, který je uložen ve formátu UTF-8 se signaturou na začátku (BOM). Nějak se mi nedaří. Mám takovýto soubor.txt v UTF-8 s BOM = První řádek. Druhý řádek. Třetí řáde

Python language extension mechanism for Python 3000... Worth for PEP?

2006-11-30 Thread Petr Prikryl
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules written using other languages. Extensions of Python could be done via special interpreter extensions. F

Re: [noob question] References and copying

2006-07-04 Thread Petr Prikryl
"zefciu" wrote in message news:[EMAIL PROTECTED] > Where can I find a good explanation when does an interpreter copy the > value, and when does it create the reference. I thought I understand > it, but I have just typed in following commands: > > >>> a=[[1,2],[3,4]] > >>> b=a[1] > >>> b=[5,6] > >>

Re: a question about "return"

2006-07-04 Thread Petr Prikryl
"yaru22" wrote in message news:[EMAIL PROTECTED] > In one of the examples in the book I'm reading, it says: > > def __init__(self): > ... > return > > It has nothing after "return". I expected it to have some number like 0 > or 1. What does it mean to have nothing after return? Yes, it ha

Re: A critic of Guido's blog on Python's lambda

2006-05-11 Thread Petr Prikryl
"Chris Uppal" wrote: > Petr Prikryl wrote: > > > for element in aCollection: > > if element > 0: > > return True > > return False > > [I'm not sure whether this is supposed to be an example of

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Petr Prikryl
"Chris Uppal" wrote... > Alex Martelli wrote: > > > I think it's reasonable to make a name a part of functions, classes and > > modules because they may often be involved in tracebacks (in case of > > uncaught errors): to me, it makes sense to let an error-diagnosing > > tracebacks display package

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Petr Prikryl
"Alex Martelli" wrote... > Joe Marshall wrote: >... > > If you language allows unnamed integers, unnamed strings, unnamed > > characters, unnamed arrays or aggregates, unnamed floats, unnamed > > expressions, unnamed statements, unnamed argument lists, etc. why > > *require* a name for trivia

Re: how to append to a list twice?

2006-04-24 Thread Petr Prikryl
"Fredrik Lundh" wrote: > Alex Martelli wrote: > > > > But of course that only does it once, and I don't want to have to copy > > > and paste the append line. Perhaps there's a better way than this. > > > > def makeseries(N): > > series = [N] > > append = series.append > > for tailer in xrang

Re: Confused by Python and nested scoping (2.4.3)

2006-04-20 Thread Petr Prikryl
I have added some spaces guessing how the original was formatted. See the simplified example and the explanation below... "Sean Givan" wrote... > Hi. I'm new to Python [...] something strange. > This code: > > def outer(): > val = 10 > def inner(): > print val > inner() > outer() > > ..pr

Re: BIOCHIP --->>> NO GOOD !!

2006-04-19 Thread Petr Prikryl
rainbow.cougar wrote in message > okay wrote: > > To Archbishop Christodoulos Paraskevaides of the Greek Orthodox Church > > in Athens and Greece Archbishop, > > I talked with a Greek Orthodox believer in Australia and he told me two > > I'm thinking a list comprehension... Possibly some filter(m

Re: difference between class and static methods?

2006-04-18 Thread Petr Prikryl
"John Salerno" wrote... [...] > So a class method is specifically for using the class name itself as an > object in the method? If that's the case, then it makes some sense now. > I guess the reason I didn't get it before is that this is a feature of > dynamic languages, right? And something that

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-12 Thread Petr Prikryl
"Aahz" wrote... > Bruno Desthuilliers wrote: > >Aahz a écrit : [...] > >>>Please repeat this 101 times each morning: > >>>"thou shall not use old-style classes for they are deprecated". > >> Classic classes are *NOT* deprecated. > >Perhaps not *officially* yet... > > Not even unofficially. The poi

python -U problem for 2.4.3c1 on Windows 2000 (was Does -U option really exist?)

2006-03-27 Thread Petr Prikryl
the hint. Martin v. Löwis wrote > Petr Prikryl wrote: > > Martin v. Löwis wrote > > > As for dropping the u prefix on string literals: > > > Just try the -U option of the interpreter some time, > > > which makes all string literals Unicode. If you manage > >

Does -U option really exist?

2006-03-10 Thread Petr Prikryl
"Martin v. Löwis" once (20 Sep 2005) wrote in reply to my question... Simpler transition to PEP 3000 "Unicode only strings"? > As for dropping the u prefix on string literals: > Just try the -U option of the interpreter some time, > which makes all string literals Unicode. If you manage > to

Any 3state Check Tree Ctrl for wxPython available?

2005-10-17 Thread Petr Prikryl
, is there something similar with 3 states available around? Thanks for your time and experience, pepr -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo/python-list

Re: What encoding is used when initializing sys.argv?

2005-10-05 Thread Petr Prikryl
Thanks, Martin v. Löwis, Neil Hodgson, and Tim Roberts. I really appreciate your valuable comments. It simply works. Thanks again, Petr "Neil Hodgson" wrote... > Petr Prikryl: > > > I do not understand what encoding should be used > > to convert the sys.ar

What encoding is used when initializing sys.argv?

2005-09-30 Thread Petr Prikryl
. Still, how the sys.argv is filled? What encoding is used when parsing the cmd line internally? To what encoding is it converted when non ASCII characters appear? Thanks for your time and experience, pepr -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo

Simpler transition to PEP 3000 "Unicode only strings"?

2005-09-20 Thread Petr Prikryl
in UTF-8 (or other recognised Unicode file format), then the encoding declaration must reflect the format or can be omitted entirely. In such case, all simple string literals will be treated as unicode string literals. Would this break any existing code? Thanks for your time and experience

Re: [OT] Good C++ book for a Python programmer

2005-01-20 Thread Petr Prikryl
Try also the Bruce Eckel's "Thinking in C++". It is also available on-line for free at http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html I like the book because it explains the things very clearly. After reading it, one will stop to think and say that C++ is "only C with strange OO things

Re: list item's position

2005-01-20 Thread Petr Prikryl
.pop(0) # get and remove the first element if 'bar' in bar and 'baz' in bar: bars.insert(0, bar) # insert the tested back break # and finish print bars The result is ['barbaz', 'foobar'] in both cases. Petr -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo/python-list

Bug in Python 2.4 raw_input(u'xyz') Win/command line?

2005-01-10 Thread Petr Prikryl
es. Could you confirm the bug? Is it known? Should this be posted into some bug-report list? Petr python test.py I have observed t -- Petr Prikryl (prikrylp at skil dot cz) test.py Description: test.py <>-- http://mail.python.org/mailman/listinfo/python-list

Replacing lambda() examples... (Re: Lambda going out of fashion)

2004-12-23 Thread Petr Prikryl
rary functions are anonymous > or not). > [...] I believe that GvR has a lot of experience and he proved to be very pragmatic. If he thinks that lambdas bring more problems than they solve, it may be some truth in it. I also believe that lamda-trained programmers think a bit differently

Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Petr Prikryl
i problem invisibility in Python. But I had to learn by mistake. The ++i behaviour is not intuitive for me. Your opinion? -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Petr Prikryl
you are already used to it. > > >>> i = 1 > >>> i +=1 > >>> i > 2 > > I like this one better, because you see the assignment at once, it is > easy to read and inuitive usability is given - in my opinion. > Chris > > > > > P