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,

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

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

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

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