Peter Otten wrote:
> You could automatically convert from a custom format like that in your
> original post...
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 ({}) collisions
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
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 bra
On Apr 3, 1:53 pm, Corey Richardson 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
> >
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 [2
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)
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
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
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
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
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 = self.__cl
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 a
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 haske
> 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
> > 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
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 ha
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.
http:
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 incorpo
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 t
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 (http:/
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...
>
>
> #!/usr/local/bin/python
> import os, sys
>
> src =
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...
#!/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):
pri
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
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 setupt
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 build
> 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 =
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 mod
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 modu
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, and
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)
if
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 =
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
c
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.
The
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
--
http://
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:
.
.
.
Searching for CherryPy>=2.1.0-rc1
Reading http://www.python.org/pypi/CherryPy/
Reading
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 (pygam
http://www.python.org/moin/PythonInMusic
--
http://mail.python.org/mailman/listinfo/python-list
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 P
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
http://www.python.org/moin/PythonInMusic
AK
--
http://mail.python.org/mailman/listinfo/python-list
I'm guessing that this is a non-issue for most people (-;
--
http://mail.python.org/mailman/listinfo/python-list
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
in
42 matches
Mail list logo