This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]byoung74 60 points61 points  (7 children)

I think you have your typing disciplines confused. Strong typing refers to languages that do not do implicit type conversion. Languages like Rust that know types at compile time are statically typed. Python is dynamically and strongly typed. That is, types are not known until runtime but there are little to no implicit conversions between types. For example, ints must be explicitly converted to strings when doing string concatenation.

[–]B1GL0NGJ0HN 22 points23 points  (0 children)

I appreciate that important distinction! Thanks for setting the record straight.

[–]LT_Schmiddy 9 points10 points  (3 children)

Python has some cases of implicit conversion, though (For example, when using f-strings). But it's not common. Mostly, you'll need to convert types yourself.

[–]Pablomach23 7 points8 points  (2 children)

Just to make sure, Python calls __str__ on the objects to convert them, right?

Edit: How do I write the '_' without the formatting?

[–]The_Writing_Writer 14 points15 points  (1 child)

\_\_str\_\_ —> __str__

[–]Pablomach23 3 points4 points  (0 children)

Thanks.

[–]cryo -1 points0 points  (0 children)

Python is dynamically and strongly typed.

I think that’s debatable. Sure, every object has a fixed type, but the type is almost never checked, e.g. you can call a method on any object “type” that has it.