Re: "Backward"-Iterator - Beginners question

2013-11-01 Thread patrick vrijlandt
Chris Angelico wrote: > On Fri, Nov 1, 2013 at 9:18 PM, Ulrich Goebel wrote: >> That gives me the solution. What I have, is an iterator object comming as a >> SQLite database cursor object. So I could minimize the underliying SELECT >> and build index = list(cursor). Then with Your hints I get wh

Re: "Backward"-Iterator - Beginners question

2013-11-01 Thread Chris Angelico
On Fri, Nov 1, 2013 at 9:18 PM, Ulrich Goebel wrote: > That gives me the solution. What I have, is an iterator object comming as a > SQLite database cursor object. So I could minimize the underliying SELECT > and build index = list(cursor). Then with Your hints I get what I want. Looks good! If y

Re: "Backward"-Iterator - Beginners question

2013-11-01 Thread Ulrich Goebel
Hi Am 31.10.2013 23:35, schrieb Terry Reedy: On 10/31/2013 5:29 PM, Ulrich Goebel wrote: I'm locking for an "iterator" type with not only the .next() method, but with a .previous(), .first() and .last() method, so that I can through it from the beginning or from the end, and in both directions

Re: "Backward"-Iterator - Beginners question

2013-10-31 Thread Dan Stromberg
On Thu, Oct 31, 2013 at 2:29 PM, Ulrich Goebel wrote: > Hallo, > > I'm locking for an "iterator" type with not only the .next() method, but > with a .previous(), .first() and .last() method, so that I can through it > from the beginning or from the end, and in both directions, even > alternately

Re: "Backward"-Iterator - Beginners question

2013-10-31 Thread Terry Reedy
On 10/31/2013 5:29 PM, Ulrich Goebel wrote: I'm locking for an "iterator" type with not only the .next() method, but with a .previous(), .first() and .last() method, so that I can through it from the beginning or from the end, and in both directions, even alternately (for example two steps forwa

Re: "Backward"-Iterator - Beginners question

2013-10-31 Thread Bernd Nawothnig
On 2013-10-31, Ulrich Goebel wrote: > I'm locking for an "iterator" type with not only the .next() method, but > with a .previous(), .first() and .last() method, so that I can through > it from the beginning or from the end, and in both directions, even > alternately (for example two steps forwa

"Backward"-Iterator - Beginners question

2013-10-31 Thread Ulrich Goebel
Hallo, I'm locking for an "iterator" type with not only the .next() method, but with a .previous(), .first() and .last() method, so that I can through it from the beginning or from the end, and in both directions, even alternately (for example two steps forward, one backward, two steps forwar

Re: Beginners question

2012-09-05 Thread Dave Angel
On 09/05/2012 04:03 AM, Mark Lawrence wrote: > On 05/09/2012 07:28, charvigro...@gmail.com wrote: >> Hi, >> >> I have attached python interview questions and answers for beginners. >> >> Please visit http://www.f2finterview.com/web/CorePython/ for core >> python and >> >> http://www.f2finterview.co

Re: Beginners question

2012-09-05 Thread Mark Lawrence
On 05/09/2012 07:28, charvigro...@gmail.com wrote: Hi, I have attached python interview questions and answers for beginners. Please visit http://www.f2finterview.com/web/CorePython/ for core python and http://www.f2finterview.com/web/PythonAdvanced/ for advanced python The first question f

Re: Beginners question

2012-09-04 Thread charvigroups
Hi, I have attached python interview questions and answers for beginners. Please visit http://www.f2finterview.com/web/CorePython/ for core python and http://www.f2finterview.com/web/PythonAdvanced/ for advanced python On Thursday, August 30, 2012 5:24:08 PM UTC+5:30, (unknown) wrote: > Hello

Re: Beginners question

2012-08-30 Thread Terry Reedy
On 8/30/2012 9:30 AM, Oscar Benjamin wrote: On Thu, 30 Aug 2012 09:23:03 -0400, Dave Angel wrote: I haven't discovered why sometimes the type output shows type instead of class. There are other ways of defining classes, however, and perhaps this is using one of them. Still, it is a class,

Re: Beginners question

2012-08-30 Thread Hans Mulder
On 30/08/12 14:49:54, Ulrich Eckhardt wrote: > Am 30.08.2012 13:54, schrieb boltar2003@boltar.world: > s = os.stat(".") > print s >> posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, >> st_nlink=2, st_u >> id=1000, st_gid=100, st_size=4096L, st_atime=1346327745, >> st_mtime=13

Re: Beginners question

2012-08-30 Thread Ulrich Eckhardt
Am 30.08.2012 15:27, schrieb Marco Nawijn: On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote: Am 30.08.2012 13:54, schrieb boltar2003@boltar.world: What sort of object is posix.stat_result? [...] I guess that this is a named tuple, which is a tuple where the attributes are

Re: Beginners question

2012-08-30 Thread Oscar Benjamin
On Thu, 30 Aug 2012 09:23:03 -0400, Dave Angel wrote: I haven't discovered why sometimes the type output shows type instead of class. There are other ways of defining classes, however, and perhaps this is using one of them. Still, it is a class, and stat() is returning an instance of that

Re: Beginners question

2012-08-30 Thread Marco Nawijn
On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote: > Am 30.08.2012 13:54, schrieb boltar2003@boltar.world: > > s = os.stat(".") > > print s > > > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, > > st_u > > > id=1000, st_gid=100, st_size

Re: Beginners question

2012-08-30 Thread boltar2003
On Thu, 30 Aug 2012 23:06:34 +1000 Chris Angelico wrote: >Yep, you're using Python 2. A few things are subtly different. Unless >you have good reason not to, do consider moving to Python 3; all sorts Noted. Thanks. B2003 -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginners question

2012-08-30 Thread Dave Angel
On 08/30/2012 08:50 AM, boltar2003@boltar.world wrote: > On Thu, 30 Aug 2012 13:14:57 +0100 > MRAB wrote: > > If its a class , why is it when I create my own class I get a completely > different output with print and type? > class foo(object): > .. def __init__(self): > .. pa

Re: Beginners question

2012-08-30 Thread Ulrich Eckhardt
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world: s = os.stat(".") print s posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, st_u id=1000, st_gid=100, st_size=4096L, st_atime=1346327745, st_mtime=1346327754, st _ctime=1346327754) What sort of object is posix.stat_r

Re: Beginners question

2012-08-30 Thread Chris Angelico
On Thu, Aug 30, 2012 at 10:50 PM, wrote: > On Thu, 30 Aug 2012 13:14:57 +0100 > MRAB wrote: >>What don't you ask Python? I'm sure you'' get something like this: >> >> >>> type(s) >> > > Umm , no I don't. > type(s) > > > Which isn't terrible helpful. That's actually the same thing, except

Re: Beginners question

2012-08-30 Thread boltar2003
On Thu, 30 Aug 2012 08:25:33 -0400 Dave Angel wrote: >You can get more documentation directly from s by simply typing >help(s) and/or help(os.stat) I didn't know about help(). Thanks! B2003 -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginners question

2012-08-30 Thread boltar2003
On Thu, 30 Aug 2012 13:14:57 +0100 MRAB wrote: >On 30/08/2012 12:54, boltar2003@boltar.world wrote: >> Hello >> >> I'm slowly teaching myself python so apologies if this is a dumb question. >> but something has confused me with the os.stat() function: >> > s = os.stat(".") > print s >> pos

Re: Beginners question

2012-08-30 Thread Chris Angelico
On Thu, Aug 30, 2012 at 9:54 PM, wrote: > What sort of object is posix.stat_result? Its not a dictionary or list or a > class object as far as I can tell. Thanks for any help. There's some cool things you can do here. (Note that I'm testing this on a Windows box, so it's marginally different.)

Re: Beginners question

2012-08-30 Thread Dave Angel
On 08/30/2012 07:54 AM, boltar2003@boltar.world wrote: > Hello > > I'm slowly teaching myself python so apologies if this is a dumb question. > but something has confused me with the os.stat() function: > s = os.stat(".") print s > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=

Re: Beginners question

2012-08-30 Thread Marco Nawijn
On Thursday, August 30, 2012 1:54:08 PM UTC+2, (unknown) wrote: > Hello > > > > I'm slowly teaching myself python so apologies if this is a dumb question. > > but something has confused me with the os.stat() function: > > > > >>> s = os.stat(".") > > >>> print s > > posix.stat_result(st_mo

Re: Beginners question

2012-08-30 Thread Roy Smith
In article , MRAB wrote: > What don't you ask Python? I'm sure you'' get something like this: > > >>> type(s) > BTW, this points out one of the really powerful aspects of Python. The combination of introspection and a handy interactive interpreter makes it easy to "just ask the computer".

Re: Beginners question

2012-08-30 Thread MRAB
On 30/08/2012 12:54, boltar2003@boltar.world wrote: Hello I'm slowly teaching myself python so apologies if this is a dumb question. but something has confused me with the os.stat() function: s = os.stat(".") print s posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2,

Beginners question

2012-08-30 Thread boltar2003
Hello I'm slowly teaching myself python so apologies if this is a dumb question. but something has confused me with the os.stat() function: >>> s = os.stat(".") >>> print s posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, st_u id=1000, st_gid=100, st_size=4096L, st_atim

Re: Beginners question

2009-07-18 Thread Rhodri James
On Sat, 18 Jul 2009 03:03:32 +0100, gabrielmonnerat wrote: Ronn Ross wrote: How do you define a global variable in a class. I tried this with do success: class ClassName: global_var = 1 def some_methos(): print global_var This doesn't work. What am I doing wrong? You ne

Re: Beginners question

2009-07-17 Thread Gabriel Genellina
En Fri, 17 Jul 2009 22:42:43 -0300, Ronn Ross escribió: How do you define a global variable in a class. I tried this with do success: class ClassName: global_var = 1 def some_method(self): print global_var This doesn't work. What am I doing wrong? [some typos fixed] In Pyth

Re: Beginners question

2009-07-17 Thread gabrielmonnerat
nohics nohics wrote: When defining your class methods, you /must/ explicitly list self as the first argument for each method, including __init__. When you call a method of an ancestor class from within your class, you /must/ include the self argument. But when you call your class method from o

Re: Beginners question

2009-07-17 Thread nohics nohics
When defining your class methods, you *must* explicitly list self as the first argument for each method, including __init__. When you call a method of an ancestor class from within your class, you *must* include the selfargument. But when you call your class method from outside, you do not specify

Re: Beginners question

2009-07-17 Thread Albert Hopkins
On Fri, 2009-07-17 at 21:42 -0400, Ronn Ross wrote: > How do you define a global variable in a class. I bit of a mix-up with words here. A variable can be a class variable or a global variable (wrt the module).. not both. > I tried this with do success: > class ClassName: > global_var = 1 >

Re: Beginners question

2009-07-17 Thread gabrielmonnerat
Ronn Ross wrote: How do you define a global variable in a class. I tried this with do success: class ClassName: global_var = 1 def some_methos(): print global_var This doesn't work. What am I doing wrong? You need pass "self" to the function and "global_var" needs be called

Beginners question

2009-07-17 Thread Ronn Ross
How do you define a global variable in a class. I tried this with do success: class ClassName: global_var = 1 def some_methos(): print global_var This doesn't work. What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list

Re: beginners question about return value of re.split

2008-03-24 Thread klaus
On Fri, 21 Mar 2008 13:34:27 -0700, John Machin wrote: > On Mar 22, 2:53 am, klaus <[EMAIL PROTECTED]> wrote: >> On Fri, 21 Mar 2008 10:31:20 -0500, Tim Chase wrote: >> >> <..> >> >> Ok thank you ! >> >> I think I got a bit lost in all the possibilities python has to offer. > > IMHO you g

Re: beginners question about return value of re.split

2008-03-21 Thread John Machin
On Mar 22, 2:53 am, klaus <[EMAIL PROTECTED]> wrote: > On Fri, 21 Mar 2008 10:31:20 -0500, Tim Chase wrote: > > <..> > > Ok thank you ! > > I think I got a bit lost in all the possibilities python has to offer. IMHO you got more than a bit lost. You seem to have stumbled on a possibly unin

Re: beginners question about return value of re.split

2008-03-21 Thread klaus
On Fri, 21 Mar 2008 10:31:20 -0500, Tim Chase wrote: <..> Ok thank you ! I think I got a bit lost in all the possibilities python has to offer. But your answers did the trick. Thank you all again for responding and elaborating. Cheers, KL. -- http://mail.python.org/mailman/listinfo

Re: beginners question about return value of re.split

2008-03-21 Thread Diez B. Roggisch
klaus schrieb: > Hello, > > I have a question regarding the return value of re.split() since I have > been unable to find any answers in the regular sources of documentation. > > Please consider the following: > > #!/usr/bin/env python > > import re > > if __name__ == "__main__": > datum

Re: beginners question about return value of re.split

2008-03-21 Thread Tim Chase
> datum = "2008-03-14" > the_date = re.split('^([0-9]{4})-([0-9]{2})-([0-9]{2})$', datum, 3) > print the_date > > Now the result that is printed is: > ['', '2008', '03', '14', ''] > > My question: what are the empty strings doing there in the beginning and > in the end ? Is this due

beginners question about return value of re.split

2008-03-21 Thread klaus
Hello, I have a question regarding the return value of re.split() since I have been unable to find any answers in the regular sources of documentation. Please consider the following: #!/usr/bin/env python import re if __name__ == "__main__": datum = "2008-03-14" the_date = re.split('^

Re: a beginner, beginners question

2008-03-19 Thread klaus
On Wed, 19 Mar 2008 05:57:04 -0500, Tim Chase wrote: >> class example: >> def __init__(self, foo, bar): >> self.foo = foo >> self.bar = bar >> >> def method(self): >> print "method ... :" >> print self.foo >> print self.bar >> >> if __name__ == "__

Re: a beginner, beginners question

2008-03-19 Thread John Machin
On Mar 19, 9:40 pm, klaus <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to learn python programming and so far so good. However when > trying to master the oop side I ran into a small problem. > > I think I've done everything ok as outlined below. But I just don't > understand why the `method'

Re: a beginner, beginners question

2008-03-19 Thread Tim Chase
> class example: > def __init__(self, foo, bar): > self.foo = foo > self.bar = bar > > def method(self): > print "method ... :" > print self.foo > print self.bar > > if __name__ == "__main__": > obj = example This makes "obj" a synonym for "e

a beginner, beginners question

2008-03-19 Thread klaus
Hello, I'm trying to learn python programming and so far so good. However when trying to master the oop side I ran into a small problem. I think I've done everything ok as outlined below. But I just don't understand why the `method' of `class' example isn't printing any of the variables that I

Re: Beginners question about debugging (import)

2008-01-22 Thread Diez B. Roggisch
Albert van der Horst schrieb: > I'm starting with Python. First with some interactive things, > working through the tutorial, > then with definitions in a file called sudoku.py. > Of course I make lots of mistakes, so I have to include that file > time and again. > > I discovered (the hard way) th

Beginners question about debugging (import)

2008-01-22 Thread Albert van der Horst
I'm starting with Python. First with some interactive things, working through the tutorial, then with definitions in a file called sudoku.py. Of course I make lots of mistakes, so I have to include that file time and again. I discovered (the hard way) that the second time you invoke from sudok

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread Stargaming
[EMAIL PROTECTED] wrote: > Thx > but is there any simpleir way, if using not class, but just struct (or > something like that, MATLAB equivalent for that one)? Use this:: >>> A = type('', (), {}) >>> a = A() >>> a <__main__. object at 0x009E8490> >>> a.foo = 42 >>> a.foo 42 But perhaps usin

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread openopt
Thx but is there any simpleir way, if using not class, but just struct (or something like that, MATLAB equivalent for that one)? I'm thinking of rewriting some optimization solvers (non-smooth, constrained, with (sub)gradients or patterns provided by user) to Python and I don't know currently is it

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Thx > but is there any simpleir way, if using not class, but just struct (or > something like that, MATLAB equivalent for that one)? > I'm thinking of rewriting some optimization solvers (non-smooth, > constrained, with (sub)gradients or patterns provided by user) to > P

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread openopt
Thx but is there any simpleir way, if using not class, but just struct (or something like that, MATLAB equivalent for that one)? I'm thinking of rewriting some optimization solvers (non-smooth, constrained, with (sub)gradients or patterns provided by user) to Python and I don't know currently is it

Re: (beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I have > class A: > def __init__(self, objFun, x0): > #(I want to have self.primal.f = objFun) > #both > self.primal.f = objFun > #and > self.primal = None > self.primal.f = objFun None is a singleton, so if Python were to

(beginners question) howto set self.field4.subfield8='asdf'?

2007-02-19 Thread openopt
I have class A: def __init__(self, objFun, x0): #(I want to have self.primal.f = objFun) #both self.primal.f = objFun #and self.primal = None self.primal.f = objFun yields error what should I do? Thx -- http://mail.python.org/mailman/listinfo/pytho

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Jeff Reavis wrote: > Spyce has support for pooling True, but as covered by this message: http://sourceforge.net/mailarchive/forum.php?thread_id=6381534&forum_id=10008, for my purpose, Spyce must run as proxy server. However, when running as proxy, it seems that I can't (really) run virtual hosts

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Damjan
> I'm satisfied with concept of mps, however It's fine that author hate > writing HTML, but I want to; or better, I want to use Cheetah Templates - > i think they are better for bigger sites (then homepage) as the one I want > to write. Also, check out simpletal (http://www.owlfish.com/software/si

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Dan Perl wrote: > Have you looked at these links? > http://www.python.org/pycon/papers/framework/web.html > Dan Thank You, I haven't found this one...exactly what I was looking for. -- Lukas "Almad" Linhart [:: http://www.almad.net/ ::] [:: The stars are constantly shining, but often we d

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Jeff Reavis
Spyce has support for Cheetah Templates: http://spyce.sourceforge.net/doc-mod_template.html as well as pooling: http://spyce.sourceforge.net/doc-mod_pool.html Spyce templates are converted into python before execution, and you can enable caching in the Spyce configuration file. Spyce also comes w

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Dan Perl
"Almad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I'm currently starting with Python as a language for writing websites. I > must say that I'm overwhelmed by the number of choices I have (mod_python > with publisher, Vampire, mps, Spyce), cgi, fcgi, Webware, Zope, >

Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Hello, I'm currently starting with Python as a language for writing websites. I must say that I'm overwhelmed by the number of choices I have (mod_python with publisher, Vampire, mps, Spyce), cgi, fcgi, Webware, Zope, Plone, ...). Isn't there any article in style "this suite use this style of p