Python: repr vs backquote
问题 In python, is there a difference between repr and the backquote ` (left of 1)? For demonstration: class A(object): def __repr__(self): return 'repr A' def __str__(self): return 'str A' >>> a = A() >>> repr(a) #'repr A' >>> `a` #'repr A' >>> str(a) #'str A' Do the backquotes just call repr ? Is it simply for convenience? Is there any significant speed difference? Thanks! 回答1: They're an alias for repr . They have the exact same effect. However, they're deprecated and have been removed in