Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
[I hope I am posting to the right place]

I have a cheetah template something like this:

x is: $x
y is: $y
z is: $z

[Actually more complicated]

If for example $y is not defined I get an exception and  the parsing
of the template stops. Is  there any way to substitute $y with an emty
string and making cheeta going on with parsing?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
2006/8/2, Stephan Diehl <[EMAIL PROTECTED]>:
> Paolo Pantaleo wrote:
> > [I hope I am posting to the right place]
> >
> > I have a cheetah template something like this:
> >
> > x is: $x
> > y is: $y
> > z is: $z
> >
> > [Actually more complicated]
> >
> > If for example $y is not defined I get an exception and  the parsing
> > of the template stops. Is  there any way to substitute $y with an emty
> > string and making cheeta going on with parsing?
> >
> > Thnx
> > PAolo
> >
>
> http://cheetahtemplate.org/docs/users_guide_html_multipage/language.namemapper.missing.html
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Actually I wanted to keep things simple for who writes the template,
so I am using this workaround: I define a class

class ClassMapper:
def __init__(self,dict={}):
self.__dict=dict
def getValue(self,str):
try:
return self.__dict[str]
except KeyError:
return ""

x=ClassMapper(dict)
Template(definition, searchList=[{"info":x.getValue}])



so the user should do

$info("name")

Maybe I could define a class that implements a dictionary and doesn''t
raise an exception for a key not present... but it seems to
complicated.

PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
2006/8/2, Peter Otten <[EMAIL PROTECTED]>:
> Paolo Pantaleo wrote:
>
> > 2006/8/2, Stephan Diehl <[EMAIL PROTECTED]>:
> >> Paolo Pantaleo wrote:
> >> > [I hope I am posting to the right place]
> >> >
> >> > I have a cheetah template something like this:
> >> >
> >> > x is: $x
> >> > y is: $y
> >> > z is: $z
> >> >
> >> > [Actually more complicated]
> >> >
> >> > If for example $y is not defined I get an exception and  the parsing
> >> > of the template stops. Is  there any way to substitute $y with an emty
> >> > string and making cheeta going on with parsing?
> >> >
> >> > Thnx
> >> > PAolo
> >> >
> >>
> >>
> http://cheetahtemplate.org/docs/users_guide_html_multipage/language.namemapper.missing.html
> >> --
> >> http://mail.python.org/mailman/listinfo/python-list
> >>
> >
> > Actually I wanted to keep things simple for who writes the template,
> > so I am using this workaround: I define a class
> >
> > class ClassMapper:
> > def __init__(self,dict={}):
> > self.__dict=dict
> > def getValue(self,str):
> > try:
> > return self.__dict[str]
> > except KeyError:
> > return ""
> >
> > x=ClassMapper(dict)
> > Template(definition, searchList=[{"info":x.getValue}])
> >
> >
> >
> > so the user should do
> >
> > $info("name")
> >
> > Maybe I could define a class that implements a dictionary and doesn''t
> > raise an exception for a key not present... but it seems to
> > complicated.
>
> You mean something like
>
> from Cheetah.Template import Template
>
> class Dict(dict):
> def __getitem__(self, key):
> return self.get(key, "")
>
> template = """\
> x is $x
> y is $y
> z is $z
> """
> print Template(template, searchList=[Dict(x="x", y="y")])
>
> You can also make a debugging version:
>
> class Dict(dict):
> def __getitem__(self, key):
> return self.get(key, "#missing key: %r#" % key)
>
> Peter
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Wonderful, thnx a lot. Well not so complicated if you know how to do :D

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Grammar parsing

2006-08-03 Thread Paolo Pantaleo
Hi,

How can I write a pareser for a certain gramamr? I found PyPy that
does it, is thare any other tool? Maybe something built-in the python
interpreter?

Thnx
PAolo



-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Grammar parsing

2006-08-03 Thread Paolo Pantaleo
2006/8/3, Ben Finney <[EMAIL PROTECTED]>:
> "Paolo Pantaleo" <[EMAIL PROTECTED]> writes:
>
> > How can I write a pareser for a certain gramamr? I found PyPy that
> > does it, is thare any other tool? Maybe something built-in the
> > python interpreter?
>
> The standard library gets you partway there, with 'shlex':
>
> http://docs.python.org/lib/module-shlex.html>
>
> The cheeseshop knows of 'pyparsing':
>
> http://cheeseshop.python.org/pypi/pyparsing/>
>


Thnx everybody for the help,

I finished using pyparsing actually, that is very handy and nice to use.

PAolo


-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


[Announce] p-gal: photo gallery generator with templating support

2006-08-14 Thread Paolo Pantaleo
Hi,
I'm writing a software in python to generate html photo gallery. It is
called p-gal and is GPL licensed. It is written in python [With the
invaluable help of this list :)] and it has a templating system based
on Cheetah. Currently it works under Linux (and maybe other UNIX-like
OSs)

The main idea of p-gal is to provide a framework to allow image
gallery generation, but letting the user as free as possible about the
style of the gallery. P-gal features for now only one template (or
theme), but adding new ones is very simple.

I would anyone to take a look at my piece of code, and give me his
feedback about what is good and what should be improved.

Thnx
PAolo Pantaleo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Announce] p-gal: photo gallery generator with templating support

2006-08-14 Thread Paolo Pantaleo
14 Aug 2006 08:31:06 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid>:
> "Paolo Pantaleo" <[EMAIL PROTECTED]> writes:
> > I would anyone to take a look at my piece of code, and give me his
> > feedback about what is good and what should be improved.
>
> url?
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Sorry...

www.sf.net/projects/ppgal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: p-gal: photo gallery generator with templating support

2006-08-14 Thread Paolo Pantaleo
14 Aug 2006 10:16:37 -0700, ajaksu <[EMAIL PROTECTED]>:
> Paolo Pantaleo wrote:
> > www.sf.net/projects/ppgal
>
> Ciao Paolo!
>
> The homepage (http://paolopan.freehostia.com/p-gal/ ) looks weird in my
> SeaMonkey 1.0.4,  contents appear below GoogleAds instead of at the
> right.

Well... I designed the site for Firefox... anyway I used CSS float
directives and no tables. I don't know if I made something wrong, or
if it is a [not so unlikely] standard compliance problem. Well Firefox
too has some problems with floats.

I copied the layout from http://www.topolinux.org/ - can you see this properly?



-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


locals() and globals()

2006-10-14 Thread Paolo Pantaleo
Hi

this exaple:

def lcl():
n=1
x=locals()
x["n"]=100
print "n in lcl() is:" +str(n)
#This will say Name error
#x["new"]=1
#print new


n=1
x=globals()
x["n"]=100
print "gobal n is:" +str(n)
x["new"]=1
print "new is:" +str(new)
lcl()

produces

gobal n is:100
new is:1
n in lcl() is:1

shouldn't be n in lcl() 100 too?

why accessing the names dictionary globals() and locals() gives
different results?
This example was made using
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Screen capture on Linux

2006-10-21 Thread Paolo Pantaleo
Hi,

I need to capture a screen snapshot in Linux. PIL has a module
IageGrab, but in the free version it only works under Windows. Is
there any package to capture the screen on Linux?

Thnx
PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Screen capture on Linux

2006-10-23 Thread Paolo Pantaleo
Thnx everybody for the help,

actually I need somethin slightly different. I found about some
external process that can capture the screen, but since I need to
captyre the screen up to 4-5 times a second, I don't want to fork a
new process every time, so I was looking for some library...[This
method works good on Windows]

If needed, I was thinking to write a C module too. I never did it
before, but I am a not so bad C programmer... any suggestion? What
code can I read and eventually reuse? Would the xwd be useful?

Anyway doesn't it exist a Python binding for let's say X APIs ?
[I know about nothing about X programing]

2006/10/22, Theerasak Photha <[EMAIL PROTECTED]>:
> On 22 Oct 2006 09:06:53 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Paolo Pantaleo wrote:
> > > Hi,
> > >
> > > I need to capture a screen snapshot in Linux. PIL has a module
> > > IageGrab, but in the free version it only works under Windows. Is
> > > there any package to capture the screen on Linux?
> >
> > xwd comes with the X server.  man xwd
> >
> > Most useful is "xwd -root" or similar.  You may want "sleep 5; xwd
> > -root" to give you some time to set things up as needed, or map it to a
> > window manager keybinding.
>
> The problem with that is that xwd format is a non-standard format, and
> *uncompressed* on top of that. If he wants to distribute the image to
> friends, or whatever, he'll have to convert it to something like png
> anyway. If he's using Linux, he probably doesn't need to use xwd
> anyway and might as well save himself the effort (and HD space) now.
>
> -- Theerasak
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


A py2exe like tool for Linux

2006-10-24 Thread Paolo Pantaleo
Hi,

is thre something like py2exe for Linux? I don't need to build a
standalone executable (most Linuxes have python instaled), but at
least I need to provide all the needed libraries togheter with my
source code, so users just need to download one file, and not several
libraries.

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Building C extensions

2006-11-06 Thread Paolo Pantaleo
Well I'm just courious: if I want to buid a C extension, I shoul use
the same compiler that has been used to build python (right?). Since
python has been built using Visual C, how can I build an extension if
I don't have Visual Studio?

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting backtrace on an axception

2006-06-10 Thread Paolo Pantaleo
So I have this code

try:
do something
except:
 do something else

In the except block I need to print detailed output about the error
occured, and in particular I need to read the backtrace for the line
that raised the exception [then modify and print it]. I know about the
exception.extract_tb() and friends, but I can't figure out how they
works.

Can somebody exlpain me?

Thnx
PAolo


-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Specifing arguments type for a function

2006-06-20 Thread Paolo Pantaleo
I have a function

def f(the_arg):
...

and I want to state that the_arg must be only of a certain type
(actually a list). Is there a way to do that?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python - regex handling

2006-07-04 Thread Paolo Pantaleo
2006/7/4, bruce <[EMAIL PROTECTED]>:
> hi...
>
> does python provide regex handling similar to perl. can't find anything in
> the docs i've seen to indicate it does...
>
> -bruce
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
http://python.org/doc/2.4.1/lib/module-re.html

Here is the documentation about re, I think that if you spend an hour
or two reading it, you will know about everything you need.

Paolo

-- 
If you like Python as I do, you can find useful my little Python resource center
http://ppp3.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Python & chess

2006-08-24 Thread Paolo Pantaleo
Well Python is not a good language for writing a chess engine (even if
a chess engine exists:
http://www.kolumbus.fi/jyrki.alakuijala/pychess.html), but it could be
grat for chess interfaces, for drawing boards, and similar things. I
foudn out a library for these things
(http://www.alcyone.com/software/chess/). Does anyone konw about more
chess related modules?

Thnx
PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: avoiding file corruption

2006-08-27 Thread Paolo Pantaleo
27 Aug 2006 00:44:33 -0700, Amir  Michail <[EMAIL PROTECTED]>:
> Hi,
>
> Trying to open a file for writing that is already open for writing
> should result in an exception.
>
> It's all too easy to accidentally open a shelve for writing twice and
> this can lead to hard to track down database corruption errors.
>
> Amir
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Even if it could be strange, the OS usually allow you to open a file
twice, that's up to the programmer to ensure the consistency of the
operations.

PAolo



-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python daemon process

2006-08-27 Thread Paolo Pantaleo
2006/8/26, Thomas Dybdahl Ahle <[EMAIL PROTECTED]>:
> Hi, I'm writing a program, using popen4(gnuchess),
> The problem is, that gnuchess keeps running after program exit.
>
> I know about the atexit module, but in java, you could make a process a
> daemon process, and it would only run as long as the real processes ran. I
> think this is a better way to stop gnuchess, as you are 100% sure, that
> it'll stop.
>
> Can you do this with popen?
>
> --
> Thomas
> --
> http://mail.python.org/mailman/listinfo/python-list
>
You could send the quit (or close or wahtever) command to gnuchess
when you want it to terminate. Supposing that gnuchess needs to do
some stuff on exit, this is a better solution.

PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing Video conference software for Windows

2006-09-19 Thread Paolo Pantaleo
Hi,

I need to write a software that allow to see the desktop and hear the
microphone capture of a remote PC across a network. I need to do that
for a unviresity assignement. The software must  run on Windows. Since
I like Python very much I am thinking to write that software in
Python. Do you thinkit is a good choice? Are there libraries for audio
compression (OGG or MP3 or maybe GSM or something like realaudio) and
video compression (btw what can be some good libraries to transmit
images of a desktop in a bandwidth-efficent way?). What about capture
of audio and screen? (Probably i will need some Win32 system call,
there are bindings in Python, aren't they?)

If I needed to write some Python modules in C, would it be difficult?

Can some language like C# or C++ may be better?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing Video conference software for Windows

2006-09-21 Thread Paolo Pantaleo
19 Sep 2006 09:42:51 -0700, Jordan <[EMAIL PROTECTED]>:
> If you're going to need win32 system access use the win32all python
> extension (very, very good extension).  Do you need single frame image
> capture, or constant video stream? PIL can be used for the first, it
> might also be usable for video, I'm not sure.
Well I need something like 5-10 fps. An issue is the comression
method: MPEG and friends aren't good (I think) for compressing stuff
with sharp borders. Maybe I could use A sequence of PNG images, but it
isn't a great solution.

For sound, python comes
> with some built in libraries, but you should also take a look at
> pysonic http://www.cs.unc.edu/Research/assist/developer.shtml.  For the
> bandwidth efficiency issue, what type of connection are you using? The
> socket module is quite capable of transmiting whatever data you have,
> so unless you're thinking of implementing some mini bittorrent like
> network in an attempt to save bandwidth I don't know what you can do
> about that. There's an extension called IPqueue which might give you
> somewhere to start for packet/bandwidth manipulation.  Check out The
> Vaults of Parnassus, which has a lot of stuff (including ogg/mp3
> converters last time a check).Big question, is this supposed to act
> like a remote desktop, or just show what's happening?  Start by
> searching Google, it's very useful.
Well the bandwidth issue is most of all related to  video compression
(see above). Well maybe 256 kbps would be nice.

It should just show what's happening.


PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing Video conference software for Windows

2006-09-22 Thread Paolo Pantaleo
Thnx everybody for the precious help :)

Someone said about VNC... I'll take a look, but since it is an
exercise I need to do it, I can't just say someone else arelady did
that :)

Everything seems quite useful. I forgot two specifications:

1. Screen should be split in small squares and only the changing
squares must be transmitted (Ok it shouldn't be too difficult)

2. The comunication must be in multicast

I will spend some time testing the resources.

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing Video conference software for Windows

2006-09-22 Thread Paolo Pantaleo
2006/9/22, Paolo Pantaleo <[EMAIL PROTECTED]>:
> Thnx everybody for the precious help :)
>
> Someone said about VNC... I'll take a look, but since it is an
> exercise I need to do it, I can't just say someone else arelady did
> that :)
>
> Everything seems quite useful. I forgot two specifications:
>
> 1. Screen should be split in small squares and only the changing
> squares must be transmitted (Ok it shouldn't be too difficult)
>
> 2. The comunication must be in multicast

Twisted supports multicast ( example
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425975)

>
> I will spend some time testing the resources.
>
> PAolo
>


-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


VIdeo Converence Software: Tk and thread synchronization

2006-10-02 Thread Paolo Pantaleo
Hi,

I am going on writing my video conference software. I wrote the video
grab, code/decode, and netwoark (multicast) transport.

I have one thread doing this:

[thread 1]
while True:
  for some times:
my_socket.recv() #blocking here
store data
  compute image #here we have a complete new image to display

Now, I was thinking to display the image in a  Tk window. But I think
i will need a separate thread to run the mainloop() [thread 2], right?
 How can I signale to the Tk thread that a new image is ready to be
shown? I was thinkin on using an event generated for the first
(network) thread. But I don't know how to do it exactly. Any
suggestion, please?

What if I access to Tk object form thread 1, is Tk thread safe?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Tk: filling a frame with a widget

2006-10-04 Thread Paolo Pantaleo
I have this code

from Tkinter import *

root=Tk()
Button(root).pack(fill=BOTH)
root.mainloop()

I would expect the button filling all the client draw area of the
Frame, but when I resize the root window the button becomes wider, but
not higher ( I get some empty space under the button). How could set
the button to fill always all the space available?

Well maybe some other solution exists, since my problem is this:

I have a resizable window and i want to keep it filled with a Canvas
displaying an image (PhotoImage). Can I get the in some way the size
of the clien draw area of the window containig the canvas?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Wrong exist status for os.system, os.poepen, etc.

2007-03-06 Thread Paolo Pantaleo
Subject: python2.4: Wrong exist status for os.system, os.poepen, etc.
Package: python2.4
Version: 2.4.4-2
Severity: normal



-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (800, 'testing'), (70, 'stable'), (60, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-k7
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)

I send this to python-list also, so someone can tell if he/she can
(not) reproduce
the same behavior

The os.system() (but all the other funciont with similar behavior) reports
wrong exit status. I can reproduce the bug in the following way

create /tmp/x.c:

#include 

int main(void){
exit(20);
}

$ cd /tmp
$ make x

$./x
$echo $?
20

$ python

give the following commands:

>>> import os
>>> os.system("/tmp/x")
5120

the same for

>>> x=os.popen("/tmp/x")
>>> x.read()
''
>>> x.close()
5120


Greetings
PAolo



Versions of packages python2.4 depends on:
ii  libbz2-1.0  1.0.3-6  high-quality block-sorting file co
ii  libc6   2.3.6.ds1-10 GNU C Library: Shared libraries
ii  libdb4.44.4.20-8 Berkeley v4.4 Database Libraries [
ii  libncursesw55.5-5Shared libraries for terminal hand
ii  libreadline55.2-2GNU readline and history libraries
ii  libssl0.9.8 0.9.8c-4 SSL shared libraries
ii  mime-support3.39-1   MIME files 'mime.types' & 'mailcap
ii  python2.4-minimal   2.4.4-2  A minimal subset of the Python lan

python2.4 recommends no packages.

-- no debconf information
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list example

2006-04-23 Thread Paolo Pantaleo
2006/4/22, Edward Elliott <[EMAIL PROTECTED]>:
> No substantive problems.  The str() calls are unnecessary, print calls
> list.__str__ already.  You can replace the loop with list comprehensions or
> slices.  Same result, a bit more succinct.  See these pages for more:
>
> http://docs.python.org/lib/typesseq.html
> http://docs.python.org/tut/node7.html  (section 5.1.4)
>
>

Thnx, I didn't catch the use of colon in print...

Thanks to the other posting, but actually I want to write some code
that one can modify to his own needings

PAolo
-- 
http://mail.python.org/mailman/listinfo/python-list


test assignmet problem

2006-04-23 Thread Paolo Pantaleo
So I tried this

if(not (attr=global_re.match(line)) ):
break

it says  invalid syntax [on the =]
so it is not possible to do test and assignment in C style?
how can I write this otherwise?

Thnx
PAolo
--
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: test assignmet problem

2006-04-24 Thread Paolo Pantaleo
2006/4/23, Paul McGuire <[EMAIL PROTECTED]>:
>
> "Paolo Pantaleo" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> So I tried this
>
> if(not (attr=global_re.match(line)) ):
> break
>
> it says  invalid syntax [on the =]
>   ... because this syntax is not valid ...
>
> so it is not possible to do test and assignment in C style?
>   ... no it's not, see
> http://www.python.org/doc/faq/general/#why-can-t-i-use-an-assignment-in-an-expression
>
> how can I write this otherwise?
>   ... is this so bad?...
>
> attr=global_re.match(line)
> if not attr:
> break
>
>   ... or, since you don't seem to be doing much with attr, you could just do
>
> if not global_re.match(line):
> break
>
>   ... and get rid of all those distracting ()'s!
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Thnx for the help,
actually the problme is not solved

i have [well I want to do...] something like:

if a=b():
   do stuff with a
else if a=c():
   do stuff with b
else:
   do other stuff

well, two solutions are

a1=b()
a2=c()

if a1:
   do stuff with a1
else if a2:
   do stuff with a2
else:
   do other stuff


the other is


if b():
   a=b()
   do stuff with a
else if c():
   a=c()
   do stuff with b
else:
   do other stuff

Even if none is exactly the same about:
 * the number of times the b() and c() functions are executed
 * the final value of a

I think the right one is:

a=b()
if a:
   do stuff with a
else:
   a=c()
   if a=c():
   do stuff with b
   else:
do other stuff


PAolo
--
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Includeing Python in text files

2006-05-22 Thread Paolo Pantaleo
I am working on this:

I have  a text file, containig certain section in the form


I parse the text file and substitute the python code with its result
[redirecting sys.stdin to a StringIO]. It something like php or
embedded perl.

So my little toy works not bad, but I was wondering if such a feature
already existed, if yes, can you point me out some links?

Thnx
PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Includeing Python in text files

2006-05-23 Thread Paolo Pantaleo
2006/5/23, Chris Smith <[EMAIL PROTECTED]>:
> Diez B. Roggisch wrote:
> > Paolo Pantaleo wrote:
> >
> >
> >>I am working on this:
> >>
> >>I have  a text file, containig certain section in the form
> >> >>  python code here
> >>py?>
> >>
> >>I parse the text file and substitute the python code with its result
> >>[redirecting sys.stdin to a StringIO]. It something like php or
> >>embedded perl.
> >>
> >>So my little toy works not bad, but I was wondering if such a feature
> >>already existed, if yes, can you point me out some links?
> >
> >
> > Its a templating system, and there are a gazillion out there. Some of them
> > are listed here:
> >
> > http://www.cherrypy.org/wiki/ChoosingATemplatingLanguage
> >
> >
> > Diez
> >
> >
> >
> I'm just getting into programming so this may be a dumb question...but
> why would you want to do this? What is templating good for?
>
> Chris
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Well php is base on this principle, most (server side) dynamic sites
are based on some template sistem

PAolo

-- 
if you have a minute to spend please visit my photogrphy site:
http://mypic.co.nr
-- 
http://mail.python.org/mailman/listinfo/python-list


Request for comment: programmer starting page (micro knowledge base)

2006-05-24 Thread Paolo Pantaleo
I am writting down a pege with useful links for a Python programmer.
That is reference, tutorials and anything that can be useful. I use it
regulary when programming in Python and I can't do without it.

I would be happy if you go and see that page, and tell me what you
think about and suggest links to be added.

The page is : http://ppp3.co.nr

Thnx
Paolo Pantaleo
-- 
http://mail.python.org/mailman/listinfo/python-list