@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17



Comments:

<0> ahemm, sorry guys, i think i have first think about it once more. :)
<1> what book should I get to learn python
<2> hey! having trouble withj mod_python...getting 411 with POST requests
<3> darkcmd: do you program already?
<4> Hey guys, I'm using a db interface to postgresql, and wondering if there's any better way to reference columns in a returned row result then by index. Preferably some way that is order agnostic thus independent of the percise phrasing of the SQL. Any ideas?
<5> hi all. I'm facing a programmatic problem with a big program I'm developping currently in python (a video editor). The program is an instance of one cl*** (the top-level program cl***) that contains various instances of other cl***es (and themselves recursively contain instances of other cl***es, ...). The question is if anybody has a recommended python way of accessing the top-level object from one of the nested objects. I was currently
<6> darkcmd: If you want a free tutorial, check out http://docs.python.org/tut/tut.html
<5> going on the "p*** self to the contained instances" path, but it gets really ectic after a while. Also I wouldn't really like using a global. Any ideas ?
<3> what the hell
<3> hahah
<4> bilboed, Well is it a singleton?
<2> anyone has some experience with mod_python?
<5> Gambit-, a single instance ? yes
<7> Is there a convenient way to express range('a', 'z') that I'm missing? (because that doens't work)
<4> bilboed, then having it as a global within the module is not particularly frowned upon.
<8> How do I convert a lowbyte and highbyte back into an integer? I learned earlier i%256 = low byte, i/256 = high byte.



<9> Malaprop, string.lowercase
<4> bilboed, you're basically knee-jerk reacting against globals, and it's working against you not for you.
<5> Gambit-, I'm trying to see if there's any other python trick I might have missed
<10> using tarfile, how do I extract the entire contents of a .tar?
<5> Gambit-, but it does make sense, if it's the only instance
<7> Juhaz: I'm looking to create a list that looks like ['a', 'b'... 'z'], not lowercase a string
<11> can someone please take a look at http://rafb.net/paste/results/F5tfoM16.txt ? python fails to compile here
<10> it seems to work fine for files, but for directories is just creates the directory but does not write the contents
<4> bilboed, possibly, I'm not a python wizard, but that's what it strikes me.
<3> jeremy_c: off the top of my head, it looks like hi*256 + lo
<2> IRC soft got closed
<9> Malaprop, that doesn't lowercase a string, it contains all the lowercase letters
<2> anyone has experience with mod_python?
<7> Juhaz: AttributeError: type object 'str' has no attribute 'lowercase'
<8> jtrask: ah. I was thinking I was going to have to convert low also. but your right, doesn't make sense to.
<12> Malaprop: import itertools itertools.imap(chr, xrange(97,123))
<12> hmm too bad he left
<3> jeremy_c: remember that the modulus is the remainder of the other division... so by undoing the division, all you need to do is add the remainder back in
<12> mine will generate that a-z list lazily
<13> how do i print without automatically having a new line
<12> print something,
<14> forsaken: add a comma to the end of the print line
<13> that prints a space in between it tho
<12> import sys sys.stdout.write(something)
<10> import string list(string.letters[:26])
<2> people, am I the first using mod_python here???
<3> im looking to write some image loading code in python that i call through an embedded interpreter (C)
<3> i guess i should probably start by looking at how the py code would be written
<12> jtrask: why not just use the python imaging library?
<3> but i imagine at some point i'd have to hand off the raw image data to the C code? anyone know how to use the api for that?
<3> kosh: great, i likely will. but i still have to get the raw image to C, that's more what im trying to figure out
<15> Goodnight
<12> jtrask: can't you just hand it a string that is the image?
<12> jtrask: python strings are just byte strings so it is exactly what the image is
<16> how do you set an env var using the os module?
<3> kosh: and just use the "s" format string to parse it into the C?
<10> uh, nevermind about that tarfile question
<11> can someone take a look at the link I've pasted?
<17> os.putenv
<11> it seems python doesn't build here
<18> how can access a function variable when i have a string that refernces it like "mystring" = "fff"
<3> systemofadown: not sure here, but does eval("mystring") work?
<12> Yango: http://docs.python.org/lib/os-procinfo.html#l2h-1521
<17> jtrask: PyArg_ParseTuple("s#") ?
<12> jtrask: not sure what you mean by s format string, you should just be able to hand your c program the string
<17> Yango: os.putenv
<3> kosh: the c code needs to know what to parse it into
<3> cubicool: ah yeah, that looks perfect. thanks
<16> thanks everybody
<17> jtrask: the char* you give it shouldn't be malloc'd; you're actually going to be given the same buffer Python uses.
<19> fx = (((x - a)**count)/(fact(count))) * (((-q * math.log(p,math.e))**(count - 1)) * (p**(-q * x)) + (c * (-r)**(count - 1)) * (t + rx)**(-count)) + fx
<19> ZeroDivisionError: 0.0 cannot be raised to a negative power
<19> im getting this error
<19> why?
<17> jtrask: So if you must, strncpy into your own buffer or whatever.
<12> PersianPower: because somewhere in that code a statement is evaluation to 0.0 ** -x
<3> cubicool: alright, thanks
<19> :'(
<9> break it to smaller pieces
<19> ya i think im gonna do that
<13> how do you make a list unique?



<3> hahah
<3> that reminded me of a very lame joke.
<3> how do you catch a unique rabbit?
<20> forsaken: use sets
<12> list(set(list))
<12> list(set(mylist))
<3> unique up on it! ;)
<12> the first one was not obvious but the second one will work just fine
<21> forsaken, this will probably change the order of the elements, though
<22> how do you specify that a subcl*** must define a certain function in python? and what is this called again? i forget all these terms...
<23> make the parent cl*** method raise an exception
<23> that way subcl***es have to override it to not crash
<23> and, in general OO terms, it's called a pure virtual method in the base cl***
<22> ugh - that's an ugly requirement.
<22> i guess that's what happens without static type checking.
<24> why require subcl***es to define anything? That's seems to me to be the ugly requirement
<25> i'm trying to read some sources, and it looks like it's doing the equivalent of: if ("Yes"): or if ("No"):
<25> does python consider "Yes" to be true, and "No" to be false?
<24> SerajewelKS "No"
<26> Why would it?
<21> secureboot, that has little to do with static type checking. The answer is that in Python, you mostly don't.
<25> hrm.. i honestly can't make sense of this code then
<24> SerajewelKS in fact, both "Yes" and "No" are True
<26> I doubt there's any language in existance that would have "Yes" as true.
<25> Zalamander: that's what i thought
<26> err
<26> yeah, I guess Zalamander has a point.
<26> But I meant have "Yes" specifically, for truth.
<25> Zalamander: i'm investigating why cedega says i don't have direct rendering when glxinfo says i do
<26> Not just any non-empty string.
<24> SerajewelKS good question :-)
<25> Zalamander: and it's doing a 'glxinfo | grep | awk' chain, which can only say "Yes" or "No", then it does return foobar[:-1]
<25> Zalamander: presumably to chop the newline, then the calling function does if () on this returned string
<24> well, then that actually WILL return "yes" or "no"
<25> Zalamander: "Yes" or "No" actually
<24> but if ("yes"): doesn't have anything to do with any string returned from any function :-)
<24> ok 'If ("Yes"):' then :-)
<25> Zalamander: so the semantics are different for string variables than constants?
<24> SerajewelKS well, string literals are put in quotes
<25> Zalamander: yes, obviously
<25> Zalamander: i asked about semantics, not syntax
<24> so that statement is just saying: if "this string literal":
<24> the parentheses don't do anything
<25> Zalamander: okay...
<25> Zalamander: that doesn't quite answer my question though
<24> SerajewelKS semantically they are treated identically
<25> Zalamander: good, again that's what i thought
<25> Zalamander: should i pastebin the snippets?
<24> I you like
<24> If*
<25> http://pastebin.ca/42828
<25> the functions are from different files
<24> SerajewelKS gotcha. Well, that code appears to be broken. It should be 'if direct == "Yes"' perhaps
<25> Zalamander: but if both are true... would it not always p*** instead of always fail?
<24> SerajewelKS yes, in the form it is written
<19> my ***ignment reads: "If the values inputed by the user are not valid, then the program should continue prompting the user until appropriate values are entered
<19> how do i do that
<19> can i use a try block?
<25> hmm, that function should work just fine
<24> SerajewelKS right, unless utility_exists is returning false
<25> bah, well glxinfo says i have it so i guess i'll just ignore the warning
<25> Zalamander: thanks for trying though
<24> SerajewelKS np
<24> PersianPower what determines "validity" ?
<19> valid float or integer
<24> PersianPower hm, how about just valid float? ;-)
<24> I think that will include integers just fine
<27> Hi. If I have '1,2,3,,' and I don't want blank the empty string in my list, can I do: [l in a.split(','): a != '']
<19> one variable has to be int the others must be floats
<27> or something like it?
<28> Amadee0_: almost
<28> [l for l in a.split(',') if a]
<28> er


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#python
IOMMU Linux unselectable
realtek drivers 8029 ubuntu
meaning reikon
vfw32 ubuntu
dagmar wrestling
3r2k cfg
#postfix
apache2 site-enable
the inbound port ranges must not have intersection



Home  |  disclaimer  |  contact  |  submit quotes