On 5/24/21 7:34 AM, hw wrote: > Perhaps you can't see how both examples are different because you're > looking at things from a python perspective.
Sorry but they aren't all that different. In both cases you're shadowing printf. The difference is that C is a statically-typed, compiled language, so the compiler complains that an int is not callable, whereas Python is a dynamic language so lookups are done at run time, not compile time. I don't know your background, but it sounds like you've not had a lot of experience with dynamic languages. Certainly you have never used a language like Scheme or LISP! Or Smalltalk! What is your purpose here? Why are you learning Python when it's apparently that you have very little desire to understand the hows and whys of Python and its idioms and paradigms, and to find its strengths. You've encountered some things that to you are unexpected. That happens when learning any language. Unfortunately from time to time we see someone come to the list apparently trying to do battle with the language; rather than learn how to work with the language they try to twist python to their preconceived notions of what a proper language should be, whether that's by getting hung up on a specific criticism of the grammar, or by trying to program Python in another language (often Java). Such encounters always lead to frustration and such posters most often walkaway disillusioned and even bitter. It's a bit of an odd thing to watch, and always sad because the outcome simply hinges on the attitude of the person learning the language. Someone that works with the language finds it's a very expressive and powerful tool. Given your posts thus far, hw, I don't think Python is a good fit for you. You're better off learning a language that more closely aligns with the statically-typed languages you already know. -- https://mail.python.org/mailman/listinfo/python-list