@# 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



Comments:

<0> all
<0> which lexer/parser in python can read data from streams?
<1> what good python IDEs are there with built-in "code sense" (shows suggestions of methods/APIs) ?
<1> I'm on os x.
<2> hakanw: does http://spyced.blogspot.com/2005/09/review-of-6-python-ides.html help?
<3> how do I unpack a tuple that maps onto variables in a function call
<3> eg (a,b,c) -> myfunc(a, b, c)
<3> I thought the syntax was myfunc(*(a,b,c))
<1> ChrisH: looks like just the article I need; thanks!
<4> python has that compact 'if' form like c's (bla ? bla : bla) ?
<3> cadu: python does not have a ternary operator
<5> cadu: Not untill next release
<4> oh okay, thanks
<4> odl: it'll have it on the next? (proposed?)
<5> cadu: http://www.python.org/peps/pep-0308.html
<1> did I dream this, or will python also support an "unless" keyword?



<6> hakanw: i hope you dreamed it :)
<4> odl: thanks :)
<1> I thought I read some python article about it. hrm.
<7> i saw that too. if it isn't a PEP, it's probably just wishful thinking
<8> http://pastebin.com/578228 ... can someone see anything wrong with that fn?
<4> odl: liked the cond() builtin
<9> Please, feel free to not keep us in suspense and tell and what problem you're seeing.
<4> odl: easy to be implemented by wrapping an 'if' inside it
<4> odl: :)
<9> Other than the complete and utter lack of error checking, of course.
<10> "unless" is a fugly keyword.
<4> ignacio: why?
<6> unless would be "ok" as long as you're not allowed to do "unless" followed by "else" (because if you do that, you should be shot)
<9> Why what?
<4> ignacio: thought you were talking bout the 'cond()' thing, nevermind :)
<8> >>> import spam
<8> >>> spam.add(12,12)
<8> 0L
<1> nima: did you debug the C code and ensure that the long is actually a number before you return it ?
<6> nima: add some print statements.. what is n, does sum get incremented as you expect inthe loop, etc
<1> it might just be 0 :P
<9> Did you go through chapter 1 of extemb?
<9> Wait, I lie. Chapters 1 and 2.
<7> hari`: i dislike 'unless'. but perl hackers are probably asking for it.
<8> it's not seeing [12,12] as a PyList :/
<6> nima: read the tutorial, but IIRC it will be a tuple, not a list
<6> and you probably want something like PyArg_ParseTuple
<9> Well, you don't need PyArg_ParseTuple if you're willing to traverse the sequence yourself.
<6> it's been > 1 year since i've done embedding stuff though, so i don't know for sure
<9> But stick to the sequence protocol, and make sure you verify the types before you use them.
<9> Even better, use the numeric protocol to add them.
<8> I've started on this embedded stuff today, is there a decent tutorial you recommend mcmillen? ignacio?
<9> And FFS, check for NULL after every operation.
<9> I just went through extemb myself.
<11> hi, coming from a java background, and i have a problem with dynamically receiving variables from a cl*** object some pseudo code is on http://pastebin.com/578241 to clarify what i mean...
<8> i didnt do much error checking because I just wanted to see it work at maximum simplicity, i'll do the error checking as i get my head around it all
<9> Adding error-checking after the fact is a bad habit to get into because you're *going* to miss something afterward.
<6> nima: you may also want to look at something like SWIG or pyrex, which automate a fair amount of the ugly work for you
<9> ekimus_: What are you trying to accomplish with that code?
<6> ekimus_: on line 20, you're calling data.get() not data.getAll()... but in the sample code you have, why don't you just use a dict to store the "variables" instead of an empty cl***?
<6> otherwise, you can use data.__dict__ to get at the underlying dict (ugly) or hasattr(data, 'a') to check if data has a variable named 'a' (less ugly, but still better to actually use a dict instead of an empty cl***)
<9> Avoid using .__dict__ if you can help it.
<12> I have apython script that imports a .glade file for its UI. This only works if I cd to the directory of the script and the .glade file. How the do I make it pwd-insensitive, and how do go about the path to the .glade file if I want to package and install my app on linux?
<9> Have a config file in a fixed place that specifies the path to it, and modify it on build/install.
<12> how can I have it in a fixed place? the user should be able to install to either /usr or /usr/local
<12> or anywhere, really
<9> /etc is a *great* place for config files.
<11> i'm searching for something similiar like getattr(object, name) but instead it should just be getattr(object) and return a list (whatever) of defined vars for that cl***
<12> I want a solution with more magic and less ugly hacks
<12> (sorry)
<9> Just use a dict and save yourself the h***le.
<12> no offense
<9> There is no way to do it without magic.
<6> engla: sys.path[0] will probably help ... you can't rely on it if your app has been frozen with something like py2exe, py2app, or cx_freeze, but it seems like you don't care about that
<9> VMware Server will let you have one.
<6> or, paying $50 on ebay will let you have one :)
<12> mcmillen: what is 'freezing my app'?
<3> hehe, but stil couldnt have it in my office :(



<9> Have it at home and ssh to it.
<3> corporate issues etc
<7> m0no: knoppix
<3> I could do that I suppose
<6> engla: with one of the programs i mentioned, you can make a binary package from your program that doesn't depend on any external libraries or anything. for instance py2exe takes an app, finds all the python libs it imports, adding python.dll and making an .exe that knows how to bootstrap the interpreter (from the included DLL), load the modules, run the main script, etc.
<9> Remember, just because everything in Python is an object doesn't mean that you're restricted to attributes in order to get things done.
<7> m0no: ununtu has a livecd too
<5> cadu: The problem with the cond is that it is not a proper ternary operator. Since both expression will be evaluated.
<6> engla: so it gives a good way to distribute your app for systems that don't usually have python installed (windows and mac)
<7> and both have python 2.4 IIRC
<3> hmmm
<6> cx_freeze can do something similar for linux, but i've never had occasion to use it on linux because most linux boxes have python anyhow
<1> what are you guys' opinions?
<9> I prefer glade and gtk+ myself.
<1> I'd like to build a gui app, quite quickly if possible.
<1> without having to read a book about OO GUI building
<1> (in framework X)
<6> ignacio: do you have a recent tutorial/doc on using glade with pygtk? i found an article on linuxjournal but it's from 2003.
<9> Not really. It hasn't really changed though since then.
<9> Other than the fact that there's now gazpacho.
<6> all right, thanks
<6> ooh, that sounds much more... spanish
<3> can I compare a built in datetime to an mx.DateTime?
<13> Why does the MySQLdb module present the result of a concat function as type "array.array"?
<3> Just say I want to test if a float value is in the range myflaot > 0 and myflaot < infinity
<3> what is the max value of a float?
<9> Something like 4e308 IIRC.
<3> is there some special function that would return this?
<9> You could try looking in fpconst.
<3> hmm - ok thanks
<14> Holitas
<6> m0no: i asked that last night, and after a big flamewar, decided to define cl*** inf: def __lt__(self, other): return False
<6> float('inf') might work on some systems, 1e200*1e200 was suggested otherwise
<15> mcmillen, if __lt__ alsways returns false, then it is useless to ever test for anyFloat < inf.
<15> always
<6> well, you need to define both __kt__ and __gt__
<6> *lt
<6> if you want both 3 < i and i < 3 to work
<6> really i should define __mult__, __add__, etc. as well, but i'm lazy and only needed the comparison in one way
<5> Anyone here have a cherrypy server embedded into a c++ application before? I have some weird results on it..
<6> and now that their server is not down, i will replace my inf cl*** with fpconst ;)
<3> mcmillin: __lt__ ??
<16> any good resource of all built-in functions in python on the internet?
<17> hi all
<17> i'm working on a cl*** that automatically upgrade itself
<6> http://python.org/doc/2.4.2/lib/lib.html
<17> it and upgrade is available
<17> the problem is that windows lock the .exe file build with py2exe
<17> suggestions ?
<18> windows locks all files that are open
<3> mcmillen: thats a nice solution - atm I just got a very big number there!
<17> kosh: it's th porblem
<18> you can not replace an open file in windows, but it has some way of doing upgrades, that is why you have to close the app and it does something when closing down or it does it when it computer boots up
<17> it can't update itself until is running
<17> :-(
<16> mcmillen thank you
<6> O-Zone: write the new file to SomeApp-new.exe, and have your app check if there is a SomeApp-new.exe in the current dir when started... ?
<17> mmmm
<17> i need a simpler way
<17> i'm think to create a separate exe, like upgrade.exe
<17> that replace the original exe
<17> but i need to close parent app
<18> what you need is actually not relevent, windows does not support the simple way in any way
<6> m0no: also look at http://research.warnes.net/projects/RStatServer/fpconst/ for a much more "correct" solution
<18> yeah you need a seperate app that closes the parent app, does the upgrade and then puts it back
<17> yes
<17> exacply
<18> there are even more exotic things you can do to try and make it look more seamless but they are far from trivial
<18> this is one area where unixes are so far in front of windows it is not even funny
<17> yes
<17> i know


Name:

Comments:

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






Return to #python
or
Go to some related logs:

Link-Joey
fink xdebug
2.6.12 snd-usb-audio unknown symbol
ubuntu raid 5 add a hard drive
#php
kill emerge +gentoo
mediawiki hobbs freenode
#linux
#web
gaim local alias



Home  |  disclaimer  |  contact  |  submit quotes