Differences between revisions 1 and 2
Revision 1 as of 2006-02-02 07:08:14
Size: 521
Comment:
Revision 2 as of 2006-02-02 07:25:41
Size: 591
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
...  def __del__(self):
...   print "HI"
...     def __del__(self):
...         print "HI"
Line 23: Line 23:
>>> type(c)
<type 'instance'>
>>> c
<__main__.C instance at 0x402328cc>
Line 34: Line 30:

=== list append and assignment ===

{{{
#!python
>>> a=[1,2,3]
>>> print a
[1, 2, 3]
>>> a=a.append(4)
>>> print a
None
}}}

Note : This is an experimental page, Python can be learned interactively from a prompt, and learning by observations is a good habit, so this page. -- BaijuMuthukadan

(This page is not linked from main pages yet.)

__del__ workings

   1 >>> class C:
   2 ...     def __del__(self):
   3 ...         print "HI"
   4 ... 
   5 >>> c=C()
   6 >>> del(c)
   7 HI
   8 >>> c=C()
   9 >>> c=1
  10 HI
  11 >>> c
  12 1
  13 >>> c=C()
  14 >>> d=c
  15 >>> c=4
  16 >>> d=7
  17 >>> d
  18 HI
  19 7

list append and assignment

   1 >>> a=[1,2,3]
   2 >>> print a
   3 [1, 2, 3]
   4 >>> a=a.append(4)
   5 >>> print a
   6 None

LearnByObservation (last edited 2011-02-16 13:07:00 by BaijuMuthukadan)

Unable to edit the page? See the FrontPage for instructions.