I originally sent this from an unsubscibed mail address, so it will
probably have been stopped by the new spam filters. Apologies if it
shows up twice.

Will

---------- Forwarded message ----------
From: William Henney <[EMAIL PROTECTED]>
Date: Oct 28, 2006 1:32 PM
Subject: Re: [PyX-user] Pathitems questions
To: kib2 <[EMAIL PROTECTED]>
Cc: [email protected]


Hi Kib2

On 10/28/06, kib2 <[EMAIL PROTECTED]> wrote:
> I wanted to know if I can retrieve all the pathitems of a path class
> instance.

Have you tried the pathitems instance variable. As in

    p = pyx.path.rect(0, 0, 1, 1)
    print p.pathitems

which gives the output

    [<pyx.path.moveto_pt object at 0x121b6c0>, <pyx.path.lineto_pt
object at 0x121b7b0>,
     <pyx.path.lineto_pt object at 0x121b238>, <pyx.path.lineto_pt
object at 0x121b3c8>,
     <pyx.path.closepath object at 0x121a570>]

> Another question : what is the meaning of the "*" in Python syntax (like
> in class path(*pathitems)) ?

*args is just a notation for a list of arguments of arbitrary length.
For example:

###################
def f(*args):
    for i in range(len(args)):
        print "Argument #%i is %s" % (i+1, args[i])
    print ""

f(100, 200)
f("a", "b", "c")
f("one", "two", 99, -1)
####################

will print out

Argument #1 is 100
Argument #2 is 200

Argument #1 is a
Argument #2 is b
Argument #3 is c

Argument #1 is one
Argument #2 is two
Argument #3 is 99
Argument #4 is -1

In other words, you can call path with as many pathitem arguments as you like.

Hope this helps

Will

P.S. You might want to try out some of the books listed at
http://wiki.python.org/moin/IntroductoryBooks
Several are freely available online.



--

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to