#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
Top Prev 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 Next
#python
<toma^> pjd: I'm sure about that too, but can't figure out anything better :S
<pjd> maybe you can post a minimal, concrete example
<marienz> would need to see and read a bunch of your code to understand what you're doing before I can give useful advice anyway.
<Ksero> Hmmm... interactive prompt... that might actually be a good use for modifying globals()
<marienz> dunno, I'd consider setting up a custom readline loop for a case like that
<marienz> instead of hacking up globals() and similar tricks to make the standard interactive interpreter closer to what you want it to work like
<pjd> you wouldn't even need globals() for that
<toma^> marienz: I dunno, I've never coded anything like that before. I can only assume that it'd need a damn lot of work to work like python's own prompt
<marienz> nah
<toma^> hmm... tho I guess that I could use some regexp for detecting the creation of new vars and do funky stuff to them and pass the rest to the actual python prompt
<epifanio> this is the octave code : http://rafb.net/p/ppK7eM49.html
<epifanio> while this is the python code : http://rafb.net/p/t1gdEC15.html
<epifanio> until the python-line :
<epifanio> ENglob = zeros((ss,2),float)
<epifanio> everything works fine
<epifanio> but at the "for-statment" i've this error :
<epifanio> http://rafb.net/p/DZw8p346.html
<VladDrac> you know that python requires indenting right?
<marienz> heh
<marienz> epifanio: the code you pastebinned would work. Judging from your pasted traceback you're typing or copy/pasting this into the interactive interpreter and getting the indentation wrong.
<epifanio> yes, i'm tring to use the code by paste the line in the bash
<epifanio> can i use this only in "script mode" ?
<marienz> you can use it in interactive mode, but you have to paste the indentation too.
<marienz> apparently something's eating the indentation.
<epifanio> i do not know how to paste the indentation too :-(
<pjd> how are you pasting it?
<pjd> if you just select all and paste, it should preserve the indentation
<epifanio> now i'm tring, so i can copy oll the statment :
<epifanio> http://rafb.net/p/txijKj39.html
<epifanio> and press enter...?
<ehird> the sqlite binding is broken or something
<ehird> this: --> self.conn.execute('INSERT INTO am VALUES ("version", "%s")' % __version__); <-- doesn't add anything to the db
<ehird> an executescript with some other statemenst works
<ehird> adding a ; doesn't help
<Habbie> uh
<Habbie> don't use %
<Habbie> people will haxor you
<glen_quagmire> i want to make music notation program. how do I draw musical symbols on gui application?
<ehird> they'd have to modify the amlib code, and if they do that they deserve what they get :P
<ehird> but i guess paranoia is a good habit
<epifanio> if i copy and past it, i've :
<epifanio> http://rafb.net/p/L8OOQ859.html
<Habbie> ehird, the right way is ('INSERT INTO am VALUES ("version", "?")' , (__version__,) )
<marienz> there's no reason not to use the proper way of substituting values consistently in codes like that.
<ehird> Habbie: yep
<marienz> code, even.
<ehird> i know how the db api works :P
<marienz> epifanio: you have to insert a blank line above the "print EN2" for the interactive interpreter to figure it out. Not required if you run the script normally.
<koollman> ehird: it's python ... may be able to change the value while the program is running...
<ehird> seems unlikely, but it doesn't add many bytes, so meh
Previous Page Next Page