On Tue, Jan 3, 2012 at 7:28 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Sean Wolfe <ether....@gmail.com> writes: > >> Hello everybody, I'm a happy pythonista newly subscribed to the group. > > Welcome!
Thanks! and thanks to all, hjaha. > >> I have a theoretical / philosophical question regarding strong vs duck >> typing in Python. Let's say we wanted to type strongly in Python > > There may be an unstated assumption there, and your wording confuses me. > yep, probably. I am throwing around terminology a bit. Here's another attempt --> If I am willing to create some python code, when needed, where when I create a variable, let's say an integer, that it will be for all time an integer, and also that a method that returns say a Sprite custom object, and will for all time return only a Sprite object ... , does this get me significantly closer to being able to compile to C++? I am just thinking in my brain about the differences between cpp and python, and if there is a way to compromise a bit on the python-ness to get closer to cpp, but still be able to keep a lot of the goodness, then put in a translator or converter to cpp and gain performance by using cpp code. Sounds like Rpython, cython, shedskin are doing a lot or all of this, so lots to study up on. > > “Strongly-typed” is one end of a spectrum whose opposite end is > “weakly-typed”. Weakly-typed objects are in languages like e.g. PHP, > where an integer object can be added to a string object. Ah ok, I didn't realize this distinction. Now I grok it a bit better. > Python does not have variables in the sense of languages like C; rather, > Python has references bound to objects. A reference (e.g. a name, or a > list index, etc.) never has a type. An object always has a type. yeah I've been learning a lot about this ... at times I have to 're-create' a variable to avoid modifying the original value as well. For example, when I pass a 'screen' object in my game, at times I have to duplicate the screen in the new method, then work on the duplicate, otherwise I will be using the original screen by reference. > You may be thinking of “static typing” (identifiers have types, and > won't allow themselves to refer to an object of a different type), > versus “dynamic typing” (identifiers are ignorant of types – this is > what you have in Python). Yep I think so. Thanks for the info all! -- http://mail.python.org/mailman/listinfo/python-list