[Tutor] backreferences - \0

2010-06-06 Thread Payal
Hi, A newbie re query. >>> import re >>> s='one' >>> re.sub('(one)','only \\0',s) 'only \x00' >>> re.sub('(one)','only \0',s) 'only \x00' I expected the output t

Re: [Tutor] backreferences - \0

2010-06-06 Thread Payal
(two)', r'\1 - \2',s) 'one - two' In first sub I expected, one two - one two I understand that \1 is first (group), \2 the second and etc. But what is the entire regex? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] backreferences - \0

2010-06-06 Thread Payal
t;0> refers to the > entire group. Thanks a lot. It works as you say. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] a class query

2010-06-07 Thread Payal
Hi all, I know the difference between class Parent : class Parent(object) : But in some softwares i recall seeing, class Parent() : Is this legal syntax? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or

[Tutor] no. of references

2010-06-07 Thread Payal
Hi, If I have a list (or a dict), is there any way of knowing how many other variables are referencing the same object? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

Re: [Tutor] a class query

2010-06-07 Thread Payal
> > or > > class Name(): pass > > In Python 3.x, there are no old-style classes. Thanks, that clears my doubt. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] no. of references

2010-06-08 Thread Payal
Hi all, Excuse for TOFU. Thanks a lot Steven, Dave and Hugo. Steven the explanation was really great. Thanks a lot for it. Hugo, I was just curious, have no real need. Thanks. With warm regards, -Payal -- On Tue, Jun 08, 2010 at 08:07:28PM +1000, Steven D'Aprano wrote: > On Tue, 8 Jun

[Tutor] pickling/shelve classes

2010-06-16 Thread Payal
s(F) gives PicklingError: Can't pickle : it's not found as __main__.F What is my mistake? I want to pickle and shelve classes as well as instances. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscr

Re: [Tutor] pickling/shelve classes

2010-06-18 Thread Payal
On Thu, Jun 17, 2010 at 11:11:11AM +0200, Eike Welk wrote: > I think it is a bug in IPython: I can do this in regular Python, but in > IPython I get the same error that you get: > Thanks a lot. It works in normal python. Thanks again. With warm regard

[Tutor] how to shelve classes

2010-06-18 Thread Payal
in File "/usr/lib/python2.6/shelve.py", line 122, in __getitem__ value = Unpickler(f).load() AttributeError: 'module' object has no attribute 'F' How do I carry around my classes and instances? With warm regards, -Payal -- ___

Re: [Tutor] how to shelve classes

2010-06-18 Thread Payal
On Fri, Jun 18, 2010 at 03:16:36PM +0200, Eike Welk wrote: > See: > http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled Thanks for the link and the explanation. With warm regards, -Payal -- ___ Tutor maillist -

[Tutor] re.sub() query

2010-06-20 Thread Payal
Hi, Is it possible to solve the below, w/o making a re object? >>> a 'Mary Had a Little Lamb' >>> p=re.compile('l',re.I) >>> re.sub(p,'-',a) 'Mary Had a -itt-e -amb' I cannot figure

Re: [Tutor] Question

2010-06-20 Thread Payal
syntax of each is so different you are > less likely to get confused, but the underlying programming model is very > similar in each case. Hijacking the thread a bit. What about learning Jython and Python? Do I need to know Java to learn Jython?

Re: [Tutor] re.sub() query

2010-06-20 Thread Payal
a lot Evert. For records, >>> re.sub('l(?i)','-',a) 'Mary Had a -itt-e -amb' With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] class questions

2010-06-26 Thread Payal
a few times over, I fail to get utility of such a class. Can someone please explain with better example? Alan can you please cleanup that section, maybe make it broader and put the stuff about "SystemExit" elsewhere. Thanks a lot in advanc

Re: [Tutor] class questions

2010-06-26 Thread Payal
pass Can we say that our own exception classes have only maybe a doc-string and pass, nothing more? Thanks a lot again. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] class questions

2010-06-27 Thread Payal
says, bottom-top, left-right. So we expected D-B-A-C-A. Steven says in some cases even this simple logic of bottom-top, left-right search will not work. As he says, a simple example of it failing is diffclt to write, so meanwhile I will take his word for it. Thanks for the help. With warm

Re: [Tutor] class questions

2010-06-27 Thread Payal
Hi Steven, Thanks a lot for patiently explaining the concepts. I uderstood most of it. With warm regards, -Payal -- On Sun, Jun 27, 2010 at 10:09:38AM +1000, Steven D'Aprano wrote: > Probably not... it's quite complicated, which is why it's rare. I'll > have a thi

Re: [Tutor] class questions

2010-06-27 Thread Payal
Thanks a lot Eike for the code snippet. I got the idea now. With warm regards, -Payal -- On Sat, Jun 26, 2010 at 10:41:59PM +0200, Eike Welk wrote: > Hello Payal! > > On Saturday June 26 2010 19:05:16 Payal wrote: > > Can we say that our own exception classes have only may

[Tutor] capturing error msg in exception

2010-06-27 Thread Payal
of writing, except (NameError, ZeroDivisionError) as e: print 'Msg : ' , e c. What is the correct Python of writing, except as e: print 'Msg : ' , e# Capturing all exceptions Thanks a lot for the help in advance. With warm regards, -Payal -- p.s. I am always confused wher

[Tutor] statements vs. expression and types

2010-06-27 Thread Payal
tements? A simple example of both in Python will suffice. b. I read on web that Python has in new releases done "unifications of types and classes". I know what classes are, what are types in simple language. Again please excuse for simple questions and thanks a lot in advance. With

[Tutor] newbie to gui programming

2010-07-06 Thread Payal
lectronics enggs. so they do not expect real swell gui, but it should be bearable and more importantly easy for me to learn, cos' I have a day time job and I am doing this just as a help and eagerness to learn. Looking for advice. Thanks a

Re: [Tutor] newbie to gui programming

2010-07-08 Thread Payal
t), if it is easy to learn? (I liked fetchmailconf and I think it was done in tkinter). I get discouraged a bit fast, so I want the first toolset to be as easy as possible. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To u

Re: [Tutor] Having a return when subprocess.Popen finishes

2010-07-08 Thread Payal
0.1): icmp_seq=4 ttl=64 time=0.046 ms\n64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.049 ms\n\n--- localhost ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss, time 3997ms\nrtt min/avg/max/mdev = 0.044/0.047/0.052/0.006 ms\n', None) >>> hth, With w

Re: [Tutor] Request for help learning the right way to deal with listsin lists

2010-07-15 Thread Payal
('War & Peace", [3,56,88]), > Book("Huck Finn", [2,5,19]) ] Can someone please explain the above 2 lines? > for book in Books: > print book.title, book.pages With warm regards, -Payal -- ___ Tutor maillist

[Tutor] __new__ over __init__

2010-08-30 Thread Payal
Hi all, Can someone please give a very simple example of using __new__ wherein __init__ cannot be used? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

Re: [Tutor] __new__ over __init__

2010-09-01 Thread Payal
On Tue, Aug 31, 2010 at 08:27:10AM +0200, Peter Otten wrote: > Subclasses of immutable types, e. g. tuple: That was one great example, thanks. Some doubts, a. I have seen this cls before, what does it mean? b. What does type(_) mean? Thanks a lot in advance. With warm regards, -Pa

Re: [Tutor] __new__ over __init__

2010-09-02 Thread Payal
lot. With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] need help to learn threading

2011-08-28 Thread Payal
Hi all, Can someone suggest a resource for me to learn threading in python? I don't know threading in any other language. I tried a few online tutorials but got lost soon. How do I start? With warm regards, -Payal -- ___ Tutor maillist -

[Tutor] failing to learn python

2006-04-10 Thread Payal Rathod
months? With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] failing to learn python

2006-04-10 Thread Payal Rathod
illy problems like generate fibonnacci series, add numbers frm 0-n etc. non required silly stuff. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] failing to learn python

2006-04-11 Thread Payal Rathod
ueries I have. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] failing to learn python

2006-04-12 Thread Payal Rathod
quot;? The Python video said that one can take this language to good level in 1 afternoon, for me it has been 2 months and more. What is wrong? With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] functions in Python

2006-04-17 Thread Payal Rathod
t; for I do not understand the meaning of the same) With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] functions in Python

2006-04-17 Thread Payal Rathod
depending on > the function. Sorry but it is very confusing, couldn't get it at all. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] functions in Python

2006-04-17 Thread Payal Rathod
, but you have confused me more ;) Can you give an simple example of just function() ? Where can it be useful? And when you say it returns a value, what do you mean by that? return to whom and what exactly? With warm regards, -Payal ___ Tutor maill

Re: [Tutor] functions in Python

2006-04-17 Thread Payal Rathod
What is the difference between, >>> def f(x): ... return x ... >>> f(4) 4 >>> def f(x): ... print x ... >>> f(4) 4 Both give same results. So, why return statement is needed? With warm regards, -Payal

[Tutor] Alan Gauld Tutorial - OOP

2006-04-18 Thread Payal Rathod
only the |data attributes but the operations that are available too. What are exactly "data attributes" and what "operations" is he referring to? With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] functions in Python

2006-04-18 Thread Payal Rathod
ng on it in next few days. Thanks again. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Alan Gauld Tutorial - OOP

2006-04-18 Thread Payal Rathod
variable, and object and difference between them. Thanks again. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Alan Gauld Tutorial - OOP

2006-04-18 Thread Payal Rathod
an I don't want to learn Vbscript or Javascript, what do I do then, am I supposed to skip those parts? With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] wanted exercises in python

2006-04-18 Thread Payal Rathod
from advanced set, so please give me exercises based on those topics i.e. don't tell me to code a http client or a GUI based program in Python :) With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] need to automate connection

2006-04-24 Thread Payal Rathod
w do I start? With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] need to automate connection

2006-04-25 Thread Payal Rathod
On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote: > Hi Payal, > > I see you're connecting to an smtp server Any particular reason yoou > can't use smtplib? > http://www.python.org/doc/current/lib/module-smtplib.html Because I don't know it exists :) But

[Tutor] Alan Gauld's tut - namespaces

2006-04-26 Thread Payal Rathod
you use it as module? I haven't understood the explantaion. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] opening multiple connections to a port

2006-05-09 Thread Payal Rathod
, but unable to figure how to open multiple simeltaneous connections. With warm regards, -Payal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor