Hi,
I tried to do freeze.py for my script that uses ElementTree.
But got the this error:
File "/usr/lib/python2.5/xml/__init__.py", line 45, in
_xmlplus.__path__.extend(__path__)
AttributeError: 'str' object has no attribute 'extend'
The reason seems that _xmlplus.__path__ is a string
a
Hi!
I am going through some code and found
import runscript
BUT I cant find and information about this module. I searched Google
did a grep in
the /usr/lib/python directory.
What is the purpose of this module and where can I find information
about it. Or the source.
Best regards,
Toni
--
htt
In a class it is poosible to override setattr, so that you can decide
how you should
handle setting of variables.
Is this possible to do outside of an class on module level.
mysetattr(obj, var, value):
print "Hello"
So that
test = 5
would print
Hello
--
http://mail.python.org/mailman/listi
On 21 Jan, 22:00, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Jan 21, 2:52 pm, glomde <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 21 Jan, 20:16, George Sakkis <[EMAIL PROTECTED]> wrote:
>
> > > On Jan 21, 1:56 pm, glomde <[EMAIL PROTECTED]> wr
On 21 Jan, 20:16, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Jan 21, 1:56 pm, glomde <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 21 Jan, 18:59, Wildemar Wildenburger
>
> > <[EMAIL PROTECTED]> wrote:
> > > glomde wrote:
> > > > Hi
On 21 Jan, 18:59, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> glomde wrote:
> > Hi,
>
> > is it somehow possible to set the current namespace so that is in an
> > object.
> > [snip]
> > set namespace testObj
> > Name = "Test"
Hi,
is it somehow possible to set the current namespace so that is in an
object.
Somthing like.
class Test():
testObj = Test()
set namespace testObj
Name = "Test"
Name would set testObj.Name to "Test".
I was thinking this could be done with the with statement somehow
(without using
On 29 Maj, 22:45, Steve Holden <[EMAIL PROTECTED]> wrote:
> glomde wrote:
> > Hi I wonder if you can set what subclass a class should
> > have at instance creation.
>
> > The problem is that I have something like:
>
> > class CoreLang():
> > def A
On 29 Maj, 19:20, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi I wonder if you can set what subclass a class should
> > have at instance creation.
>
> > The problem is tha
t
calls submethods.
and thes submethods should be overriden by the subclasses. So I cant
change the name
on the submethods.
>
> On May 29, 8:52 am, glomde <[EMAIL PROTECTED]> wrote:
>
> > Hi I wonder if you can set what subclass a class should
> > have at instance crea
Hi I wonder if you can set what subclass a class should
have at instance creation.
The problem is that I have something like:
class CoreLang():
def AssignVar(self, var, value):
pass
class Lang1(CoreLang):
def AssignVar(self, var, value):
return var, "=", value
class
Gabriel Genellina wrote:
> def __call__(self, *args, **kwds):
> return self.__TemplateMethod(*args, **kwds)
>
> x = Template()(prefix="foo")
> or perhaps:
> x = Template(prefix="foo")()
>
> I think the extra () improves readability - it's clear that x comes from a
> function call, it
Hi,
I am implementing som code generation and want to to use some variant
of the template method pattern.
What I came up with is to have a class with the common part
in a method and the subclasses can then override the Customize methods
to do their own special part.
Now to the question I use the
> To get python to run the __get__ method I think you have to call
> __getattr__ explicitly:
> a.__getattr__('test')
>
> If you do:
> a.test
> python follows a different routine: it checks for the existence of the
> attribute, then check if there is a __getattr__ attribute. Now the
> speculative b
On Mar 28, 4:47 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> glomde <[EMAIL PROTECTED]> wrote:
> > Hi,
>
> > I tried to write a decorator for that should be for methods but for
> > some reasons
> > it doens seem to work when you try to do it on the __getatt
Hi,
I tried to write a decorator for that should be for methods but for
some reasons
it doens seem to work when you try to do it on the __getattr__ method
in a class.
Could anybody give some hints why this is?
Example:
class decoratorTest(object):
def __init__(self, func):
self.func =
So I read trough all of the make PEP and make would support the syntax
i propose..
and more generic and better in many ways. Since it was rejected I have
to continue live
with my preprocessor...
>From the make PEP
. Allowing this sort of customization could allow XML to be written
without rep
> We already have this (quite close to) this syntax:
>
> class (super):
> = *
> [class *]
>
> There's also the Zope3 'implements' trick, that allow to modify the
> class namespace without assignement:
>
> class :
> (*args, **kw)*
>
> So what you want is very certainly doable without any syntax
> What you are trying to achieve is to make syntactic sugar for making namespace
> definitions look nicer. But: the way you are trying to do so isn't pythonic,
> because there isn't one obvious way how your proposal works; you're not even
> specifying a proper semantic interpretation of your syntax
I'm answering two of you posts here...
> Sweet Lord, have mercy !
>
> > Which should create myList = [[0..9], {0:0, ... 9:9}]
>
> myList = [
> range(10),
> dict((i, i) for i in range(10))
> ]
> Let's talk about readability
My code was just to show that the proposal is not only for HTML
> What about writing a mini-language that gets translated to Python? Think of
> Cheetah, which does exactly this (albeit not being limited to templating HTML
> data).
I have implemented my proposal as preprocessor. And it works fine. But
my
proposal in not only for HTML it can be used for all hier
> Adding ugly and unintuitive "operators" to try to turn a general purpose
> programming language into a half-backed unusable HTML templating
> language is of course *much* more pythonic...
IT is not only for HTML. I do think html and xml are the biggest
creators of
hierarcical treestructures. But
> Here's a nice stan example, taken from Kieran Holland's tutorial
> http://www.kieranholland.com/code/documentation/nevow-stan/
I took a quick look and it looks nice as long as your page is static.
But I couldnt
se how you could mix in python code seamlessy when creating your tree.
But I might b
> What about using data for nodes and '=' for attributes ?
> Would look like:
>
>
>
> Page Title
>
>
> Hello World
>
>
>
> > I think that with the added syntax you get better view of the html
> > page.
>
> indeed !-)
I dont think it is very pythonic :-). You dont use endtags
> You also repeat yourself: head("head"), title("title"), body("body")
>
> What about this:
>
> # build a tree structure
> root = ET.Element("html")
> !root
> !head
> !title
> if A is True:
> &text = "Page A"
> else:
> &text = "Page B"
> !body
> &bgc
> You can put any python expression in there, and in the Node class you can do
> what you want.
But the main advantage is any python code not only expressions. In
addition to that
you get nice flow style. Can set variables which you later use as want.
> Seems that you are after a templating-syste
Actually we did start of with YAML, but realised that we need to have
the power
of a programming language aswell. But I wanted to come up with
something that looked
very clos to YAML since I find it quite readable.
I have implemented the syntax, but as a preprocessor for python and it
works quite
But you cant mix python code in there when creating the nodes.
That is when it gets quite ugly an unreadable according to me.
But I also relly do think that this:
# build a tree structure
root = ET.Element("html")
*!*root:
*!*head("head"):
*!*title("title):
*=*text
There are some difference which are quite essential.
First of all I dont se how you set attributes with that and
then I dont see how you can mix python code with the creation.
So how do you do this:
root = ET.Element("html")
*!*root:
*!*head("head"):
*!*title("title):
fo
i I would like to extend python so that you could create hiercical
tree structures (XML, HTML etc) easier and that resulting code would be
more readable than how you write today with packages like elementtree
and xist.
I dont want to replace the packages but the packages could be used with
the
new
> But generally, I don't do layout like that. I'd do:
>
>--->cursor.execute(
>--->--->--->'select id, item, amount, field4,
>--->--->--->'from table1 where amount>100'
>--->)
>
>Which keeps looking fine, no matter what tab size, and without mixing
>tabs and spaces.
>
Which only wor
Ok, now I think I know what I need to do.
I need to create a variable in the calling functions locals.
So how do I get access to the calles locals dictionary?
Is it possible?
--
http://mail.python.org/mailman/listinfo/python-list
> I dont want the caller to call import but a function.
come again?
>>> type (__builtins__.__import__)
I didnt mean that __import__ isnt a function, but that I want to
make a function called ImoprtFile that actually does something
very similar that what __import__.
So to rephrsase the questi
Tanks but that isn't what I am looking for.
I really want a function that you can call and imports
the module into the calling functions namespace.
I dont want the caller to call import but a function.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I want to create a function that preprocesses a file and then imports
the parsed file.
What I found out is that you can do something like this:
def ImportFile(fileName):
parsedCode = Parser(fileName).Parse()
module = new.module(name)
exec parsedCode in module.__dict__
sys.mod
Thanks,
but the thing is that I want to have the syntactical sugar.
And I think that you could use elementtree or xist or any
other python tree structure module at the bottom. It could
be quite generic.
And with the syntactical sugar I find it a lot more readable.
A little bit like yaml, but you
Hi I would like to extend python so that you could create hiercical
tree structures (XML, HTML etc) easier and that resulting code would be
more readable.
The syntax i would like is something like the below:
# Example creating html tree
'*!*' is an operator that creates an new node
'*=*' is an o
37 matches
Mail list logo