On 08/09/18 04:57, Chip Wachob wrote:

> was my attempt at 'setting' the type of the variable.  

A variable in Python is just a name. It has no type.
Only values have types. So you can set (or change)
the type of a value but not of a variable.

> Coming from a 'C' background, I find the lack of typing in Python to
> be confusing.  

There is no shortage of typing in Python its just
applied to the values(objects) not to their labels.

> I'm used to working with bytes / words signed and
> unsigned for a reason.

The same applies in Python. You just have to separate
the concepts of variable name and variable value.
In C those two concepts get kind of squished together
but in Python the name/value duality is strong.

You can always check the type of an object by using
the type() function or if you think a type error is
likely catch it when it happens with:

try:...
except TypeError:....


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to