Python 3 code question

Hi,
I got a Cozmo robot recently and I'm trying to write some code for it, it has a python API.

I am new to python and I'm first trying to understand the sample code they gave.
Here is one example:


-----------------
import cozmo
from cozmo.util import distance_mm, speed_mmps

def cozmo_program(robot: cozmo.robot.Robot):
  robot.drive_straight(distance_mm(150), speed_mmps(50)).wait_for_completed()

cozmo.run_program(cozmo_program)
------------------------
The line I am curious about is "cozmo_program(robot: cozmo.robot.Robot):"
So, it's a function call. But what is with the Colon ':' in the param?  " robot: cozmo.robot.Robot".  Does it mean that 'robot' is an instance of cozmo.robot.Robot?

In fact I'm also unclear what cozmo.robot.Robot means. Can someone break down that line and explain please?

Thanks!
Nacht
LVL 1
nachtmskAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
def function_name(attribute: attribute_type):
That is an annotation.

HTH,
Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dan CraciunIT ConsultantCommented:
The answer is correct.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.