+1

Objects in python

What does it mean to “reference an object”? I was trying to create a code where it uses a function from a different class. I was told i have to reference an object before adding the function. What does this mean? Thanks

10/2/2019 12:08:03 PM

Luna

3 Answers

New Answer

+4

Functions in classes are called methods, and they're supposed to be only accessible via the class and its instances. Take a simple Python list for example. a_list = [1, 3, 2] a_list.sort() If you print out that list later, it will be sorted. But sort belongs to lists, so you always have to call it *with* a specific list (an object/instance) as you just saw here.

+4

Luna, may be you can post or link your code here so that we can have a clear picture from what happens.

0

my question links to this problem :) https://www.sololearn.com/discuss/2023682/?ref=app