introspection Flashcards

1
Q

function that return class of an object

A

type()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

function that return class of an object

A

type()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

attribute of an object that contains class

A

__class__

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

a.__class__.__class__

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

attribute of an object that contains class

A

__class__

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

a.__class__.__class__

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

function that returns a list of attributes

A

dir(object)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

get attribute using function

A

getattr(object, attribute_name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

if attribute exists

A

hasattr(object, attribute_name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

dictionary of global variables

A

globals()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

dictionary of local variables

A

locals()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

python library for introspection

A

inspect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly