From rod.favola at pra.com.au Fri Feb 8 01:28:55 2013 From: rod.favola at pra.com.au (Rod Favola) Date: Fri, 8 Feb 2013 00:28:55 +0000 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project Message-ID: Hi All, How are you? Firstly, who likes brain teasers? 1. Johnny's mother had three children. The first child was named April. The second child was named May. What was the third child's name? 2. A clerk at a butcher shop stands five feet ten inches tall and wears size 13 sneakers. What does he weigh? 3. Before Mt. Everest was discovered, what was the highest mountain in the world? 4. How much dirt is there in a hole that measures two feet by three feet by four feet? 5. What word in the English language is always spelled incorrectly? 6. Billie was born on December 28th, yet her birthday always falls in the summer. How is this possible? 7. In British Columbia you cannot take a picture of a man with a wooden leg. Why not? 8. If you were running a race and you passed the person in 2nd place, what place would you be in now? 9. Which is correct to say, "The yolk of the egg is white" or "The yolk of the egg are white?" 10. A farmer has five haystacks in one field and four haystacks in another. How many haystacks would he have if he combined them all in one field? Secondly, and more to the point, who's interested in a new Python job?! In a nutshell: The role is a Senior Python Developer based at Head Office close to Melbourne CBD. It's a permanent or contract position paying in the vicinity yet not restricted to $90,000 + Super or a negotiable daily rate. The start date is as soon as possible and interviews are about to begin. See more: http://www.seek.com.au/Job/senior-python-django-developer-brand-new-project/in/melbourne-cbd-inner-suburbs/23961526 To apply right now, send your latest CV to Rod Favola at rod.favola at pra.com.au addressing your availability, salary expectations and if available, a link to your portfolio. To discuss, call Rod on 03 8637 3337. :) Best regards, Rod Favola Associate Consultant :: PRA Level 13, 356 Collins Street, Melbourne VIC 3000 P 03 8637 3337 :: M 0433 347 826 E rod.favola at pra.com.au Sydney :: Melbourne :: Brisbane :: Perth CONNECT WITH ME AND MY TEAM [cid:image001.jpg at 01CC7D11.BD637670] [cid:image003.png at 01CC7D11.BD637670] [cid:image004.png at 01CC7D11.BD637670] [cid:image005.png at 01CC7D11.BD637670] Click here to see our Terms of Business Click here for our email disclaimer -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 2569 bytes Desc: image001.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 2020 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 1788 bytes Desc: image003.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 4396 bytes Desc: image004.png URL: From tobias.sargeant at gmail.com Fri Feb 8 01:54:11 2013 From: tobias.sargeant at gmail.com (Tobias Sargeant) Date: Fri, 8 Feb 2013 11:54:11 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: References: Message-ID: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> On 08/02/2013, at 11:28 AM, Rod Favola wrote: > 1. Johnny?s mother had three children. The first child was named April. The second child was named May. What was the third child?s name? Johnny > 2. A clerk at a butcher shop stands five feet ten inches tall and wears size 13 sneakers. What does he weigh? Meat > 3. Before Mt. Everest was discovered, what was the highest mountain in the world? Mt. Everest > 4. How much dirt is there in a hole that measures two feet by three feet by four feet? None > 5. What word in the English language is always spelled incorrectly? Incorrectly. > 6. Billie was born on December 28th, yet her birthday always falls in the summer. How is this possible? Simplest answer is she's never left the southern hemisphere. > 7. In British Columbia you cannot take a picture of a man with a wooden leg. Why not? You can't take pictures with wooden legs. > 8. If you were running a race and you passed the person in 2nd place, what place would you be in now? 2nd. > 9. Which is correct to say, ?The yolk of the egg is white? or ?The yolk of the egg are white?? Neither. It's yellow. > 10. A farmer has five haystacks in one field and four haystacks in another. How many haystacks would he have if he combined them all in one field? One. From anthony.briggs at gmail.com Fri Feb 8 03:12:16 2013 From: anthony.briggs at gmail.com (Anthony Briggs) Date: Fri, 8 Feb 2013 13:12:16 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> Message-ID: None of which is relevant to being a programmer... On 8 February 2013 11:54, Tobias Sargeant wrote: > > On 08/02/2013, at 11:28 AM, Rod Favola wrote: > > > 1. Johnny?s mother had three children. The first child was named April. > The second child was named May. What was the third child?s name? > > Johnny > > > 2. A clerk at a butcher shop stands five feet ten inches tall and wears > size 13 sneakers. What does he weigh? > > Meat > > > 3. Before Mt. Everest was discovered, what was the highest mountain in > the world? > > Mt. Everest > > > 4. How much dirt is there in a hole that measures two feet by three feet > by four feet? > > None > > > 5. What word in the English language is always spelled incorrectly? > > Incorrectly. > > > 6. Billie was born on December 28th, yet her birthday always falls in > the summer. How is this possible? > > Simplest answer is she's never left the southern hemisphere. > > > 7. In British Columbia you cannot take a picture of a man with a wooden > leg. Why not? > > You can't take pictures with wooden legs. > > > 8. If you were running a race and you passed the person in 2nd place, > what place would you be in now? > > 2nd. > > > 9. Which is correct to say, ?The yolk of the egg is white? or ?The yolk > of the egg are white?? > > Neither. It's yellow. > > > 10. A farmer has five haystacks in one field and four haystacks in > another. How many haystacks would he have if he combined them all in one > field? > > One. > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > -------------- next part -------------- An HTML attachment was scrubbed... URL: From javier at candeira.com Fri Feb 8 03:19:11 2013 From: javier at candeira.com (Javier Candeira) Date: Fri, 8 Feb 2013 13:19:11 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> Message-ID: On Fri, Feb 8, 2013 at 1:12 PM, Anthony Briggs wrote: > None of which is relevant to being a programmer... I think it was a joke. Or at least I *hope* it was. J From sam at nipl.net Fri Feb 8 03:53:52 2013 From: sam at nipl.net (Sam Watkins) Date: Fri, 8 Feb 2013 13:53:52 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> Message-ID: <20130208025352.GK1680@opal.nipl.net> Bilbo wouldn't have escaped from Gollum if he'd used those brain teasers. :) I wouldn't mind a Python job. What is the company? I'm guessing it's not pra.com.au. From tobias.sargeant at gmail.com Fri Feb 8 04:13:41 2013 From: tobias.sargeant at gmail.com (Tobias Sargeant) Date: Fri, 8 Feb 2013 14:13:41 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> Message-ID: To be clear, I wasn't expecting, or wanting, any job-follow-up based upon that. It was part boredom, and part short circuiting something that I (also) found incongruous about the job posting. From gcross at fastmail.fm Fri Feb 8 04:19:57 2013 From: gcross at fastmail.fm (Graeme Cross) Date: Fri, 8 Feb 2013 14:19:57 +1100 Subject: [melbourne-pug] Announcements: no February meeting (Berners-Lee!), January meeting on 28 Jan In-Reply-To: <06CC948EEFB1411DBEE4DEF182140C40@pythoncharmers.com> References: <06CC948EEFB1411DBEE4DEF182140C40@pythoncharmers.com> Message-ID: On 07/01/2013, at 3:08 PM, Ed Schofield wrote: > And there's no rule that says we can't have more than one meeting per month -- so a February meetup (e.g. 11th Feb) would be a good idea too ... that way there's not so long to wait until the next one (4 March). > Hi all. I missed the last meeting. What was the final decision on February: is there a meeting on Monday (Feb 11)? Regards, Graeme From sam at nipl.net Fri Feb 8 04:22:26 2013 From: sam at nipl.net (Sam Watkins) Date: Fri, 8 Feb 2013 14:22:26 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: <20130208025352.GK1680@opal.nipl.net> References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> <20130208025352.GK1680@opal.nipl.net> Message-ID: <20130208032226.GN1680@opal.nipl.net> On Fri, Feb 08, 2013 at 01:53:52PM +1100, Sam Watkins wrote: > Bilbo wouldn't have escaped from Gollum if he'd used those brain teasers. :) On the other hand, I wouldn't get a job if I had to answer Bilbo or Gollum -class riddles! From sam at nipl.net Fri Feb 8 04:24:16 2013 From: sam at nipl.net (Sam Watkins) Date: Fri, 8 Feb 2013 14:24:16 +1100 Subject: [melbourne-pug] [job] Senior Python/Django Developer | Brand New Project In-Reply-To: <20130208025352.GK1680@opal.nipl.net> References: <50B40485-88B1-4030-B1C3-605E043A1BF5@gmail.com> <20130208025352.GK1680@opal.nipl.net> Message-ID: <20130208032416.GO1680@opal.nipl.net> and egg yolks can be (almost) white... more white than yellow, anyhow http://glutenfreecookingschool.com/wordpress/wp-content/uploads/2007/08/beaten-egg-yolks-pale-yellow-color.JPG From ed at pythoncharmers.com Fri Feb 8 04:28:29 2013 From: ed at pythoncharmers.com (Ed Schofield) Date: Fri, 8 Feb 2013 14:28:29 +1100 Subject: [melbourne-pug] Announcements: no February meeting (Berners-Lee!), January meeting on 28 Jan In-Reply-To: References: <06CC948EEFB1411DBEE4DEF182140C40@pythoncharmers.com> Message-ID: <4735B8E6-73A1-4B19-954A-43E4AF1E7506@pythoncharmers.com> On 08/02/2013, at 2:19 PM, Graeme Cross wrote: > On 07/01/2013, at 3:08 PM, Ed Schofield wrote: > >> And there's no rule that says we can't have more than one meeting per month -- so a February meetup (e.g. 11th Feb) would be a good idea too ... that way there's not so long to wait until the next one (4 March). >> > > Hi all. > > I missed the last meeting. What was the final decision on February: is there a meeting on Monday (Feb 11)? Hi Graeme, At this stage, no. I think Inspire9 is hosting another event that night... Cheers, Ed -- Dr. Edward Schofield Python Charmers +61 (0)405 676 229 http://pythoncharmers.com From brian at microcomaustralia.com.au Fri Feb 15 03:13:04 2013 From: brian at microcomaustralia.com.au (Brian May) Date: Fri, 15 Feb 2013 13:13:04 +1100 Subject: [melbourne-pug] copy module Message-ID: Hello, I have the following class, for case insensitive dictionary operations, while preserving the case for times this is required. Unfortunately, it doesn't work well with the Python copy module. I get random intermittent errors like "AttributeError: 'CaseInsensitiveDict' object has no attribute 'lc'" in __setitem__ which is weird, because lc is initialized in the constructor. I can only assume that the copy module does not call the constructor, but does expect the __setitem__ method to work regardless. This seems wrong to me. Just to make things even more difficult, this generally is more likely to work on my development system (python 2.7.3) then my production systems (python 2.6.6) - so maybe the later version of Python is better? I created the clone method to try and solve this, the challenge is to catch all instances of code that try to use the copy module. Anyway, just curious if anybody here has any thoughts on this issue. Thanks class CaseInsensitiveDict(dict): """ Case insensitve dictionary for searches however preserves the case for retrieval. """ def __init__(self, d={}): self.lc = {} for k,v in d.iteritems(): self.lc[k.lower()] = k super(CaseInsensitiveDict, self).__init__(d) def __setitem__(self, key, value): try: old_key = self.lc[key.lower()] except KeyError: pass else: if key != old_key: super(CaseInsensitiveDict, self).__delitem__(old_key) self.lc[key.lower()] = key super(CaseInsensitiveDict, self).__setitem__(key, value) def __delitem__(self, key): key = self.lc[key.lower()] del self.lc[key.lower()] super(CaseInsensitiveDict, self).__delitem__(key) def __getitem__(self, key): key = self.lc[key.lower()] return super(CaseInsensitiveDict, self).__getitem__(key) def __contains__(self, key): try: key = self.lc[key.lower()] except KeyError: return False else: return super(CaseInsensitiveDict, self).__contains__(key) def get(self, key, default=None): try: key = self.lc[key.lower()] except KeyError: return default else: return super(CaseInsensitiveDict, self).get(key, default) def has_key(self, key): try: key = self.lc[key.lower()] except KeyError: return False else: return super(CaseInsensitiveDict, self).has_key(key) def get_correct_key(self, key): return self.lc[key.lower()] def clone(self): return self.__class__(self) -- Brian May -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobias.sargeant at gmail.com Fri Feb 15 03:58:46 2013 From: tobias.sargeant at gmail.com (Tobias Sargeant) Date: Fri, 15 Feb 2013 13:58:46 +1100 Subject: [melbourne-pug] copy module In-Reply-To: References: Message-ID: If you provide a __copy__ method (renaming your clone method would do fine) then you will be ok. You might want to consider providing an __deepcopy__ method as well. On 15/02/2013, at 1:13 PM, Brian May wrote: > Hello, > > I have the following class, for case insensitive dictionary operations, while preserving the case for times this is required. Unfortunately, it doesn't work well with the Python copy module. I get random intermittent errors like "AttributeError: 'CaseInsensitiveDict' object has no attribute 'lc'" in __setitem__ which is weird, because lc is initialized in the constructor. > > I can only assume that the copy module does not call the constructor, but does expect the __setitem__ method to work regardless. This seems wrong to me. > > Just to make things even more difficult, this generally is more likely to work on my development system (python 2.7.3) then my production systems (python 2.6.6) - so maybe the later version of Python is better? > > I created the clone method to try and solve this, the challenge is to catch all instances of code that try to use the copy module. > > Anyway, just curious if anybody here has any thoughts on this issue. > > Thanks > > > class CaseInsensitiveDict(dict): > """ Case insensitve dictionary for searches however preserves the case for retrieval. """ > > def __init__(self, d={}): > self.lc = {} > for k,v in d.iteritems(): > self.lc[k.lower()] = k > super(CaseInsensitiveDict, self).__init__(d) > > def __setitem__(self, key, value): > try: > old_key = self.lc[key.lower()] > except KeyError: > pass > else: > if key != old_key: > super(CaseInsensitiveDict, self).__delitem__(old_key) > self.lc[key.lower()] = key > super(CaseInsensitiveDict, self).__setitem__(key, value) > > def __delitem__(self, key): > key = self.lc[key.lower()] > del self.lc[key.lower()] > super(CaseInsensitiveDict, self).__delitem__(key) > > def __getitem__(self, key): > key = self.lc[key.lower()] > return super(CaseInsensitiveDict, self).__getitem__(key) > > def __contains__(self, key): > try: > key = self.lc[key.lower()] > except KeyError: > return False > else: > return super(CaseInsensitiveDict, self).__contains__(key) > > def get(self, key, default=None): > try: > key = self.lc[key.lower()] > except KeyError: > return default > else: > return super(CaseInsensitiveDict, self).get(key, default) > > def has_key(self, key): > try: > key = self.lc[key.lower()] > except KeyError: > return False > else: > return super(CaseInsensitiveDict, self).has_key(key) > > def get_correct_key(self, key): > return self.lc[key.lower()] > > def clone(self): > return self.__class__(self) > > > > -- > Brian May > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug From steven.farlie at gmail.com Mon Feb 18 02:33:50 2013 From: steven.farlie at gmail.com (Steven Farlie) Date: Mon, 18 Feb 2013 12:33:50 +1100 Subject: [melbourne-pug] Call for Python coaches Message-ID: Hi everyone, This Saturday there is the first Introduction to Programming with Python workshop at Electron Workshop in North Melbourne. We are always on the lookout for more Python coaches (the more the merrier!). It's a pretty easy gig, we are just teaching some basic programming with the turtle module, but it's a lot of fun encouraging people to learn programming and hanging out with the other coaches. Here is the event on Meetup if you want to know more: http://www.meetup.com/OpenTechSchool-Melbourne/events/99983172/ We also have some slides for people who would like to know more about coaching: http://opentechschool.github.com/slides/presentations/coaching/ It's all volunteer-driven, open-source stuff. Students don't pay a thing. Electron Workshop and OpenTechSchool do it for the community. So if you are interested drop me an email. Cheers, -- Steven -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisjrn at gmail.com Wed Feb 27 23:46:24 2013 From: chrisjrn at gmail.com (Chris Neugebauer) Date: Thu, 28 Feb 2013 09:46:24 +1100 Subject: [melbourne-pug] PyCon Australia 2013 Call for Proposals is now open! (Closes April 5) Message-ID: PyCon Australia 2013 is pleased to announce that its Call for Proposals is now open! The conference this year will be held on Saturday 6 and Sunday 7 July 2013 in Hobart, Tasmania. We'll also be featuring a day of miniconfs on Friday 5 July. The deadline for proposal submission is Friday April 5, 2013, and more information can be found at http://pycon-au.org/cfp PyCon Australia attracts professional developers from all walks of life, including industry, government, and science, as well as enthusiast and student developers. We?re looking for proposals for presentations and tutorials on any aspect of Python programming, at all skill levels from novice to advanced. Presentation subjects may range from reports on open source, academic or commercial projects; or even tutorials and case studies. If a presentation is interesting and useful to the Python community, it will be considered for inclusion in the program. We're especially interested in short presentations that will teach conference-goers something new and useful. Can you show attendees how to use a module? Explore a Python language feature? Package an application? Proposals about the Django web framework are very strongly encouraged, and will also be considered for inclusion in DjangoCon AU, to be held on Friday 5 July. We welcome first-time speakers; we are a community conference and we are eager to hear about your experience. If you have friends or colleagues who have something valuable to contribute, twist their arms to tell us about it! Please also forward this Call for Proposals to anyone that you feel may be interested. To find out more go to the official Call for Proposals page here: http://pycon-au.org/cfp See you in Hobart in July! == About PyCon Australia == PyCon Australia is the national conference for the Python Programming Community. The fourth PyCon Australia will be held on July 5--7, 2013 in Hobart, Tasmania, bringing together professional, student and enthusiast developers with a love for developing with Python. PyCon Australia informs the country?s Python developers with presentations, tutorials and panel sessions by experts and core developers of Python, as well as the libraries and frameworks that they rely on. To find out more about PyCon Australia 2013, visit our website at http://pycon-au.org or e-mail us at contact at pycon-au.org. PyCon Australia is presented by Linux Australia (www.linux.org.au) and acknowledges the support of our Platinum sponsor: Australian Computer Society (Tasmanian Branch) (www.acs.org.au); and our Gold Sponsor, Google Australia (www.google.com.au). For full details of our sponsors, see our website. -- --Christopher Neugebauer Conference Coordinator and Sponsor Liaison PyCon Australia: Hobart 2013 -- http://pycon-au.org -- @pyconau 5?7 July 2013, Call for Proposals now open! Jabber: chrisjrn at gmail.com -- IRC: chrisjrn on irc.freenode.net -- WWW: http://chris.neugebauer.id.au -- Twitter/Identi.ca: @chrisjrn From sam at nipl.net Thu Feb 28 08:09:30 2013 From: sam at nipl.net (Sam Watkins) Date: Thu, 28 Feb 2013 18:09:30 +1100 Subject: [melbourne-pug] config files? pfft! Message-ID: <20130228070930.GA5868@opal.nipl.net> config files? pfft! In python, one may put a program's settings in a separate python file, and simply import it (or from it import *). And if you just use numbers and quoted strings, those files can be used for shell config and perhaps make config. Killer Feature. Works nice with python's excellent syntax and module system :) A bit of a boring post, but hey... Sam From william.leslie.ttg at gmail.com Thu Feb 28 08:32:24 2013 From: william.leslie.ttg at gmail.com (William ML Leslie) Date: Thu, 28 Feb 2013 18:32:24 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: <20130228070930.GA5868@opal.nipl.net> References: <20130228070930.GA5868@opal.nipl.net> Message-ID: On 28 February 2013 18:09, Sam Watkins wrote: > config files? pfft! > > In python, one may put a program's settings in a separate python file, > and simply import it (or from it import *). Or more typically, execfile it - this means you don't have to mess with the path [0], no .pyc is generated, and you can put objects into the global namespace for the config file to use, no import required. [0] A practice which is becoming more and more common because people don't structure their projects properly. It's tough to point fingers, because a number of big-time python libraries do it too. -- William Leslie From sam at nipl.net Thu Feb 28 08:45:18 2013 From: sam at nipl.net (Sam Watkins) Date: Thu, 28 Feb 2013 18:45:18 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: References: <20130228070930.GA5868@opal.nipl.net> Message-ID: <20130228074518.GB5868@opal.nipl.net> William ML Leslie wrote: > mess with the path [0] > [0] A practice which is becoming more and more common because people > don't structure their projects properly. It's tough to point fingers, > because a number of big-time python libraries do it too. Could you elaborate or link to something that does? How would one structure a project properly? From william.leslie.ttg at gmail.com Thu Feb 28 09:20:52 2013 From: william.leslie.ttg at gmail.com (William ML Leslie) Date: Thu, 28 Feb 2013 19:20:52 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: <20130228074518.GB5868@opal.nipl.net> References: <20130228070930.GA5868@opal.nipl.net> <20130228074518.GB5868@opal.nipl.net> Message-ID: On 28 February 2013 18:45, Sam Watkins wrote: > William ML Leslie wrote: >> mess with the path [0] > >> [0] A practice which is becoming more and more common because people >> don't structure their projects properly. It's tough to point fingers, >> because a number of big-time python libraries do it too. > > Could you elaborate or link to something that does? > How would one structure a project properly? http://twistedmatrix.com/trac/browser/trunk/bin/_preamble.py Of the reasons to mess with the path, after "I'm writing a plugin system", the two least-worst reasons to do so are "I'm writing a test framework" and "I like having a bin/ directory". These sort of things are less-bad than others because at least the paths being added are fairly fixed, and usually the directories exist purely for the purpose of being added to the path. Test frameworks should do as unittest does with -s; this avoids the need for things like relative imports and duplicated modules. (Yes, it does it by prepending the path, but it does it in a way that is obvious to the caller.) If you really have enough entry points to want a bin/ directory and you use setuptools or distribute, you should use their handy entry-points feature. If you have a whole stack of different functions exported by your project, an interface like hg or git is probably more useful, because it groups commands related to your application; you can do similar things with a Start Menu folder or Debian Menu submenu. By far the most common usage of path-mangling is people wanting to use specific modules during development without installing them. There are many existing solutions to this problem, like virtualenv and requirements.txt. Otherwise - if you have a project that depends on a different version of SQLA to your system version, say - symlink the module into your project directory. Given all of these situations covered, there should be no need to mangle the path at runtime. -- William Leslie From andrew at andrewspiers.net Thu Feb 28 10:17:12 2013 From: andrew at andrewspiers.net (Andrew Spiers) Date: Thu, 28 Feb 2013 20:17:12 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: <20130228070930.GA5868@opal.nipl.net> References: <20130228070930.GA5868@opal.nipl.net> Message-ID: On 28 February 2013 18:09, Sam Watkins wrote: > config files? pfft! > > In python, one may put a program's settings in a separate python file, > and simply import it (or from it import *). > > And if you just use numbers and quoted strings, > those files can be used for shell config and perhaps make config. > > Killer Feature. Works nice with python's excellent syntax and module system :) > > A bit of a boring post, but hey... > Your message was not boring. I used to like having per-user config stuff in a python file in the PEP370 directories, but they are not on the path when you are in a venv. Just now I even tried exporting PYTHONUSERBASE=~/.local before activating a venv and those directories didn't get added to my venv's path. ~/.local does seem like a logical place to look for config files, regardless of if they are actual python files or configparser ini style files. It is nice to be able to just 'import config'. From jonmmorgan at gmail.com Thu Feb 28 14:39:41 2013 From: jonmmorgan at gmail.com (Jonathan Morgan) Date: Fri, 1 Mar 2013 00:39:41 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: <20130228070930.GA5868@opal.nipl.net> References: <20130228070930.GA5868@opal.nipl.net> Message-ID: Hi Sam, Interesting point (and probably good for internal config). Just a few questions (from what I use config files for - user accessible configuration): 1. How do you deal with syntax errors when the user modifies this file? (yes, you have to deal with file format errors with flat files, but at least it is not a syntax error at load time). 2. Can a user inject undesirable code into the system and break my code / security / something? 3. Can you have a system with defaults and only set config that isn't the default value? (I think Django has this with local settings where you will do a "from settings import *" - but is this easily maintainable? Will it always get the order right? Will you be able to change e.g. just one entry in a dictionary property?) These reasons would all drive me towards using a "standard" config file, but I would be interested to hear if anyone has better options for them. Thanks, Jon On Thu, Feb 28, 2013 at 6:09 PM, Sam Watkins wrote: > config files? pfft! > > In python, one may put a program's settings in a separate python file, > and simply import it (or from it import *). > > And if you just use numbers and quoted strings, > those files can be used for shell config and perhaps make config. > > Killer Feature. Works nice with python's excellent syntax and module > system :) > > A bit of a boring post, but hey... > > Sam > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hartror at gmail.com Thu Feb 28 23:33:03 2013 From: hartror at gmail.com (Rory Hart) Date: Fri, 1 Mar 2013 09:33:03 +1100 Subject: [melbourne-pug] config files? pfft! In-Reply-To: References: <20130228070930.GA5868@opal.nipl.net> Message-ID: 1. Syntax errors are just like any exception, they can be caught, handled and reported to the user. 2. Yes but they can do that in other ways just as easily. 3. Yes, for example in one of my projects I load a settings file/module and do a getattr on it which allows easily defined defaults no imports required*. Similar things apply to the rest of #3 * not 100% true we need absolute paths in that project and I decided explicitly using os.path etc in settings was better than hiding the pathing magic elsewhere. On 1 March 2013 00:39, Jonathan Morgan wrote: > Hi Sam, > > Interesting point (and probably good for internal config). Just a few > questions (from what I use config files for - user accessible > configuration): > 1. How do you deal with syntax errors when the user modifies this file? > (yes, you have to deal with file format errors with flat files, but at > least it is not a syntax error at load time). > > 2. Can a user inject undesirable code into the system and break my code / > security / something? > > 3. Can you have a system with defaults and only set config that isn't the > default value? (I think Django has this with local settings where you will > do a "from settings import *" - but is this easily maintainable? Will it > always get the order right? Will you be able to change e.g. just one entry > in a dictionary property?) > > These reasons would all drive me towards using a "standard" config file, > but I would be interested to hear if anyone has better options for them. > > Thanks, > Jon > > > On Thu, Feb 28, 2013 at 6:09 PM, Sam Watkins wrote: > >> config files? pfft! >> >> In python, one may put a program's settings in a separate python file, >> and simply import it (or from it import *). >> >> And if you just use numbers and quoted strings, >> those files can be used for shell config and perhaps make config. >> >> Killer Feature. Works nice with python's excellent syntax and module >> system :) >> >> A bit of a boring post, but hey... >> >> Sam >> _______________________________________________ >> melbourne-pug mailing list >> melbourne-pug at python.org >> http://mail.python.org/mailman/listinfo/melbourne-pug >> > > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > -- Rory Hart http://www.roryhart.net -------------- next part -------------- An HTML attachment was scrubbed... URL: