Does the concept of "magic number" change from language to language?

Posted by Gerardo Marset on Stack Overflow See other posts from Stack Overflow or by Gerardo Marset
Published on 2011-03-16T00:05:35Z Indexed on 2011/03/16 0:09 UTC
Read the original article Hit count: 222

Filed under:
|
|
|
|

Take the following code in C/C++, for example:

int foo[] = {0, 0, 0, 0};

No magic numbers, right?
Now, the Python "equivalent" of that would be:

foo = [0, 0, 0, 0]

Still no magic numbers.
However, in Python, that same thing can be written like this:

foo = [0] * 4

And now we DO have a magic number. Or do we?
I'm guessing this and other similar things are present on these and other languages.

© Stack Overflow or respective owner

Related posts about c++

Related posts about python