3

Question in title

Example code:

>>> j.type()
u'joint'
>>> type(j)
<class 'pymel.core.nodetypes.Joint'>
shfury
  • 389
  • 1
  • 5
  • 15

1 Answers1

2

Look at this simple example. You are trying to compare two different things - Joint class method type and python built-in function type - they have same names, that all:

class Joint():
    def type(self):
        return u'joint'

>>> j = Joint()
>>> j.type()
'joint'
>>> type(j)
<class '__main__.Joint'>
ndpu
  • 22,225
  • 6
  • 54
  • 69
  • @shfury u means unicode. What system and python version you are using? – ndpu Dec 04 '15 at 09:54
  • @shfury at first i tried to run this example in python2 actually, that because u is present in this line - `return u'joint'`. But when i realized that you are on python3 (by built-in `type` return value), i ran my code in python 3 and post results. I think you are using windows because on linux in python3 there is no u in front of printed string value(result of calling `j.type()` in my example), all strings in python 3 is unicode by default... – ndpu Dec 04 '15 at 10:23