| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<0> I saw six related chemistry programs, each program of which was a chapter of a story, and the comments and variables all linked to that story. ****ing pain in the ***. <0> "Go fix DRAGON, it's got a problem in the damsel area." <1> St_George.kill(Dragon) <1> or Dragon.burninate(CountrySide()) <1> ill stop now <2> homestar references are perfectly good variable names <3> have you seen the 'California Coding' c code using precompiler directives? funny stuff :) <3> someone wrote a quicksort but used precompiler directives to replace slang with code. So it had code lines like 'Do some ****, yo' :) <1> diethylamine nice <4> Hey if I wanted a list of strings based on a number how would I do that? Say inputing three will return filename001,filename002,filename003. <0> eugman, [ "filename%03d" %x for x in range(1, 4) ] <1> for i in range(3): print 'filename%03d' % i <4> What does the 03d do? <0> Zero-pads for three total digits. <0> %03d <4> k
<4> thanks <3> hey, that formatting is cool <1> >>> t = lambda num: ['filename%03d' % i for i in range(1, num+1)] <1> >>> t(3) <1> ['filename001', 'filename002', 'filename003'] <0> Gee, it's only been in printf() for over 30 years. ;) <4> lambda? <0> pjarks is getting fancy on you. <0> It's like defining a sort of function right there, to give you your result. <1> lambda allows you to create single line 'anonymouse <1> argh <1> 'anonymous' function <5> hello <6> pythons lambda is weak, but its still nice to have it at all <1> handy for things like sort() <4> Sorry for my ignorance but what is an anonymous function? <6> yeah <6> sort(key=lambda blah blah <1> eugman normally, you define a function with def func_name: ..... <1> triplah key is 2.4 only i think? <6> pjarks: yeah i use 2.4 <6> def add(a,b): <6> return a+b <1> eugman so if you wanted to say, sort a list of tuples by the second element, you could do <6> instead of calling add <6> you can just say <1> def my_sort(a, b): return cmp(a[1], b[1]) <6> lambda a,b:a+b <1> mylist.sort(my_sort) <4> What is the benefit of that? <7> hi everybody. i have a question about doctest. are they the right tool for the test driven development cycle (test, fail, code, p***)? <1> lambda allows you to do mylist.sort(lambda a, b: cmp(a[1], b[1])) <7> i know unittests are <6> eugman: sometimes its stupid to define a function for something trivial. <1> whats a doctest? <4> ah k <5> how hard is it to write internet apps with Python? <5> I'm new to programming and I'm just starting to get into Python, it looks like a really elegant language <1> Maks0n how long is a peice of string? <5> 2 meters <6> ahha <1> good, your not american <5> ;) <1> metres tho <5> oh yeah, oops <1> but we can work with that <3> maks0n: web apps or ip servers? <0> 'you're' <8> pjarks: I resent that! I'm american but I love metric <5> well im just getting into the whole programming and linux thing, its really interesting <1> hari` internet slang :) <5> ip servers <8> ;) <1> Maks0n you can start at CGI level, all the way up to that whole rails thing, through to Zope etc <4> Oh come on String should clearly be measured in furlongs! <5> wow I have no idea what you just said, but hey, I'll get there :D <5> so where are you all from? <4> Stinkin' metrics <1> qwe do they teach metric in schools? <3> maks0n: you can write a web server in python in 7 lines, and call a web service in about 3
<0> pjarks, yes :P <5> cool <4> Metric system is mostly limited to science for common use. <5> I heard there was a webserver written in python, whats the name of it? I just want to have a look at the source for fun <8> pjarks: don't know, but anything that's in base 10 is good in my book <6> Maks0n: short answer, python on the web is not as trivial as php for example <1> Maks0n cgi starts at, #!/usr/bin/env python; print 'Content-type: text/plain'; print; print 'hello!!' <0> Ugh. <4> Qwe how do you go about meauring a third of a meter to cut? <3> triplah, web applications are different than servers <2> Maks0n: there are many webservers written in python <6> diethylamine: indeed <5> a basic one? Just so i can look at some source <1> eugman the same way you measure 2.5 inches <6> doesnt django come wih a webserver? <1> yeah <6> turbogears does for sure <4> But my point is if I want a third of a foot I measure four inches. If you want a thrid of a meter you ned 33.33333333333333333333333333 centimeters. <9> I have a command line like enviroment, and currently the command is ran according to whatever is in the variable "commands", and then it is p***es through a series of if statements, I think the if statements are kind of rediculus since there are a lot of commands, is there another way I could maybe do this" I have tried things like "%s"() % (command), command()...and so forth (I knew these wouldn't work but i had to try). Any suggesti <9> ons? <1> eugman what if i want to cut a 5th of a foot ? <0> Yawgmoth7, dispatch table. <8> eugman: take a stick a meter long and trisect it... voila <9> dispatch table? :o <6> Yawgmoth7: you mean like a switch? <4> The babylonians had it right. Units of 60. <4> heh <1> Yawgmoth7 a mapping of 'commands' to functions <8> eugman: hehe <6> wtf is a dispatch table compared to a switch? <6> oh <6> :) <1> dispatch = { 'add': my_add_func, 'subtract': subtract_func } <9> Then how would they be executed? <1> while not_done: current_cmd = next_command(); dispatch[current_command](arg1, arg2) <9> Hmm <6> nice <2> read up on the Cmd module <1> you might want to extend your dispatch table to include info about how many arguments each 'command' requires etc <2> err, cmd module, with the Cmd cl*** <9> Well..pjarks, it's not exactly like that <9> I mean like <9> helu thar merl <9> But <9> anyways <1> you lost me at helu <9> lol <10> lol <10> :D <9> Sorry, that wasn't part of the code <9> <_< <11> this is a "LOL" free zone <9> Your an lol free zone <9> xD <9> you're* <11> i am a datazone <1> think of the children! <6> type "http//something" in your firefox address bar <6> no semicolon <6> er <6> colon <9> triplah: Cool <9> Let me look at the cmd module <6> you think thats for people who don't know how to type addresses in properly? <1> triplah mine becomes http://http//something <2> so does mine <1> resulting in a proxy error <6> windows? <1> yeah <9> LAME <6> ah <9> Windows <10> Windows?
Return to
#python or Go to some related
logs:
ubuntu sym53c416 dom ischeckbox #perl #css kubuntu permisions svn method not allowed quakenet #web #gentoo #ai bios awd861a
|
|