News for hackers. Stuff that matters.
Re:Python Is Not Java by dnaquin on Wednesday February 25, 2009 @09:13PM (#495293)
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

Re:Python Is Not Java by dnaquin on Wednesday February 25, 2009 @09:27PM (#495312)

  jeff:disqus devin$ wc settings.py settings.xml
       1      15     142 settings.py
      16      19     461 settings.xml
      17      34     603 total
30% of the words. and, in my opinion, just as readable if not more.
Re:Python Is Not Java by fauigerzigerk on Thursday February 26, 2009 @06:36AM (#495759)
Or with a little less clutter :-)

  <backup>
    <dir name="/media/programming" exclude="log_files temp_files" />
    <dir name="/media/documents" exclude="archive" />
  </backup>
Re:Python Is Not Java by snprbob86 on Thursday February 26, 2009 @07:28AM (#495787)
i'd probably define some helper functions to check argument values and such:

  config = backup(
    directory('/media/programming', exclude=['log_files', 'temp_files']),
    directory('/media/documents', exclude='archive')
  )
Re:Python Is Not Java by pchivers on Wednesday February 25, 2009 @09:18PM (#495297)
Yeah, I've done that as well.

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

Re:Python Is Not Java by dnaquin on Wednesday February 25, 2009 @09:25PM (#495308)
well. it's mutable. your code can change it. don't do it (often). then you're just programming with lots of global state.