Skip to content

Instantly share code, notes, and snippets.

@fajran fajran/gist:814525
Created Feb 7, 2011

Embed
What would you like to do?
meta.py
class MetaProvinsi(type):
def __new__(cls, name, bases, attrs):
return type.__new__(cls, name, bases, attrs)
class Provinsi(object):
__metaclass__ = MetaProvinsi
class MetaKabupaten(type):
def __new__(cls, name, bases, attrs):
attrs['nama_kelas'] = name
return type.__new__(cls, name, bases, attrs)
class Kabupaten(object):
__metaclass__ = MetaKabupaten
# p = Provinsi()
# print p.nama_kelas
k = Kabupaten()
print k.nama_kelas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.