Re: [Tutor] What made Python differ from other Languages?
An excellent recent article on hn(hacker news) on why python is important http://blaag.haard.se/Why-Python-is-important-for-you/ (via http://news.ycombinator.com/item?id=3579847 ) cheers ashish On Tue, Feb 21, 2012 at 1:13 AM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 20/02/2012 16:43, Sunil Tech wrote: *I am Beginner (very little i know), i want to know what are new things i can find in Python.* __**_ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor This sums up the Python philosophy. C:\Users\Mark\cpython\PCbuild**py -3.2 -c import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! -- Cheers. Mark Lawrence. __**_ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] roman to arabic
Walter Prins wpr...@gmail.com wrote: A quote worth mentioning here is: If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program. -- Linus Torvalds I've always wondered about this quote. I'm thinking it means you might want to have functions or subroutines, depending on the language, to do big chunks of logic, so the main control flow is clean and easy to read, like structured programming in COBOL. Still, every language offers almost unlimted indentation, so it's up to the programmer to not use it? Frank L. Cranky Frankie Palmeri Risible Riding Raconteur Writer “How you do anything is how you do everything.” - from Alabama Crimson Tide training room ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] new to programming and wondering about an IDE for Python on Linux
Hi All, I'm new to programming and wondering about an IDE for Python on Linux. I'd appreciate any feedback on this and good tutorials or books on Python 3 and the IDEs suggested. There are many available and I'm wondering what you as users find effective. Thanks, John___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] roman to arabic
On 27/02/12 14:41, Cranky Frankie wrote: A quote worth mentioning here is: If you need more than 3 levels of indentation, you're screwed I've always wondered about this quote. I'm thinking it means you might want to have functions or subroutines, depending on the language, to do big chunks of logic, That's one option. The OP also had the option of using a lookup table(dictionary) or just using elifs instead of nested ifs. Often a different algorithm helps. Also functional programming (ie. not just procedural!) can reduce the numbers of indentation levels. (See the FP topic in my tutor for some examples of this.) Simple hiding of indentation levels inside a function is kind of the last resort in reducing indentation levels. Generally deep indentation reveals problems in the basic algorithm and/or data structures. offers almost unlimited indentation, so it's up to the programmer to not use it? Correct, this is a program design decision not a language feature. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] roman to arabic
Hi, I wrote a little program that does the conversion (I won't post it because it would be a spoiler for the OP). The one thing I don't know, though, is how to formalise that it is not allowed to write something like X, but instead just II. Or not DM but simply D. The rule is to write it the shortest possible way. Am I wrong or is it really not trivial at all to write an error class for such lengthy roman numerals? Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ From: Alan Gauld alan.ga...@btinternet.com To: tutor@python.org Sent: Monday, February 27, 2012 4:37 PM Subject: Re: [Tutor] roman to arabic On 27/02/12 14:41, Cranky Frankie wrote: A quote worth mentioning here is: If you need more than 3 levels of indentation, you're screwed I've always wondered about this quote. I'm thinking it means you might want to have functions or subroutines, depending on the language, to do big chunks of logic, That's one option. The OP also had the option of using a lookup table(dictionary) or just using elifs instead of nested ifs. Often a different algorithm helps. Also functional programming (ie. not just procedural!) can reduce the numbers of indentation levels. (See the FP topic in my tutor for some examples of this.) Simple hiding of indentation levels inside a function is kind of the last resort in reducing indentation levels. Generally deep indentation reveals problems in the basic algorithm and/or data structures. offers almost unlimited indentation, so it's up to the programmer to not use it? Correct, this is a program design decision not a language feature. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] roman to arabic
On 27/02/12 16:28, Albert-Jan Roskam wrote: possible way. Am I wrong or is it really not trivial at all to write an error class for such lengthy roman numerals? Its non trivial, you need something like a state machine to detect valid transitions as you read each character. Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] roman to arabic
I wrote a little program that does the conversion (I won't post it because it would be a spoiler for the OP). The one thing I don't know, though, is how to formalise that it is not allowed to write something like X, but instead just II. Or not DM but simply D. The rule is to write it the shortest possible way. Am I wrong or is it really not trivial at all to write an error class for such lengthy roman numerals? Mark Pilgrim wrote whole sections on Roman numerals in his Dive Into Python tutorial. While the numerals pop up in various examples throughout the chapters of the tutorial, for this, the tutorial on unit testing may proof helpful: http://www.diveintopython.net/unit_testing/romantest.html Somewhere in that example, there's unit testing code just for examples as above. From the unit test, follow the tutorial into chapter 14 to see how it's done. Hope that helps, Evert Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ From: Alan Gauld alan.ga...@btinternet.com To: tutor@python.org Sent: Monday, February 27, 2012 4:37 PM Subject: Re: [Tutor] roman to arabic On 27/02/12 14:41, Cranky Frankie wrote: A quote worth mentioning here is: If you need more than 3 levels of indentation, you're screwed I've always wondered about this quote. I'm thinking it means you might want to have functions or subroutines, depending on the language, to do big chunks of logic, That's one option. The OP also had the option of using a lookup table(dictionary) or just using elifs instead of nested ifs. Often a different algorithm helps. Also functional programming (ie. not just procedural!) can reduce the numbers of indentation levels. (See the FP topic in my tutor for some examples of this.) Simple hiding of indentation levels inside a function is kind of the last resort in reducing indentation levels. Generally deep indentation reveals problems in the basic algorithm and/or data structures. offers almost unlimited indentation, so it's up to the programmer to not use it? Correct, this is a program design decision not a language feature. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] new to programming and wondering about an IDE for Python on Linux
On 27/02/12 15:22, John Jensen wrote: I'm new to programming and wondering about an IDE for Python on Linux. Linux is an IDE :-) But, smiley's aside it's true. You can use basic tools like vim, emacs and terminal windows etc. To cut n paste between them is trivial (Much more so than in Windows or MacOS). Tools like diff, grep and ctags enable cross file navigation between functions etc and are fully integrated with the common editors. Unix was built for software development by software developers. There is little that a modern IDE can do that Unix tools can't do almost as easily (tooltips is about the only thing I'm aware of!) And there's lots that Unix can do that most IDEs struggle with. I'd appreciate any feedback on this and good tutorials or books on Python 3 and the IDEs suggested. There are many available and I'm wondering what you as users find effective. But if you must have an IDE the usual suspects are available: Netbeans, Eclipse, Wing, SPE, and many others... ...and of course IDLE which comes with Python. Personally I go with vim, and 2 terminal windows. One running a prompt and one to execute the program for testing.-- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] roman to arabic
Ah, nice! Thank you! Sseeing the formal rules makes it easier: http://www.diveintopython.net/unit_testing/stage_5.html A regex is used to test whether the roman numeral is valid. Very elegant! Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ From: Evert Rol evert@gmail.com To: Albert-Jan Roskam fo...@yahoo.com Cc: Python Tutor tutor@python.org Sent: Monday, February 27, 2012 5:42 PM Subject: Re: [Tutor] roman to arabic I wrote a little program that does the conversion (I won't post it because it would be a spoiler for the OP). The one thing I don't know, though, is how to formalise that it is not allowed to write something like X, but instead just II. Or not DM but simply D. The rule is to write it the shortest possible way. Am I wrong or is it really not trivial at all to write an error class for such lengthy roman numerals? Mark Pilgrim wrote whole sections on Roman numerals in his Dive Into Python tutorial. While the numerals pop up in various examples throughout the chapters of the tutorial, for this, the tutorial on unit testing may proof helpful: http://www.diveintopython.net/unit_testing/romantest.html Somewhere in that example, there's unit testing code just for examples as above. From the unit test, follow the tutorial into chapter 14 to see how it's done. Hope that helps, Evert Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ From: Alan Gauld alan.ga...@btinternet.com To: tutor@python.org Sent: Monday, February 27, 2012 4:37 PM Subject: Re: [Tutor] roman to arabic On 27/02/12 14:41, Cranky Frankie wrote: A quote worth mentioning here is: If you need more than 3 levels of indentation, you're screwed I've always wondered about this quote. I'm thinking it means you might want to have functions or subroutines, depending on the language, to do big chunks of logic, That's one option. The OP also had the option of using a lookup table(dictionary) or just using elifs instead of nested ifs. Often a different algorithm helps. Also functional programming (ie. not just procedural!) can reduce the numbers of indentation levels. (See the FP topic in my tutor for some examples of this.) Simple hiding of indentation levels inside a function is kind of the last resort in reducing indentation levels. Generally deep indentation reveals problems in the basic algorithm and/or data structures. offers almost unlimited indentation, so it's up to the programmer to not use it? Correct, this is a program design decision not a language feature. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] new to programming and wondering about an IDE for Python on Linux
I'd appreciate any feedback on this and good tutorials or books on Python 3 and the IDEs suggested. There are many available and I'm wondering what you as users find effective. I fiddled a bit with the Eric Python IDE; Eric5 for Python3 and Eric4 for Python2; overall I'd say that Eclipse was a better experience, but Eric was by no means bad. I guess it comes down to user preferences. As for books, Dive Into Python 3 is one of the better books I've come across. http://eric-ide.python-projects.org/ -- best regards, Robert S. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor