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



Comments:

<0> kosh: don't you remember SnuggleBunny?
<0> kosh: that was the name of the bot that would redirect users to -cleese and -gilliam
<1> Jerub: ah I forgot about that
<0> kosh: I had it named SnuggleBunny in order to make it phsiycal impossible for people to get irritated at the bot.
<2> hey has anyone used PIL?
<2> http://www.pythonware.com/library/pil/handbook/image.htm
<0> goldentaiji: lots of poeple have.
<2> I'm having trouble with one thing
<2> it's rather simple probably
<2> what's the usage of this
<2> im.putdata(data)
<2> what format is "data" in?
<3> AHAHAHAHAHAH! Stupid me! I forgot to return the data!
<3> Wheee....
<3> Works like a charm
<3> That only took an hour



<2> I know it take can take the value of [1,1,1]
<2> but my format is [[1,1,1],[1,1,1],[1,1,1]...]
<4> woah, thats wierd: print "The sum of %d and %d is: %d" % (7,18,7+18)
<5> hi can anyone recommend a python tutorial for someone with prior programming experience? I need to get start working on it as quickly as possible
<5> i'm going to be mainly doing scientific stuff and working with things like numpy
<3> Check the official one at the Python.org website
<3> It takes an hour or three
<3> but it's good
<5> ok will do, thanks.
<0> yi: diveintopython is good. also, read the numpy tutorial.
<0> yi: diveintopython is quite comprehensive.
<5> my coworker showed me pickling, i'm hooked :)
<3> It's comprehensive, but so very long
<3> pickling is the ownzorz man
<3> Jesus Christ, I misspelled "teh"
<5> integers in python are all longs right?
<3> err
<5> for some reason i thought you could get arbitrary precision ints by default in python
<6> you do
<4> yep
<3> they're all long ints? I never noticed
<3> On the other hand, so far all I've really used is lists of strings
<4> i had to do: from __future__ import division (to change it)
<4> that makes it none integer
<7> My Pyhon book suggests regsub.gsub for global substitutions, but that's deprecated. What's the moderne equivalent?
<8> Rich: re.sub?
<7> Doesn't do what I expect. I want to add a string to the start of each line in a (newline-delimited) string.
<5> wow python.org has a snazzy new website
<5> last time i checked it was quite hideous :)
<7> Something like $text =~ s/^/xxx/mg;
<7> The best I've come up with is >>>text = re.sub(r'^', 'MW: ', text); text = re.sub(r"\n", "\nMW: ", text)<<<
<4> question, if i did this in the line interpeter, will it stay forever? or does it revert back when i leave: from __future__ import division (to change it)
<9> Changes in the interpreter only exist while the interpreter is running.
<8> Rich: x = re.compile(r'^', re.M) then x.sub("xxx", text)
<8> I think
<4> man so much to learn
<4> never even heard of truples or dictionaries before
<6> tuples are immutable lists
<6> dictionaries are key/value datastructtures
<4> i like dictionaries
<4> i can see tons of uses for those
<8> yeah, you could use it for a dictionary :)
<9> Dictionaries are teh hawtness.
<4> store all my variables for players in a game in a dictionary
<4> seems to almost take the place of cl***es like phone.name = "Matt"
<9> You can do both easily enough.
<9> Just override .__setattr__() and .__getattr__().
<4> hmm can you do like player[1][name]
<9> Yes.
<9> Well, player[1]['name'] might be better.
<4> so an array that stores dictionaries?
<9> You can nest Python structures indefinitely.
<4> woah
<4> hmm :)
<9> [{'name': 'ignacio'}, {'name': 'snottyboy'}]
<4> player = ?
<9> Of course, do realize that Python sequences are 0-based.
<4> yea i am
<10> the [] is an expression afaik, so it can be nested just as much as any other expression
<4> not a prob doing 0 -1
<4> can you give me an example of an array dictionary like player[1]['name'] and player[1]['score']



<10> ignacio just did
<9> [{'name': 'ignacio', 'score': 42}]
<4> ah ok, so { } marks the dictionary set in 0 in this case
<10> aye
<9> Right.
<11> console_client = "/usr/bin/centericq"
<11> console_client_pid = os.spawnl(os.P_NOWAIT, console_client)
<9> [] defines a list, () defines a tuple, and {} defines a dictionary.
<11> is there anything wrong with that?
<9> The only tricky part is that you have to use (foo,) to define a 1-element tuple.
<12> () only defines a tuple if there's a comma in there somewhere :-)
<9> No, () is a valid 0-element tuple.
<4> so if i wanted i could do player = [{'name': 'Abe','score': 100},{'name': 'Zed','score': 150}] and call player 1s score with player[0]['score']
<9> Retrieve or set, yes.
<4> ok cool
<4> and what do tupples do?
<9> They're immutable.
<13> they do nothing
<13> except sit there
<4> ? worthless code?
<9> You can't change what's inside them.
<4> hmm so like a constant?
<9> Mostly.
<4> hmm not sure i follow
<9> You can't change the contents, but you can change mutable objects it contains a reference to.
<9> a=(1, [], 2) ; a[1].append(42) ; print a
<9> a[2]=999
<4> you lost me lol, not sure i see the need of trupples
<9> For the most part you don't.
<14> tuples (no 'r') can be used as dictionary keys.
<14> lists cannot.
<9> Right, there's that.
<4> hmm ill just have to test them out
<9> Not that too many people use tuples for keys, of course.
<10> I'm a little fuzzy on when would be the best situation to use a tuple
<0> Hamled: when you want a key
<0> Hamled: lists can't be keys, but tuples containing strings and ints and other immutable things can be keys.
<0> Hamled: also, in situations where you have a list of things, [(username, p***word, realname), ...]
<10> other than that it's not really different from a list?
<10> besides the immutability I mean
<0> Hamled: no, not fundamentally different.
<10> ok
<0> Hamled: generally, any place you need a throwaway sequence of items, you use a tuple.
<10> are lists implemented as linked lists internally in CPython?
<10> Jerub, k
<0> under the hood, they're arrays of pointers
<10> and just allocate x amount more whenever the current list is full?
<0> yeah
<10> k
<15> i constantly recieve a '_Pyarg_NoKeywords' error when using a python script. Can this be fixed?
<16> _trojan_: a particular script or any script?
<0> _trojan_: I've never seen that error before, how are you doing that?
<15> It is using the torque exporter for blender 2.41, python 2.4
<16> oh, that again...
<15> yeah. its ****ing my will to live.
<14> Jerub, Hamled: There's a bit more cleverness in how they're implemented under the hood. Feel free to peruse listobject.c for the details.
<10> ok
<10> would lists and tuples have the same performance if you didn't add to the list?
<0> `anthony: it was a convenient lie.
<10> although I suppose in most cases you don't start out with a list containing exactly what you need :/
<15> any reason why 'import arrays' wouldn't work in an app?
<9> You don't have a module called arrays?
<17> import array # no `s'
<17> http://doc.python.org/lib/module-array.html // using as a mutable string:
<17> a = array.array('c', 'hI there'); a[1] = 'i'; a.append('!'); a += array.array('c','...'); del a[2:4]; print a.tostring() #==> hihere!...
<17> arrays: http://doc.python.org/lib/module-array.html#l2h-1378
<15> I get the same error when trying to import array, 'undefined symbol:_PyArg_NoKeywords'
<15> oddly enough, when i was using ubuntu breezy and set a repository to load dapper's blender 2.41 it worked fine.
<15> is there no help on this?
<15> damn it got quiet. is python unable to handle the script?
<18> How do I kill a thread from within itself?
<18> SYS.exit(1)?


Name:

Comments:

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






Return to #python
or
Go to some related logs:

#math
#css
#perl
sql ES0103
#linux
shadukan
nautilus known_hosts
#perl
endofstring php
Starting Cluster LVM Daemon clvmd could not connect to cluster manager



Home  |  disclaimer  |  contact  |  submit quotes