Re: Python Module: nift

2009-02-10 Thread r0g
J wrote: > Thanks for your answers, especially Chris Rebert and Paul McGuire's. I > have a question: > How far does Python go in the Game Development field? (Using Python > only, no extensions) Hey J, Python's all about the libraries (extensions), you won't be able to do much without them but th

Re: Python Module: nift

2009-02-09 Thread bearophileHUGS
Steven D'Aprano: > There's less code, fewer bugs and lines. Less applies to continuous > quantities, like weight and "amount of code", and fewer applies to > countable quantities. Thank you, I'll try to improve my use of the language. > Within reason, naturally. There's a reason why we write: >

Re: Python Module: nift

2009-02-08 Thread Steven D'Aprano
On Sun, 08 Feb 2009 13:34:50 -0800, bearophileHUGS wrote: > Gabriel Genellina: >> bearophile: >> > - Generally I suggest to learn to code in the small, using as little >> > code as possible. >> >> I completely agree with all the above suggestions, except this last >> one. Ok, I think I know what y

Re: Python Module: nift

2009-02-08 Thread Terry Reedy
J wrote: What are your thoughts on this module I created? ''' A Python Module created by a High School Student. Includes rev(), reet(), and leet(). Gutsy of you to post this. Setup: * Save to Python Directory\Lib\ as nift.py Add-in modules and package

Re: Python Module: nift

2009-02-08 Thread Paul McGuire
On Feb 8, 3:28 pm, Chris Rebert wrote: > This I disagree with as being unnecessarily clever; the dict literal > is just fine as-is and the zip() makes it less clear. However, I would > definitely rewrite the dict to use less lines, which, after removing > the capital dupes (as I mentioned in my po

Re: Python Module: nift

2009-02-08 Thread Chris Rebert
On Sun, Feb 8, 2009 at 2:45 PM, J wrote: > Thanks for your answers, especially Chris Rebert and Paul McGuire's. I > have a question: > How far does Python go in the Game Development field? (Using Python > only, no extensions) You pretty much need to integrate with some C(++) libraries in order to

Re: Python Module: nift

2009-02-08 Thread J
Thanks for your answers, especially Chris Rebert and Paul McGuire's. I have a question: How far does Python go in the Game Development field? (Using Python only, no extensions) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Module: nift

2009-02-08 Thread bearophileHUGS
Gabriel Genellina: > bearophile: > > - Generally I suggest to learn to code in the small, using as little > > code as possible. > > I completely agree with all the above suggestions, except this last one.   > Ok, I think I know what you mean, but a beginner might understand this   > completely wron

Re: Python Module: nift

2009-02-08 Thread Chris Rebert
On Sun, Feb 8, 2009 at 12:57 PM, Paul McGuire wrote: > On Feb 8, 12:42 pm, J wrote: >> What are your thoughts on this module I created? >> > Here are a few steps to illustrate some good basic Python idioms worth > learning: > > Step 1: Replace many-branched if-elif with dict > > While translating

Re: Python Module: nift

2009-02-08 Thread bearophileHUGS
Paul McGuire: > LEET_LETTERS = dict( zip("eEaAiItTsSoObB", "33441177550088") ) > def leet(s): >     return ''.join( LEET_LETTERS.get(c,c) for c in s ) This may be better: from string import maketrans def leet(txt): leet_chars = maketrans("eEaAiItTsSoObB", "33441177550088") return txt.tra

Re: Python Module: nift

2009-02-08 Thread Paul McGuire
On Feb 8, 12:42 pm, J wrote: > What are your thoughts on this module I created? > Here are a few steps to illustrate some good basic Python idioms worth learning: Step 1: Replace many-branched if-elif with dict While translating characters in a string is a special case that usually warrants usin

Re: Python Module: nift

2009-02-08 Thread Gabriel Genellina
En Sun, 08 Feb 2009 17:59:41 -0200, escribió: More suggestions for a real-world Python programmer: - There's code duplication, the original poster may express reet as a composition of the other functions. - A Python string/list/array can be inverted with [::-1] - I suggest to convert the exampl

Re: Python Module: nift

2009-02-08 Thread bearophileHUGS
More suggestions for a real-world Python programmer: - There's code duplication, the original poster may express reet as a composition of the other functions. - A Python string/list/array can be inverted with [::-1] - I suggest to convert the examples of the main doscstring into doctests. - The mai

Re: Python Module: nift

2009-02-08 Thread Chris Rebert
On Sun, Feb 8, 2009 at 10:42 AM, J wrote: > What are your thoughts on this module I created? * You should probably use individual docstrings for each function rather than one giant module docstring * Don't use 'list' as a variable name; it shadows the name of the builtin list type * You can use t

Python Module: nift

2009-02-08 Thread J
What are your thoughts on this module I created? ''' A Python Module created by a High School Student. Includes rev(), reet(), and leet(). Import nift Function: nift.rev() Description:Reverses a string Usage: nift.rev('string')