Vbl.time() is the same as dt.datetime.time(vbl)


I’m having a bit of a hard time understanding classes, attributes and methods. I understand the theory but I’m stuck with the syntax, logic, etc.

Why is this:

tm = dt.datetime.time(vbl)

giving me the same output as this:

tm = vbl.time()



1 Like

Hey @joansch

Welcome to community :clap:t2:

Kindly post the link to the mission you are referring to. Also it would be better if you follow the Community Guidelines when asking a question.

Thanks for understanding


1 Like


The template provided didn’t apply in this case because I had no expectations :slight_smile: I just don’t understand the syntax! How is it that the first line is module.class.method(variable) and the second one is variable.class() , they yield the same thing?

Thanks a lot
Thanks a lot

1 Like

Sorry to say this. But your code is hard to understand and it is difficult to help you in this case. I can help if you can provide more details…


1 Like


appt_times = []

for appt in potus:
    vbl = appt[2]
    tm = dt.datetime.time(vbl)

yields the same output as this:

appt_times = []

for appt in potus:
    vbl = appt[2]
    tm = vbl.time()

Hope that’s clearer and thank you!

Hello @joansch,

dt.datetime.time is an instance method. According to the documentation, it will:

Return time object with same hour, minute, second, microsecond and fold.

Since vbl is a datetime object it has attributes:

Expand to see the vbl attributes


Check the datetime class attributes here

1 Like

Thank you, [info.victoromondi]

Stupid question - in the second line of code, how does the system know that vbl is a datetime object?


Everything in python is an object. To know an object belongs to which class use type() and thats how the system knows that vbl is a datetime object