Re: "return" in def

2008-12-28 Thread Manish Sinha

Roger wrote:

Hi Everyone,

First I want to thank everyone that posts to this group.  I read it
daily and always learn something new even if I never feel like I have
anything to contribute but my questions.
  
Same here, I always read the news, but hardly post anything since am not 
very much expert in Python.

Even when I'm not explicitly returning something I like to add
"return" because it's a good additional visual marker for me to see
where a method definition ends especially in cases where I may use a
nested method.
  
I would personally prefer to use a comment for return rather than giving 
an explicit return statement.

e.g.
# return from function

--
Manish Sinha

Personal Blog: http://www.manishsinha.info
Tech Blog: http://manishtech.wordpress.com
OpenPGP Key: 99E6658F

--
http://mail.python.org/mailman/listinfo/python-list


Re: deleting a method

2009-01-04 Thread Manish Sinha

Filip GruszczyƄski wrote:

I am trying to delete a method from a class. It's easy to delete other
attributes, but when I try:

  

class A:


... def foo():
... pass
...
  

a = A()
del a.foo



I get

Traceback (most recent call last):
  File "", line 1, in 
AttributeError: A instance has no attribute 'foo'

Why is it so and how may still delete it?

  

Sounds crazy

If you want to delete a function, create lambda functions though am not 
sure whether it can be deleted or not.


--
Manish Sinha

Personal Blog: http://www.manishsinha.info
Tech Blog: http://manishtech.wordpress.com
OpenPGP Key: 99E6658F

--
http://mail.python.org/mailman/listinfo/python-list