
Python Is Not Java - kqr2
http://dirtsimple.org/2004/12/python-is-not-java.html
======
samueladam
Since I've started using python, the language has had a big impact not only on
my code style but also the way I handle problems and find solutions.

The language really teaches you the Zen of python.

$ python

>>> import this

~~~
bobbyi
$ python -c "import this"

~~~
moe
#!/usr/bin/env python

from __future__ import braces

------
Zak
I've been noticing the time machine effect the article mentions using Clojure.
A couple weeks ago, I needed a GUI to update whenever an agent's value
changed, and it turned out that watchers had been added to the language only a
few days before.

I think the effect is what PG was talking about when he discussed the
difference between languages designed for the designer to use and languages
designed for other people.

------
pchivers
_XML is not the answer. It is not even the question._

I have a question for the Python hackers in the audience: what file format(s)
do you use for configuration files? I've been using INI style files up until
now, but I've been thinking of switching to XML for more complicated formats.
For example, what about something like the following example. What format
would you use to store this type of configuration data for a Python
application?

    
    
      <?xml version="1.0" encoding="utf-8" ?>
      <directoriesToBackUp>
      	<directoryInfo>
    		<directoryName>/media/programming</directoryName>
    		<excludedDirs>
    			<dir>/media/programming/log_files</dir>
    			<dir>/media/programming/temp_files</dir>
    		</excludedDirs>
    	</directoryInfo>
    	<directoryInfo>
    		<directoryName>/media/documents</directoryName>
    		<excludedDirs>
    			<dir>/media/documents/archive</dir>
    		</excludedDirs>
    	</directoryInfo>
      </directoriesToBackUp>

~~~
dnaquin
config.py:

    
    
      backup = [{
            'name': '/media/programming',
            'exclude': ['log_files', 'temp_files'],
        }, {
            'name': '/media/documents',
            'exclude': ['archive'],
        }]
    

of the top of my head.

*editted for formatting

~~~
pchivers
Yeah, I've done that as well.

Are there any security considerations to think about if using that approach?

~~~
dnaquin
well. it's mutable. your code can change it. don't do it (often). then you're
just programming with lots of global state.

------
alecco
Ancient flamebait.

~~~
vegai
So is python java now?

------
RWilson
Ideally we should use the right tool for the job, but sometimes time
constraints pressure us to try to use the tool we know best for any job, and
the next thing you know we're using a wrench to twist a nail into the wall. We
might get it in there, but it's ugly, crooked, and likely to fall apart with
little weight, and all because we didn't have, or didn't want to take, the
time to learn to use a hammer.

To be fair, one equally shouldn't try to program in Java with python on the
brain, it's going to turn out just as hideous and slow, and the developer will
probably be more furious at the number of recompilations caused because
approach the problem with the right mindset.

------
roberto
2004 is not 2009.

------
dpifke
This essay is referenced in the book _Dreaming in Code_ by Scott Rosenberg.

(As a relative newbie to Python who has in the past coded in a bunch of other
languages - including Java - I had actually been meaning to look it up.)

------
critic
PINJ? That's a good name for a language. Googlable too, unlike Arc :-)

------
jacquesm
Thank you captain obvious...

~~~
jacquesm
For those that like to join the downmod mob, I read the article and to expand
a bit on my one line statement, anybody that will try to shoehorn language
constructs from one language into another without first properly learning that
language is going to be making these exact mistakes.

It's patently obvious.

Languages are different for a reason, and if you wish to do meaningful work in
a language you would do well to familiarize yourself with the core constructs
of a language before embarking on a major project, especially if you have a
lot of expertise in some other language, because you may have to unlearn a few
things.

~~~
malkia
Now it's even

------
perezd
George Bush doesn't care about Python people.

