How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

Michael Torrie torriem at gmail.com
Wed Jan 27 00:07:39 EST 2021


On 1/26/21 8:37 PM, C W wrote:
> I have a naive question. How do I use traceback or trace the stack? In
> particular, I'm using VS Code with Python interactive console.

Show us the traceback here and we can help you interpret it.  Copy and
paste it from the VS Code console.

> Say, I want to print the value of employee['name']. Can I do it? 

Yes I would think so.

> My understanding is that these classes are just "skeletons". I must
> create an instance, assign values, then test?

Can't you just do something like this?

class NEODatabase:
    def __init__(self, id, created_at, name, attend_date, distance):
        self._id = id
        self.created_at = created_at
        self.name = name
        self.attend_date = attend_date
        self.distance = distance

    @classmethod
    def get_person(self, employee):
        print (employee['name'])

        return PERSONDatabase(employee['created_at'],
                              employee['id'],
                              employee['name'],
                              employee['attend_date'],
                              employee['distance'])



More information about the Python-list mailing list