slicing return iter?

2009-10-17 Thread StarWing
hello everyone, I'm new here :-) sometimes I want to iterate a part of a sequence. but don't want to copy it. i.e. a = list(...) # now a is a list, and a[:] is another list, and so a[m:n] # now we do something with the 0~len(a)-3 elements of a for val in a[:-2]: #do something but, this w

Re: umlauts

2009-10-17 Thread StarWing
On 10月17日, 下午9时54分, Arian Kuschki wrote: > Hi all > > this has been bugging me for a long time and I do not seem to be able to > understand what to do. I always have problems when dealing input text that > contains umlauts. Consider the following: > > In [1]: import urllib > > In [2]: f = urllib.u

Re: umlauts

2009-10-17 Thread StarWing
On 10月18日, 上午12时14分, MRAB wrote: > Arian Kuschki wrote: > > Hi all > > > this has been bugging me for a long time and I do not seem to be able to > > understand what to do. I always have problems when dealing input text that > > contains umlauts. Consider the following: > > > In [1]: import urllib

Re: umlauts

2009-10-17 Thread StarWing
On 10月18日, 上午12时50分, "Diez B. Roggisch" wrote: > StarWing schrieb: > > > > > On 10月17日, 下午9时54分, Arian Kuschki > > wrote: > >> Hi all > > >> this has been bugging me for a long time and I do not seem to be able to > >> understand

Re: slicing return iter?

2009-10-17 Thread StarWing
On 10月17日, 下午11时56分, Arnaud Delobelle wrote: > On Oct 17, 3:40 pm, StarWing wrote: > > > > > hello everyone, I'm new here :-) > > > sometimes I want to iterate a part of a sequence. but don't want to > > copy it. i.e. > > > a = list(...) >

Re: slicing return iter?

2009-10-17 Thread StarWing
On 10月18日, 上午9时09分, Raymond Hettinger wrote: > [StarWing] > > > > > sometimes I want to iterate a part of a sequence. but don't want to > > > > copy it. i.e. > . . . > > I had checked it for serval times. maybe it's my inattention :-

Re: list to tuple and vice versa

2009-10-17 Thread StarWing
On 10月18日, 下午12时19分, Ben Finney wrote: > Jabba Laci writes: > > Right, it was my bad. After removal the tuple() function works > > perfectly. > > Note that, though it is callable, ‘tuple’ is not a function but a type: > >     >>> tuple >     >     >>> len >     > > You can use the built-in ‘typ

a gap of do....while?

2009-10-17 Thread StarWing
okay, I think somethings dowhile is useful, but why python didn't have it? in lisp, we can (while (progn )) and in all other language we have do...while. but in python, we only can: cond = 1 while cond: cond = 0 . if : cond = 1 has any polite way to handle this? -- ht

Re: a gap of do....while?

2009-10-17 Thread StarWing
On 10月18日, 下午1时36分, Chris Rebert wrote: > On Sat, Oct 17, 2009 at 10:34 PM, Chris Rebert wrote: > > On Sat, Oct 17, 2009 at 10:22 PM, StarWing wrote: > > >> but in python, we only can: > >> cond = 1 > >> while cond: > >>    cond = 0 > >>

Re: list to tuple and vice versa

2009-10-17 Thread StarWing
On 10月18日, 下午1时32分, Ben Finney wrote: > StarWing writes: > > On 10月18日, 下午12时19分, Ben Finney wrote: > > > Jabba Laci writes: > > > > Right, it was my bad. After removal the tuple() function works > > > > perfectly. > > > > Note that,

How to check the exists of a name?

2009-10-17 Thread StarWing
Sometimes I want to make a simple flags. and i need to check there is a name in current scope or not (that is, we can visit this name, no matter where is it). and how to do that in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check the exists of a name?

2009-10-17 Thread StarWing
On 10月18日, 下午2时37分, Chris Rebert wrote: > On Sat, Oct 17, 2009 at 11:30 PM, StarWing wrote: > > Sometimes I want to make a simple flags. and i need to check there is > > a name in current scope or not (that is, we can visit this name, no > > matter where is it). and how

Re: strange behaviour of colon within string

2009-10-19 Thread StarWing
On Oct 19, 9:15 pm, khany wrote: > On 19 Oct, 13:44, khany wrote: > > > hello all, > > > i am relatively new to python and i am trying to convert a php app i > > have over to it using googleapps. > > > anyway here is the problem. i poll ebay API which has in its XML " > xml version="1.0" encoding