Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-04 Thread Alia Khouri
Terry Reedy wrote: Just double the brackets, just as one doubles '\\' to get '\' in a string.   class {0}Model {{ public bool IsModel(){{ returntrue; .format('My') 'class MyModel { public bool IsModel(){ returntrue; } }' Indeed, I tried that, but it means I have to double bracket all

Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-04 Thread Alia Khouri
Peter Otten wrote: You could automatically convert from a custom format like that in your original post: import re _lookup = {     [[: {,     ]]: },     {: {{,     }: }}, } def _substitute(m):     return _lookup[m.group()] def custom_format(template, *args, **kw):     return

Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-04 Thread Alia Khouri
Peter Otten wrote: You could automatically convert from a custom format like that in your original post... snip Here's a class wrapping your functionality: import re class Template(object): '''uses double brackets e.g [[ob.attr]] as delims to get around curly bracket ({})

proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-03 Thread Alia Khouri
Hi folks, I've been using ironpython2.7 in a project, and I was generating some csharp code when i discovered that I couldn't use use str.format because the interference with the brackets-aplenty situation in csharp. In [1]: code = class {0}Model { public bool IsModel(){ return true; } } In

Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

2011-04-03 Thread Alia Khouri
On Apr 3, 1:53 pm, Corey Richardson kb1...@aim.com wrote: On 04/03/2011 06:07 AM, Alia Khouri wrote: Hi folks, I've been using ironpython2.7 in a project, and I was generating some csharp code when i discovered that I couldn't use use str.format because the interference

playing with berp: python3 to haskell compiler in haskell

2010-10-31 Thread Alia Khouri
In case anyone finds this worthwhile: there is a pretty impressive python3 to haskell compiler written in haskell called berp that looks very interesting: http://github.com/bjpop/berp/wiki I highly recommend reading through the berp implementation code for a fascinating (but currently incomplete)

Re: Is Python a functional programming language?

2010-05-12 Thread Alia Khouri
Paul Rubin: I like learnyouahaskell.com if you want to get some exposure to Haskell, probably the archetypal functional language these days.  I've been fooling with it on and off for the past couple years.  I'm still not convinced that it's that good a vehicle for practical general purpose

interfacing python haskell code with ctypes on linux

2009-10-11 Thread Alia Khouri
Hi Folks, Just in case anyone is interested, I've just added a very simple example for linux showing how to access haskell functions from python code using ctypes. It's on the wiki: http://wiki.python.org/moin/PythonVsHaskell AK -- http://mail.python.org/mailman/listinfo/python-list

python version in snow leopard?

2009-06-09 Thread Alia Khouri
Does anyone know what version of python will appear in snow leopard which is apparently being released in September? -- http://mail.python.org/mailman/listinfo/python-list

survey: cool but not so well-known python apps

2009-04-26 Thread Alia Khouri
This mini-survey's purpose is to raise awareness of certain apps that perhaps don't have the marketing profile/momentum of some of the better known python apps out there, but are cool and interesting nonetheless. To this end, please post 3-5+ apps that you think deserve more attention: Here's my

recursive outline numbering for object trees

2009-03-30 Thread Alia Khouri
Hi, Here my problem description: Given the following class: class Node(object): def __init__(self, name, children=[], parent=None): self.name = name self.level = '' self.children = children self.parent = parent def __repr__(self): name =

sorting tasks by importance and urgency

2009-02-25 Thread Alia Khouri
I recently considered the apparently simple problem is of how to algorithmically sort a set of business tasks which have an associated a value and a due_date, such that the most important and urgent are pushed to the top of the stack. The two example task types I am posing here are: (1) a bid on

python contextmanagers and ruby blocks

2009-02-21 Thread Alia Khouri
As an exercise, I recently translated one of my python scripts (http:// code.activestate.com/recipes/576643/) to haskell (a penultimate version exists at http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b44244e# in case anyone is interested) with the result that

Re: Source code generation using Python

2008-12-07 Thread Alia Khouri
Any suggestions? I've happily used Cheetah with Leo (http://webpages.charter.net/ edreamleo/front.html) to organise and script my code generation needs, but you may also be happy with cog (http://nedbatchelder.com/code/ cog/). AK -- http://mail.python.org/mailman/listinfo/python-list

Re: Will MySQLdb, the Python shim, be supported for Python 2.6 or 3.x?

2008-11-18 Thread Alia Khouri
John Nagle wrote:     Whoever did the port somehow created a dependency on the Intel math library, libguide40.dll and libmmd.dll.  That shouldn't be needed in the MySQL Python shim.  It's not freely distributable, either; you have to buy the Intel C++ compiler to get it.  There are

Re: Will MySQLdb, the Python shim, be supported for Python 2.6 or 3.x?

2008-11-17 Thread Alia Khouri
John Nagle wrote:      MySQLdb, the Python shim for MySQL, still supports Python only to Python 2.5.  See http://sourceforge.net/projects/mysql-python;.  Are there any plans to support Python 2.6 or 3.x? Are you running windows? If so, check the forums of the group above, some nice chap has

Re: Midi manipulation

2008-11-16 Thread Alia Khouri
On Nov 16, 10:17 pm, Massi [EMAIL PROTECTED] wrote: Hi everyone, I'm searching for something which allows me to write scripts which handle midi files. I'm totally a newbie in audio manipulation, therefore any suggestion or link related to this field is welcome. Thanks in advance.

doctesting practices

2008-08-27 Thread Alia Khouri
I was wondering the other day how other pythonistas incorporate doctests into their coding practices. I have acquired the habit of keeping an editor open in one window and an ipython instance open in another and then using something similar to the format of the module below. In this case, I

Re: You advice please

2008-08-13 Thread Alia Khouri
Hussein B wrote: I'm a Java/Java EE developer and I'm playing with Python these days. I like the Python language so much and I like its communities and the Django framework. Sounds familiar... (-: My friends are about to open a Ruby/Rails shop and they are asking me to join them. In this

Re: Jason Orendorff's path module

2008-08-12 Thread Alia Khouri
andybak wrote: Which rather makes me wonder - lot's of people liked this module or rather disliked os.path. Is there anything salvageable from the BDFL's objections worthy of a PEP? Funny you should bring this up today.. I was just thinking the same thing (-: and I looked at the pep

Re: snippet to update local (bazaar, mercurial, svn) versioned source

2008-07-16 Thread Alia Khouri
On Jul 16, 8:34 am, Alia Khouri [EMAIL PROTECTED] wrote: Here's a very simple snippet I use to automatically keep my versioned sources fresh.. Posted here in case it may be of use to anybody... code #!/usr/local/bin/python import os, sys src = '/Users/ak/Code/src' # utility functions

snippet to update local (bazaar, mercurial, svn) versioned source

2008-07-15 Thread Alia Khouri
Here's a very simple snippet I use to automatically keep my versioned sources fresh.. Posted here in case it may be of use to anybody... code #!/usr/local/bin/python import os, sys src = '/Users/ak/Code/src' # utility functions join, isdir, listdir = os.path.join, os.path.isdir def run(cmd):

Re: python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-09 Thread Alia Khouri
Might as well answer the survey myself: A few questions (please add more) so far are: (1) Should setuptools be standard? Not at this stage. What pythonistas need is a cross-platform package manager that is included in the stdlib. Setuptools is simply not mature enough nor pythonic enough to

python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-01 Thread Alia Khouri
Can we open up the discussion here about how to improve setuptools which has become the de facto standard for distributing / installing python software. I've been playing around with ruby's gems which seems to be more more mature and usable. From my perspective, the relative immaturity of

Re: Python 3.0 migration plans?

2007-10-02 Thread Alia Khouri
Couldn't agree with you more. What would be fantastic is if I could drop into the Pypi (and/or use easy_install) and download automatically compiled versions of extension modules for different versions of python. I'm sure the community at large would be happy to chip in an annual fee to help

Re: problems with logging module

2007-07-31 Thread Alia Khouri
You are not going beyond basicConfig - I'd write the above as: Intentionally didn't go beyond basicConfig. The problem is global level configuration vs. easy local (in function or in class) configuration. logging.basicConfig(...) def __init__(self, x): self.x = x self.log =

Re: problems with logging module

2007-07-30 Thread Alia Khouri
On Jul 30, 8:01 am, Gabriel Genellina [EMAIL PROTECTED] wrote: To see what's going on, try using this old-fashioned debug technique: a few print statements. My bad, problem was solved, the shortcoming was one of my variables pointing to nothingness (-; But I'm not letting the logging module

problems with logging module

2007-07-29 Thread Alia Khouri
I've been struggling with the logging module in the stdlib which seems to me rather counter-intuitive: For some reason it refuses to recognize configuration options when they are set inside a class so I have had to initialize logging and set the configuration options in the global scope of my

recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
I was kind of wondering what ways are out there to elegantly expand '$name' identifiers in nested dictionary value. The problem arose when I wanted to include that kind of functionality to dicts read from yaml files such that: def func(input): # do something return output where: input =

Re: recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
Oops, I left some redundant cruft in the function... here it is slightly cleaner: def expand(dikt): names = {} output = {} def _search(_, sourceDict): for key, value in sourceDict.items(): if isinstance(value, dict): _search({}, value)

Re: recursively expanding $references in dictionaries

2007-07-22 Thread Alia Khouri
Ok. I've reached a nice little conclusion here. Time to go to bed, but before that I thought I'd share the results (-; I can now read a yaml file which natively produces a dict tree and convert it into an object tree with attribute read/write access, dump that back into a readable yaml string,

Ableton Live Python API is out!

2007-06-09 Thread Alia Khouri
I have been waiting for this ages and it's finally happened! Python meet Live, Live meet Python! There's now a wonderful (public) bridge between (arguably) the most exciting and innovative and easy-to-use realtime software sequencer and (arguably) the most exciting and innovative and easy-to-use

Re: Which Python web framework is most like Ruby on Rails?

2005-12-16 Thread Alia Khouri
In http://subway.python-hosting.com/ticket/216 Peter Mere writes: Subway has a lot of ideas TurboGears lacks. Everything from the @client ajax-in-python to CherryFlow. On technical merits, Subway should eat TurboGears' dinner. But we all know market outcomes are not based on technical merit.

Re: improving pypi / setuptools

2005-11-30 Thread Alia Khouri
It is still early days for setuptools... still, we are lagging behind the ruby world in this regards. I definitely agree with you that the so-called megaframeworks need to be packaged better (especially all versions of the different components being updated on almost daily basis). AK --

improving pypi / setuptools

2005-11-29 Thread Alia Khouri
Due to a recent site overhaul by sourceforge certain files linked to from pypi won't install. For example, in trying to install all the dependencies for the subway web framework, I got this kind of error: snip . . . Searching for CherryPy=2.1.0-rc1 Reading http://www.python.org/pypi/CherryPy/

Re: generating audio signals

2005-03-20 Thread Alia Khouri
http://www.python.org/moin/PythonInMusic -- http://mail.python.org/mailman/listinfo/python-list

Re: survey of modules to be added to stdlib

2005-03-20 Thread Alia Khouri
It would be amazing if you could add the feature to do combo package installs like : - a scientific python combo (which would include scipy, numarray, Numpy, plotting libs, etc) - an AI python combo(orange, constraint programming modules, agent libs, etc) - a game development python combo

adding a path module to stdlib

2005-03-18 Thread Alia Khouri
This may have been discussed ad nauseaum before, but every time I use os.path manipulations I miss something like Jason Orrendorf's path.py being in the standard library. [http://www.jorendorff.com/articles/python/path/] Ruby has it: require 'pathname' path = Pathname.new(/tmp/f.log) What are

survey of modules to be added to stdlib

2005-03-18 Thread Alia Khouri
This is an informal survey to gauge the community's interest in adding popular modules to the python standard library. In no particular order, here's my personal list of favourites: path.py - Jason Orendorff elementree - Fredrik Lundh ctypes - Thomas Heller psyco - Armin Rigo IPython - Fernando

Re: Sound and music libraries?

2005-02-28 Thread Alia Khouri
http://www.python.org/moin/PythonInMusic AK -- http://mail.python.org/mailman/listinfo/python-list

Re: why no python setup.py uninstall?

2004-12-05 Thread Alia Khouri
I'm guessing that this is a non-issue for most people (-; -- http://mail.python.org/mailman/listinfo/python-list

why no python setup.py uninstall?

2004-12-03 Thread Alia Khouri
If the cannonical way to install a python app is python setup.py install one would expect the following to uninstall it python setup.py uninstall However, distutils doesn't automatically take care of that for you. Is this by design? Or is this something that could/should be addressed