Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

""" 

Miscellaneous utilities 

""" 

  

def is_extension_type(cls): 

""" 

INPUT: 

  

- cls: a class 

  

Tests whether cls is an extension type (int, list, cython compiled classes, ...) 

  

EXAMPLES:: 

  

sage: from sage.structure.parent import is_extension_type 

sage: is_extension_type(int) 

True 

sage: is_extension_type(list) 

True 

sage: is_extension_type(ZZ.__class__) 

True 

sage: is_extension_type(QQ.__class__) 

False 

""" 

# Robert B claims that this should be robust 

try: 

return cls.__dictoffset__ == 0 

except AttributeError: 

pass 

return False