@# 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 18 19 20



Comments:

<0> my mom would have prepared breakfast, lunch & dinner.
<1> as if anyone goes to NJ for anything
<0> teratorn: if you want the best you know where to go.
<0> NJ baby..
<1> pleeeease
<2> wow that's a little pricy
<1> I'm reminded of the Daily Show segment on NJ
<3> Mirno: not much farther for you than for me.
<3> and I'm flying over Frankfurt.
<3> But I would've preferred Washington, I know more people there ;P
<4> Yhg1s: you'" actually in an airplane ?
<0> too stupid to go to pycon, i think I'll wait.
<5> teratorn: I like the "Better Know a District" clips on the Colbert Report..
<6> The "I am" form in English can also be used to express intent.
<4> :)
<1> dijix: yeah that's some funny **** :)



<3> Mirno: I what in an airplane?
<3> oh, Erwin already explained :)
<7> hey y'all. i have a question about the distinction between the borg and singleton patterns
<6> Those auxiliary verbs in English are strange.
<8> thebanana: neither are relevent in python
<7> it's really about the 'null object'
<8> thebanana: a module is a singleton.
<7> i'm talking specifically about the recipes in the cookbook
<8> thebanana: yeah, they're full of ****.
<8> thebanana: mostly people trying to apply design patterns that are irrelevent.
<7> ok - so how would you prevent more than one instance of a cl***
<8> thebanana: easy
<8> cl*** MyCl***: p***
<8> MyCl*** = MyCl***()
<8> done
<4> Yhg1s: nevermind, I miss understood .. sorry my english is so bad.
<9> http://deadbeefbabe.org/paste/2845
<8> thebanana: OR! not have a cl*** at all. just a module with a bunch of functions and global variables.
<7> jerub: so further instances of MyCl*** are callable?
<9> can someone hint on the 'if' statement optimization
<9> please
<8> thebanana: why would they need to be callable? if you call it, you'll get an error.
<7> jerub: i have a distinct need for a null object
<8> thebanana: you mean 'None' ?
<7> no - i mean a null object
<7> because it has to be callable
<9> can "if 25 > some_large_int" be more optimized for speed?
<8> thebanana: why does it need to be callable? why would that make sense?
<7> and it has to have any attribute callable
<8> citrus: use psyco.
<8> thebanana: I don't see why
<8> thebanana: give me a use-case.
<9> psyco?
<3> citrus: well, 'if min(25, h) > searchnode.g' is a simple speedup.
<3> but how expensive is a comparison with searchnode.g? Is it a property that is computed on lookup? a very big long?
<8> thebanana: don't message me
<7> jerub: you seem to be angry today
<9> it's a large int
<3> citrus: as in, a long? a very big long? Or just an int?
<9> if i remove that 'if' my code runs 2x faster, but it's less accurate
<7> anyone else - i have a cl*** and i'd like to prevent more than one instance being created
<3> thebanana: MyInstance = MyCl***(), then use MyInstance always.
<3> thebanana: you can do 'del MyCl***' after, if you want. Or! even more revolutionary, you can just do 'MyCl*** = MyCl***()', and use MyCl*** as if it were an instance.
<7> yhg1s - thank you
<3> (which it is.)
<5> thebanana: http://www.bigbold.com/snippets/posts/show/651
<3> Jerub: people crack me up. Were they always this funny?
<8> thebanana: I'm considering taking a hiatus from #python, I'm getting too agro.
<8> Yhg1s: yes, they were.
<3> citrus: actually, from reading your code, it looks like h is never more than 25, so just doing 'if h > searchnode.g' should be enough.
<7> jerub: sorry for being so stupid - really not trying to piss anyone off
<3> citrus: 'g = searchnode.g; if h > g: return g' can also be faster (it depends on the speed of 'searchnode.g')
<8> thebanana: it's not you being stupid, it's just other languages poisoning my pond.
<3> citrus: and, considering the next line is 'return h', you can just do 'return min(h, searchnode.g)'
<5> thebanana: you'll find that this community is quite friendly and helpful.. everyone starts out at the bottom and we're here to help.
<9> yeh
<10> anyone happens to know how to import gksu bindings?
<9> my Astar implementation is only 4x faster than Breadth First Search... i think the bottle neck in the improper heuristic function
<9> ok
<9> thanks Yhg1s
<11> citrus: depending on the problem space, 4x isn't that bad.



<3> citrus: a quick measurement suggests that comparing an int to a very big long is not any slower than comparing an int to a small long.
<7> dijix: thanks - that's what i've found so far
<9> it's an 3x3 - 8puzzle game, ... shifting the empty tile around to reach 1-8, blank configuration
<9> ok
<3> citrus: comparing to an int is faster, though (since it can be done in native C, rather than through the Python long code.)
<9> i've done as much optimization as possible and it yeilds very small margin of speed increase, the bottle neck is in logic
<7> jerub: i actually started out using None instead of that overkill Null Object
<7> jerub: what i really want to be able to do is subcl*** None
<7> jerub: but i can't :)
<6> thebanana: As code usually checks for foo is None, that wouldn't be a good idea
<7> erwin: i know it usually is a bad idea - i think i did find a use case for it though
<3> I doubt it.
<3> the sole usefulness of None is that it is unique. A subcl*** wouldn't be useful.
<7> this is where the lispers would say "in lisp, you could do it"
<3> a separate sentinal cl***, perhaps.
<3> you can achieve the same effect (for instance, 'Null = object()'), but not by subcl***ing None.
<7> yhg1s: in the end, that's what i've done (and effectively what the Null Object recipe is trying to do)
<12> hi all
<3> creating your own sentinel has its uses. Don't call it 'Null' though, give it a name to indicate what it's a sentinel *for*.
<12> how can i read console input in python?
<3> and a comment explaining why None won't do.
<5> thebanana: why do you want to do that? what's the end result you're trying to accomplish?.. just make sure you're not trying to do something that may be appropriate in another language, but just doesn't translate to python..
<3> mansu: raw_input(), sys.stdin.read*()
<3> mansu: if you want more control: the readline module (in conjunction with raw_input() and sys.stdin.readline()) or the curses module (for complex console applications.)
<7> yhg1s: what is a sentinel cl***
<3> thebanana: None, for instance.
<7> yhg1s: my cl*** is called Nothing
<12> thx Yhg1s
<3> thebanana: well, what does it do? When do you use it, and why can't you use None?
<7> it does nothing
<3> then it's useless, and a resource hog. throw it out.
<7> it lets you call any attribute on it
<3> aah, you want the PHP/Perl 'undef' behaviour. Ugh. I suggest you get used to not having it, instead. Defensive coding, and all that.
<13> What is that?
<7> i have several variants/flavours/subcl***es of a base cl***
<7> they all implement a specific api
<7> but one of the variants is something that does nothing at all
<3> write it out.
<7> i don't want to have boilerplate code that does try: except: everywhere just because attributes are missing
<7> from None
<13> Yhg1s: What is Perl style "undef" behaviour?
<13> thebanana: Why would there be missing attributes?
<3> Arafangion: unless you turn on 'strict' code, you can use it however you like, and the result of the operation is 'undef'
<7> because None.somemethod() doesn't exist
<3> thebanana: implement the cl***, give it the methods it needs but have them do nothing. With your Null cl***, you pretend to have methods it doesn't have, which is going to bite you in the *** eventually.
<13> Yhg1s: You'll have to elaborate, the most perl I've done so far is the first 3 chapters of (whatever the recommended online perl book is), and always with strict on.
<3> thebanana: or let the basecl*** have all the methods, but empty.
<7> no diff in my case then
<7> rather - i don't see how that's much better than the Nothing cl***
<3> Arafangion: I'd rather not. I hate perl, and the braindead undef behaviour in particular.
<3> thebanana: I already explained, but nevermind.
<3> I'm off to bed.
<14> thebanana: "import this". explicit is better than implicit, errors should not p*** silently unless expilcitely silenced, etc
<13> Yhg1s: G'night.
<7> yhg1s: thanks for the debate
<5> thebanana: here's some seriously good info.. http://www.aleax.it/5ep.html
<7> dijix: thanks - i'm aware of that one
<7> dijix: it's not quite what i'm intending though
<5> good reference on a number of approaches..
<7> dijix: i'm not realy going for singleton or borg - i just want to prevent using up memory every time i instantiate Nothing
<5> what exactly are you intending?.. I don't think I ever caught that
<15> good night
<5> so you want to make sure every Nothing is the same single Nothing..
<7> dijix: yep - and it looks like jerub's Nothing = Nothing() does the trick
<5> thebanana: and what was the reason for not just using None?
<7> dijix: because None has no attributes
<7> dijix: and i need it to have any attribute
<5> so the "nothing"'s not really nothing?
<5> so then, I mean
<7> dijix: Nothing's kind of Everything in this case :)
<14> Swallowing all errors (as your Nothing does) will make it harder to debug. The more places you use it the worse it becomes
<7> all, i really have good reasons for this
<7> i know it sounds bad on the surface
<5> thebanana: yea.. go below the surface.. what's the good reason? heh


Name:

Comments:

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






Return to #python
or
Go to some related logs:

Pupyy Linux
sistem32 tools
suse pwnz
#css
lightdifference
#linux
#physics
execvp permission denied init.d
ubuntu + no windows manager
pdb2csv error



Home  |  disclaimer  |  contact  |  submit quotes