python philosophical question - strong vs duck typing
Hello everybody, I'm a happy pythonista newly subscribed to the group. How is it going? I have a theoretical / philosophical question regarding strong vs duck typing in Python. Let's say we wanted to type strongly in Python and were willing to compromise our code to the extent necessary, eg not changing variable types or casting or whatever. Let's say there was a methodology in Python to declare variable types. The question is, given this possibility, would this get us closer to being able to compile down to a language like C or C++? What I am driving at is, if we are coding in python but looking for more performance, what if we had an option to 1) restrict ourselves somewhat by using strong typing to 2) make it easy to compile or convert down to C++ and thereby gain more performance. It seems to be that accepting the restrictions of strong typing might be worth it in certain circumstances. Basically the option to use a strongly-typed Python as desired. Does this get us closer to being able to convert to Cpp? Does the Cython project have anything to do with this? Thanks! -- A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself. - Abraham Maslow -- http://mail.python.org/mailman/listinfo/python-list
Re: python philosophical question - strong vs duck typing
On Tue, Jan 3, 2012 at 7:28 PM, Ben Finney wrote: > Sean Wolfe 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
help me get excited about python 3
I am still living in the 2.x world because all the things I want to do right now in python are in 2 (django, pygame). But I want to be excited about the future of the language. I understand the concept of needing to break backwards compatibility. But it's not particularly exciting to think about. What are the cool new bits I should be reading up on? Related reading ... http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3 [Zaphod] Hey, Marvin! We've got a job for you. [Marvin] I won't enjoy it. [Zaphod] Yes, you will. There's a whole new life stretching out in front of you! [Marvin] Oh, not another one! [Zaphod] Shut up and listen! There'll be excitement and adventure and really wild things! [Marvin] Sounds awful. [Zaphod] But, Marvin ... [Marvin] I suppose you want me to help you to get into this spaceship ... [Zaphod] Marvin, will you just listen! [Marvin] ... and open the door for you. [Zaphod] What? Er ... Yeah. [Marvin] Well, I wish you'd just tell me, rather than try to engage my enthusiasm, because I haven't got one. -- A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself. - Abraham Maslow -- http://mail.python.org/mailman/listinfo/python-list
Re:
is anybody out there? On Sat, Jan 7, 2012 at 5:07 AM, abdullah zuberi wrote: > hello ? > -- > http://mail.python.org/mailman/listinfo/python-list > -- A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself. - Abraham Maslow -- http://mail.python.org/mailman/listinfo/python-list
Re:
On Sun, Jan 8, 2012 at 11:38 PM, David George wrote: > > Sean Wolfe wrote: >> >> is anybody out there? >> >> On Sat, Jan 7, 2012 at 5:07 AM, abdullah zuberi >> wrote: >>> >>> hello ? >>> > > Hello there Sean, How are you doing? > -- > http://mail.python.org/mailman/listinfo/python-list I'm freakin awesome. This reply all feature is a little high tech for me though, took me a few times to figure it out. That's done though so on to self sustaining nuclear fusion ... brb -- http://mail.python.org/mailman/listinfo/python-list
Re: An "alternative" to Learning Perl
On Sun, Jan 8, 2012 at 8:44 PM, Sebastian Rooks wrote: > Hello everyone, > > I was wondering if you could help me. I'm looking for a python > introductory book, kind of like Learning Python only smaller (?!) > The thing is, I travel to and from work each day for about 1,5h in each > direction, and do most of my reading on the train :\ > > (seriously) > > And I can't find one (just one) python book shorter than 500 pages that > is worth its weight in salt. > > Anyone know of any, any at all? > > All suggestions welcomed! > > -- Sebastian > -- kindle? ipad? tablet? also there is python programming for the absolute beginner, which is agreat book but it's pretty beginner. But well written. At least Iliked it.http://www.amazon.com/Python-Programming-Absolute-Beginner-3rd/dp/1435455002 Also byte of python ... I think there's a hardcover version you can buyhttp://www.swaroopch.com/buybook/ -- http://mail.python.org/mailman/listinfo/python-list
open office in another language?
I'm a somewhat-satisfied openoffice.org user. I mean it works, but if it weren't in Java I'd be doing some of my own tweaking. But since it's in Java I stay away... no likey. Has there been any talk of doing another similar office suite, or maybe just writer + spreadsheet, in a better language eg python? I expect it's a huge undertaking but ... thought I'd ask around at least. -- A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself. - Abraham Maslow -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
On Tue, Jan 10, 2012 at 6:53 PM, Nelle Varoquaux wrote: > Small nitpick: Openoffice.org (and LibreOffice) has in fact very little > java. The core of it is written in C++, so if you ever want to extend it > (unlikely), you won't be dealing with java code. > hmm I didn't know this, nice to know. Yes, C++ is still enough overhead that I wouldn't want to try extending it ... I bet the code is a whole lot to try and grok. It would be nice to have an office suite in a newer language that is easier to tinker with. -- http://mail.python.org/mailman/listinfo/python-list
Re: An "alternative" to Learning Perl
On Tue, Jan 10, 2012 at 8:25 PM, Sebastian Rooks wrote: > On Mon, 9 Jan 2012 00:55:22 -0300, Sean Wolfe > wrote: > >>kindle? ipad? tablet? > > I'm interested in books, not files ... > (seriously, now ... I don't have any of those devices) > >>also there is python programming for the absolute beginner, which is >>agreat book but it's pretty beginner. But well written. At least >>Iliked >>it.http://www.amazon.com/Python-Programming-Absolute-Beginner-3rd/dp/1435455002 >>Also byte of python ... I think there's a hardcover version you can >>buyhttp://www.swaroopch.com/buybook/ > > I think I saw that second one somewhere already. I'll check out the > first link, also. Thanks! > Yeah I hear you, I moved to Argentina from the US this year and my ipad + kindle app has been great. I can buy lots of books which I can't get down here and get access to them immediately, and I can carry a whole library in my backpack. So +1 if you are thinking about it. I like physical books as well but the portability factor is awesome. -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
On Wed, Jan 11, 2012 at 6:35 PM, Martin Manns wrote: > or in pyspread (GPL, my own effort) > > http://manns.github.com/pyspread/ > Checking this out now. Do you have text boxes? Cause maybe I will add some ... cool! -- http://mail.python.org/mailman/listinfo/python-list
Re: THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)
On Mon, Jan 16, 2012 at 4:01 AM, Steven D'Aprano wrote: > On Mon, 16 Jan 2012 09:03:54 +0300, _ wrote: > >> # THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: Worddr = "56" # CREATE >> A STRING: "56" Word = ["12"] # CREATE A LIST WITH ONE SIGNED: "12" Word >> = Word.append("34") > ... > > > Do you have a question, or are you just dumping a lot of noise in one > post? > > I think it's a secret code. I just watched Sherlock Holmes last night so I know all about that s**t. -- http://mail.python.org/mailman/listinfo/python-list