#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 
Top Prev 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 Next

#python

<kosh> pjd: that is why I don't just answer those kinds of questions :)
<kosh> pjd: I might have to maintain the code someday ;)
<JohnQ> what does r"\"foo\"" mean? specifically... whats the r do?
<marienz> JohnQ: change the meaning of backslashes.
<JohnQ> to what end?
<marienz> JohnQ: compare r'\\ \n' to '\\ \n'
<marienz> JohnQ: main use case is for defining regular expressions.
<ogzy> is there a way for adding my python program to cron as a user?
<marienz> ogzy: edit that user's crontab like you would for any other kind of script or executable
<pjd> JohnQ: r makes it a raw string, where backslashes don't escape
<JohnQ> I see
<pjd> r"\"foo\"" is a syntax error; it's equivalent to the string '\\' followed by the source code foo\""
<ehird> as far as 'what i'm trying to do',
<marienz> JohnQ: (point being you rarely want an actual newline in a regexp but you do use backslashes a lot, and having to double all of them is annoying)
<ogzy> marienz: where is that crontab?, in home?
<marienz> pjd: nope :)
<ehird> is that
<marienz> pjd: it does still escape the quote. Try it.
<JohnQ> pjd: it isn'm apparently.
<ehird> optparse doesn't allow 'non-dash' options
<ehird> well, it passes arguments sure
<pjd> marienz: oh, ok
<ehird> but you can't add a callback, etc
<marienz> ogzy: run crontab -e as the relevant user.
<marienz> ogzy: also ##linux or something
<ehird> (where arg = program <command> <options>, <command>)
<ehird> eg
<pjd> ok, so it makes backslashes almost not escape anything :)
<ehird> "myprog self-destruct --quickly"
<JohnQ> wierd.. so the backslash escapes the quote AND appears in the final string... thats just odd.
<ehird> theres no way to define self-destruct with a callback and all that
<ehird> so i'm trying to implement a system myself
<marienz> ehird: that is intentional. Somewhat unfortunate for certain use cases though.
<ehird> marienz: yes
<ehird> and i need that, so i'm making this
<ehird> but, say, if you had 'move':
<ehird> myprog move file1 file2 <opts>
<ehird> you need args passed to it
<marienz> yep.
<ehird> but if you did move file1 file2 file3, the method would choke
<ehird> so i need to give an error.
<marienz> I have a subcommand system myself, but I'm not sure yet if I like how it works.
<Chousuke> hmm
<marienz> ehird: I like to put most of that args parsing in optparse's check_values.
<marienz> ehird: verifying args there and stashing them on the values object, so that code using the parser only has to use the values object and can ignore the remaining positional args tuple
<Kjartan> What is ment by: IndentationError: unindent does not match any outer indentation level - ?
<ekimus> hi, having problems with sockets, http://deadbeefbabe.org/paste/3729 - whenever I shut this down with ctrl-c and try to restart i get socket.error Address already in use, but i don't get why according to the docs i thought socket.close() shut just do that. anyone could have a short look at this?
<marienz> oh, hey Kjartan
<marienz> Kjartan: that you're using the wrong editor :P
<Kjartan> marienz, I'm using VIM ^_^

Previous Page  Next Page

Search ircarchive.info