News for hackers. Stuff that matters.
Re:What are the drawbacks of Python? by masklinn on Saturday September 08, 2012 @04:32PM (#4493909)
You should avoid using those words, it merely marks you as somebody without a clue. I'm guessing your grandparent is already lost so there's no point in warning him.
Re:What are the drawbacks of Python? by prodigal_erik on Saturday September 08, 2012 @04:50PM (#4493950)
C and C++ are weakly typed because you can do things like

  int x = 42;
  printf("%c\n", *(char *) &x);
that is, access the underlying bits which represent a value as if they were of some completely different type. The results are deliberately not standardized and vary with your machine. Python doesn't provide any way to do this; at worst you get a TypeError for a conversion that isn't implemented, or AttributeError for a slot that an object doesn't have.

Implicitly parsing strings to produce numbers isn't weak typing, merely reckless and prone to mistakes. Weak typing can corrupt the state of your program so severely that even correct code begins to malfunction.

Re:What are the drawbacks of Python? by masklinn on Sunday September 09, 2012 @03:44AM (#4495248)
> C and C++ are weakly typed

This, in and of itself, means absolutely nothing. And neither does:

> Implicitly parsing strings to produce numbers isn't weak typing

There is no such thing as a widely accepted, let alone formal, definition for a strong/weak axis, every other guy out there has his own personal definition. What the bloody hell is the point of words for which no two persons share the same definition? No point. None at all. See comment above, it merely marks you as a guy without a clue.

Re:What are the drawbacks of Python? by gizmo686 on Saturday September 08, 2012 @10:42PM (#4494731)
But, python is strongly typed, it just isn't dynamically typed. For example, javascript is a weakly typed language, because things such as "a"+1, and Math.floor("a") are all valid; while they would result in a type error in python.

What makes python seem weakly typed to many people is its implicit variable shadowing. So when you do a="hello", a is a str, and can only be used where a str is expected. However, python lets you do: >a="hello" >a=1

at which point a is shadowed to an int.

Dynamic typing has some (not all) of the problems weak typing has, but they are not the same thing

Re:What are the drawbacks of Python? by masklinn on Sunday September 09, 2012 @03:42AM (#4495244)
> But, python is strongly typed

These words, they don't mean jack shit.

> Dynamic typing has some (not all) of the problems weak typing has, but they are not the same thing

Well of course they aren't, for starters "dynamic typing" actually means something.

Re:What are the drawbacks of Python? by gizmo686 on Sunday September 09, 2012 @11:10AM (#4495965)
"In a weakly typed language a compiler / interpreter will sometimes change the type of a variable. For example, in some languages (like JavaScript) you can add strings to numbers 'x' + 3 becomes 'x3'. This can be a problem because if you have made a mistake in your program, instead of raising an exception execution will continue but your variables now have wrong and unexpected values. In a strongly typed language (like Python) you can't perform operations inappropriate to the type of the object - attempting to add numbers to strings will fail. Problems like these are easier to diagnose because the exception is raised at the point where the error occurs rather than at some other, potentially far removed, place. In a statically typed language, the type of variables must be known (and usually declared) at the point at which it is used. Attempting to use it will be an error. In a dynamically typed language, objects still have a type, but it is determined at runtime. You are free to bind names (variables) to different objects with a different type. So long as you only perform operations valid for the type the interpreter doesn't care what type they actually are." [0]

It might help you to do research, ask clarifying questions, or explain why you think someone is wrong; instead of assuming that anyone saying something you disagree with has no idea what they are talking about.

[0]http://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic%...

Re:What are the drawbacks of Python? by masklinn on Sunday September 09, 2012 @04:55PM (#4496948)
> It might help you to do research

When it comes to that precise subject, I happen to have already done so and to know the count rather well. Stupidity is stupidity, even if it's on the python.org wiki.

> or explain why you think someone is wrong

I did so. Twice if not thrice. There is no well-defined and shared — let alone formal — semantics (and meaning) to the strong/weak "axis", every other person has his own pet definition of it[0] and the definitions are quite often incompatible if not downright opposed.

It is therefore garbage and utterly useless to communication.

> instead of assuming that anyone saying something you disagree with has no idea what they are talking about.

It's not "anyone saying something [I] disagree with", just "anyone using the strong/weak axis as if it actually existed".

[0] From "no memory corruption" to "no possible runtime error" through "no UB", "dynamically typed" and all sorts of takes on "no implicit conversions", usually in order to declare one's pet language is "strong" and somebody else's is "weak". I've seen all of C, C++, Python, Javascript, Perl, Java, Tcl, Lua, Smalltalk or Pascal declared both strong and weak by various (usually different) people.

Re:What are the drawbacks of Python? by abdulhaq on Sunday September 09, 2012 @01:30PM (#4496334)
I suggest you start to prefer learning from people instead of insulting them - you'll do much better in life. At least learn to either be polite or keep quiet.