ruby instance variable in python

roro codeath rorocodeath at gmail.com
Mon Oct 6 06:06:33 EDT 2014


in ruby:

module M
def ins_var
@ins_var ||= nil
end

def m
@ins_var = 'val'
end

def m2
m
ins_var # => 'val'
end
end

in py:

# m.py

# how to def ins_var

def m:
    # how to set ins_var

def m2:
    m()
    # how to get ins var
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141006/1c22cbc1/attachment.html>


More information about the Python-list mailing list