I found this question while i searched the usage of metaclass in python.It's a good question with a wonderful answer,See Here.But while i followed the example like this:
class UpperAttrMetaclass(type): 
    def __new__(cls, name, bases, dct):
        attrs = ((name, value) for name, value in dct.items() if not name.startswith('__'))
        uppercase_attr = dict((name.upper(), value) for name, value in attrs)
        return type.__new__(cls, name, bases, uppercase_attr)
class Foo(object):
    __metaclass__=UpperAttrMetaclass
    bar = 'bip'
Then:
print(hasattr(Foo,'bar'))
I was hoping it would output False,but instead it was True
It seems the metaclass didn't change anything at all.
I must have made a mistake.Glad if you can point it out to me!
EDIT: I was using IDLE 3.2,to make my situation more clear.
EDIT: Thanks for all the answers.And i found a good post on this.So i post it hereMetaclass in python 2&3
 
     
     
    