Stéphane CARPENTIER <s…@fiat-linux.fr> writes:
> Richard Kettlewell <inva…@invalid.invalid> a écrit :
>> Stéphane CARPENTIER <s…@fiat-linux.fr> writes:
>>> Like, it's not a typed language but start playing with dictionaries >>> without declaring your variables first to see how the claims stand >>> before the facts.
>> >> Python is absolutely a typed language. Every object has a type and it >> won’t let you use objects in a manner incompatible with their type: >> >> >>> 0+"" >> Traceback (most recent call last): >> File "<python-input-0>", line 1, in <module> >> 0+"" >> ~^~~ >> TypeError: unsupported operand type(s) for +: 'int' and 'str'
> > In this case python is a strongly typed language and in other cases > it's not that important. > > With some typed languages, you can't use a variable if you didn't > declare it's type before. With python, you don't need to declare > integers and strings but you need to declare dictionaries. Why? Don't > know.
No special declaration is needed for dicts, you can just write out the dict you want. >>> d={'a': 1, 'b': 2} >>> type(d) <class 'dict'>
> With other programming languages I saw, either that works or that > doesn't, but I never saw something that stops working when it starts to > be more complex. It looks like it's a python specialty.
No, I think the issue here is pretty obviously the attempt to use a tool without learning how it works.