@# 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> perhaps you mean []?
<1> MFen: apart from that.. ? ;)
<1> yeah
<0> but it's not clear where you mean {} and where you mean []
<0> maybe you could rewrite the paste using valid syntax
<2> the diff is {} is for constructing a dictionary, [] is therefore an indexing operator of the dict
<0> well clearly some of these things are supposed to be lists
<3> () tuples or calling functions, [] lists or indexing any indexable thing, {} dicts only
<0> i'm pretty sure some of them are supposed to be dicts
<1> MFen: aren't there one-dimensional dicts?
<0> they're different types, with different syntax. it's impossible to evaluate what you want by reading it :)
<3> hds, yeah, they're called lists or tuples ;)



<0> a dict is an ***ociative array. it doesn't have "dimension"
<1> Yango: but i thought the main difference between list and dict is that list has a "direction"
<3> hds, lists store the order of the elements if that's waht you mean
<0> hds: no. a dict is an unordered key:value mapping. a list is an ordered sequence
<1> Yango: yes
<1> MFen: exactly.
<0> the key:value thing is the salient aspect of a dict
<1> ok
<1> so there's no unordered key-only-mapping
<0> hds: you meant a set?
<0> there's no "keys", there's just unique things
<0> but i ***ume that's what you mean anyway
<3> hds, if you want to forget the order of a list you can use random.shuffle
<1> Yango: ok ;)
<0> hds: is that what you want, to scramble the order?
<1> MFen: no, i'm just trying to understand the principles.
<0> hds: well, a list is a sequence, a dict is a mapping. there is no implicit order in the mapping
<0> there is no implicit uniqueness in the sequence
<0> if you want uniqueness without mapping, you want a set
<0> if you want order, you want a list or a tuple
<0> (if you want an ordered mapping, or an ordered unique container, you need to implement it yourself probably)
<1> ok
<3> and you can also explicitly avoid uniqueness in dicts by having lists as values of a dict: { 'my_key': [val1,val2,val3] }
<3> there is an OrderedDict implementation floating somewhere on the net
<4> and regarding 'dimensioned' dicts,
<4> err
<0> Yango: that doesn't mean anything. the key is the only thing in a dict that's unique
<4> you can have nested dicts (E.g., foo['bar']['baz']
<0> OrderedDict is not hard to write
<1> HappyFool: yup, I figured that
<3> MFen, yup, i meant that thinking that a key => value mapping is unique may lead to forget you can store any value in a key, thus ***ociating a key with many 'values'
<5> medev
<3> MFen, but why reimplement it if it's already made :)
<0> hds: this will probably help you. http://python.org/doc/current/tut/tut.html
<0> i suspect you already know how to program another language, which is the target audience. it covers syntax and types
<1> MFen: thx. i got all that. it's the practical problems that appear
<0> (i further suspect you know perl :)
<1> MFen: i even read diveintopython. it's just that sometimes I'm still stuck in thinking in other languages
<0> indeed. well, practice makes perfect
<3> hds i've retaken python like 3 months ago (after a many years break) and still I'm thinking in anything but python
<1> Yango: hrhr
<0> ugh. pygtk sad.
<6> Is it reasonably easy to write a windows service in python and make a windows installer for it?
<0> fairchic: reasonably, yes
<0> there are ample examples on the internets
<6> Hmm, I'll have to look around a little harder, then.
<0> you'll want something like nsis and py2exe for your installer
<6> Ah, ok



<0> as for registering the service, there are a number of ways to do it. pywin32 is one. i think ctypes might have an interface too
<7> many people like InnoSetup as well
<0> inno's not bad.
<6> Good, I was thinking I might have to do this project in .net.
<6> But I was hoping to use python.
<0> python is perfectly fine for writing all kinds of servers and has the tools you need to make a service
<0> i've done it a number of times
<6> It must not be impossible, then :)
<8> It's totally impossible.
<8> MFen just is a mirracle worker.
<8> Like that play.
<0> i will it, and it is so
<0> but i work in mysterious ways
<8> True dat.
<8> For some reason, you live on the left coast.
<8> I can only ***ume it's because you enjoy fresh fish.
<0> there's that, yes.
<8> I knew there was a reason you lived in the land where Terminators roam free.
<3> I have a list of objects. I want to sort it regarding some attr of each object, what can I p*** to the key kwarg to sort or sorted that'll return list_of_objects[idx].attr?
<9> operator.attrgetter('attr')
<3> doesn't that have too many t's ?:) thx
<9> hehe
<9> or lambda x: x.attr
<3> python's amazing, just copied a sql order by snippet working on tuples and indexes and modified it for objects and attributes, and now i can sort any list of objects by any of their attributes!
<10> meh, if -grub- put out the notice, i might give em money
<11> how can i download all files in a open ftp directory
<4> I'd use wget
<10> wget -r
<3> using ftpmodule something like retrlines("LIST",your_callback_which_gets_the_name_and_calls_retrbinary)
<3> ftplib i mean
<12> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474088 <--- this is cool, tail recursion optimization
<13> l
<14> zamba: re watching log files, a Linux soln: http://pyinotify.sourceforge.net
<15> I think I prefer the "dive into python" tutorial than the one on the site.
<16> Alterego: which tutorial is better for you depends on your experience, if you already know how to code then the dive into one is better
<15> kosh, yeah that's probably it.
<15> I prefer guides that go into the details too.
<17> hey, I'm looking for a simple, pythonic xml generator for making Atom feeds. Any suggestions?
<18> def f (n=3, t=5) if i want to p*** the function only the value of t but use the default value of n can i use f(,4)
<19> No, just say f(t=4).
<18> and that wont effect my n?
<19> That will leave n=3.
<15> PersianPower, NO.
<18> thanks
<19> Be sure to only use immutable values for your defaults. ;)
<12> sometimes mutable values can be useful at that capacity.
<3> hari`, what happens with mutable ones and kwargs?
<19> TFK, if you understand the fact that it's like a static variable that you're creating there, then yes, it's useful.
<19> Yango, if you mute the values you receive, future calls will see the muted version.
<12> not there, hmph
<3> hari`, but how would you mute them? only by ***igning them once through normal usage?
<19> Yango, say you sent x={} as the default value. Then inside, you said foo['y']=2. Then called it again without an arg. It would see foo['y'] in the default value.
<20> I'd like my console utility to display a summary table. How can I align the fields to make columns?
<3> hari`, didn't get your example


Name:

Comments:

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






Return to #python
or
Go to some related logs:

#php
#math
#python
freebsd without chsh
#gentoo
#sdl
#python
direct reendering
xmms-mad suse
#css



Home  |  disclaimer  |  contact  |  submit quotes