#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Top Prev 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 Next
#python
<VladDrac> t: there's positional arguments, i.e. foo(1,2,3) and keyword arguments (func(foo=1, bar=2))
<ZenMasterJG> kbrooks, you don't have to ask to ask, just go ahead and ask ;)
<kbrooks> is there some gui frontend to ... uhh, that web server that lets you provide a file
<kbrooks> i forget the name
<VladDrac> positional are stored in *args, kw in **args
<VladDrac> t: play with it, you'll learn from it, use the following function on an interactive prompt
<VladDrac> def foo(*args, **kwargs):
<VladDrac> print "Positional:", args
<VladDrac> print "Keyword:", kwargs
<VladDrac> and then invoke foo with any random selection of arguments
<kbrooks> the web server is written in python, iirc
<VladDrac> i.e. foo(1, "hello", bar=12, this="that')
<kbrooks> (no, it isnt included in the stdlib)
<VladDrac> kbrooks: firefox? :)
<kbrooks> no
<kbrooks> "web server"
<kbrooks> and its written in PYTHON, NOT C/C++
<ZenMasterJG> kbrooks: donno, theres about a bajillion of theme
<kbrooks> i remember it being on cli magic on linux.com
<ZenMasterJG> an actual web server program, or a framework for building web servers?
<ZenMasterJG> so an actual server
<kbrooks> ah, woof !!
<kbrooks> its cli only, and i havent heard of a gui frontend for it
<sipher> Do the callback functions you pass to retrlines/dir/etc. in ftplib take just a string or what? It doesn't say how the callback should look or what it should return
<kbrooks> sipher: looking
<T`> VladDrac, oh cool.. thanks i get it now :)
<ZenMasterJG> kbrooks: far as I know, theres no frontend for woof, and google doesn't seem to find much. You could always write one yourself
<kbrooks> sipher: it doesnt have to return anything. it accepts a line and does something with it. so that means:
<kbrooks> f = open('file','a')
<kbrooks> ftp.retrlines("LIST", f.writeline)
<kbrooks> # ... will work
<T`> kbrooks, turbogears?
<T`> cherrypy is the server it uses
<alakdan> is it possible to define a variable that is just local to the class and can be called by class' methods but is not part of the class attributes? ie( class MyClass(object): local_to_class = 1; def method(self): print local_to_class ) ?
<sipher> I don't want to write it to disk. Just filter it.
<kbrooks> sipher: that was only an example.
<kbrooks> sipher: adapt as necessary.
<sipher> writeline just takes a string?
<kbrooks> sipher: the callback function passed to retrlines/etc has to take a string, and file.writeline is one of those
<ZenMasterJG> alakdan: like a private variable? no, not really. You can write your own __getattr__ method for the class to make it inaccessable, though
<sipher> Thanks. and it calls the callback for each line then I assume
<T`> VladDrac, i assume it wont make sense to do def foo(a=None, b=None, *arg, **kwargs)?
<T`> VladDrac, hmm it does seem to work.. heh
<kbrooks> sipher: well, not for retrbinary, but for retrlines, yes it does
<sipher> nm. That I can test
<ZenMasterJG> alakdan: or put a _ in front of the name, which means its private, but just by convention
<kbrooks> sipher: just pass it an appropriate command, like "RETR textfile.txt"
<kbrooks> sipher: to get the lines of textfile.txt from the server
<sipher> I'm getting a list of files in a directory, excluding subdurectories
<sipher> dubdirectories*
Previous Page Next Page