| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<0> i mean when next() has no more items to return <1> I mean, for good 3D graphics, Physics engine, database, data sharing, and all that would take some memory out of a computer. and I've read python begin slower(up to 10x) than C progs.. <2> bretth oops, I mean \W (you said NOT a word) <3> Zalamander: No, a specific phrase, I technically want to match anything BUT </a> <4> Yango: when next has nothing more to return it also throws some exception. the for loop catches that <1> bretth use exceptions? <4> Naerey: Python is easily 10 to 100x slower when doing math heavy code, so don't do that. <3> Naerey: ? <2> bretth I guess I'd generally do that by matching up to the </a> <0> ok, so If I catch an index error outside a for loop (try: for .... except IndexError, e: ) it means the IndexError occurred within the for? <1> Erwin, well, physics engines do a lot of math, don't they? <5> they only do math <3> Zalamander: I would, but I have an </a>'s later on... so it matches up to the last one <5> Naerey - look at how EVE online goes about it <2> bretth use *? to make the * non-greedy <5> most if not all of the game logic is in python, but the graphics /physics / sound engine is in tight C/C++ code the python calls into
<4> Naerey: Many 3D games are written partly in Python. Typically PYthon does the higher-level stuff and behaviour, while the C++ code does physics, screen update <2> bretth (though I"m surprised to hear that BeautifulSoup doesn't work for HTML that contains javascript) <4> Naerey: As prencher said, EVE -- Severance: Blade of Darkness is another. Civilisation 4 is yet another <3> Zalamander: It doesn't "Just contain" JS, the HTML is a JS string, so it's all escapes and such <0> yeah, I did once the scripting for a game we and some friends did in python. it was cool seeing those avatars running around due to python's code :) <2> bretth I see <1> Erwin, yes I was guessing as I haven't found any python physic engine <1> Erwin Civ4 written in python? <4> Naerey: There's no silver bullet language, Python development is fast but it's dynamically typed so it is generally less performant <6> is there a suppressions file for running python under valgrind? <7> is there like a lambda, but for cl***es? :P <4> Naerey: Yes, large parts of Civ4 are Python. <4> eleusis: well, you can call type() to create a new cl***, but why would you? <7> hmmm <4> cout: Yes, I've seen one around <7> i want something like a tuple, but where i can do var.name to access a value in it, instead of var[index] <8> Erwin: but code written in python is sometimes than code written in c <1> compiling a program is supposed to make it run faster, right? <7> heh <8> Erwin: see the python-dev mailinglist, armin rigo has made several posts about this topic <4> xorAxAx: So what? <4> Naerey: Compiling a program is supposed to make it *run at all* <4> Naerey: If the language needs to be compiled. <1> but if I write code in a file, save it .py, then python it, it has to compile before running,right? <4> eleusis: Just make a tuple where you override __getattrib__ <4> Naerey: It's not the same "compile" as what a C compiler does. <1> ok <7> hmmm <7> getattrib, eh <4> eleusis: __getattr__ actually <4> eleusis: I ***ume you want to access them as a tuple *AND* as attributes <7> or would it be __getattribute__ <7> Erwin: not really sure about that yet.. i'm just exploring the possibilities :) <4> eleusis: inherit from tuple (or list, that makes it easier). Take as argument a list of names in the order they map to the members. In __getattr__, do basically: self[self.names.index(name)] <7> hmm <4> eleusis: Or read the cookbook -- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303770 <7> cheers <9> hi <7> hey <7> hmm :) <6> hmm, all of a sudden I can't make it crash <6> :q <10> hi <0> do any of you know how can I catch any PsycoPg exception? <10> I want to access foo.b from foo.bar.a <10> so in foo/bar.py I did 'import foo' <10> well wrong snippyt <10> snippet <4> Yango: see pydoc psycopg -- you will see the hierarchy of errors it has <10> I want to access foo.module1 from foo.bar.module2 so I added in foo/bar/module2.py import foo.module1 I set $PYTHONPATH correctly to where foo/ is <4> Yango: Typically you want to catch IntegrityError if doing something like inserting that might cause a PK viloation <10> if on commandline I do import foo.module1 it works <4> guyzmo: did you add __init__.py files to the package directories? <10> if in foo.bar.module2 I do the same, it fails, saying it can't find <10> Erwin - of course <4> guyzmo: run python with -v or -vv -- it willl tell you where it searches <10> ok <0> thanks erwin <10> well, <10> using python interpreter I did : <10> File "emma/core/backend.py", line 11, in ?
<10> import emma.babel as babel <10> ImportError: No module named babel <10> and the line below, I did import emma.babel <10> import emma.babel # directory emma/babel <10> which worked well <10> I'm sure I'm doing something stupid <10> that can't be otherwise <10> but _what_ ? :) <4> maybe you have some circular imports <10> ah <10> that's not impossible <4> So if foo imports bar which again imports foo, then bar won't see stuff defined in foo after the import of bar, because they haven't happened yet <11> Crazy stuff <10> of course <0> easiest way to convert a string "YYYY-MM-DD" into a date object? <10> but always easier to say than to do : <10> :) <4> Yango: time.strptime <10> datetime.strftime wouldn't be better ? <4> strftime convers from a date object into a string <12> hello <10> well, the opposite one, then <10> : <10> :) <11> Yango - I wrote a date cl***, if you're interested <4> _james: What does it do that datetime doesn't ? <11> Nothing <11> Infact, probably less <0> __james I'm good with what's provided in python, thanks a lot. <11> Haha, worth a try... <0> you need testers for your cl***? :) <11> Haha, ehrm... <11> I'm kind of a newbie, and it was good practice to do it by hand? <0> what I get from strptime is a time.struct_time object, how can I convert it to a datetime object? <13> Hi <13> How can i desaturate an image using imagemagick, preferably from the command line? I don't know where to ask, and there are some PIL users around i hope <4> Yango: apply time.mktime to it then use datetime.datetime.fromtimestamp perhaps <0> Erwin: I'm thinking that an easier way is to do dt = datetime.datetime(string.split('-')[0],string.split('-')[1],string.split('-')[2]) <0> probably less safe, though <4> >>> datetime.datetime(*map(int, "2006-05-02".split("-"))) <4> datetime.datetime(2006, 5, 2, 0, 0) <4> If you really want to go that way <0> do you see a big problem with that? i mean if the string isn't properly formatted datetime will raise, just as if I went the whole way around with time and stuff <14> If I want to transfer 6000 separate data values through a socket, is it best to write to the socket one by one, or string all 6000 together and is there a max send limit? <15> the latter <14> is there a max send limit? <9> i'm writing a pop client <15> check the return value, which tells you how much has been sent <4> Hellboy: there's a POP3 library in Python -- poplib <9> yeah <9> i'm using it <9> but a suggest for mail storing? <14> i see <14> nothing is ever simple with networking -.- <4> Hellboy: a pop client doesn't store any emails, it should deliver them to the MDA <9> when the client downloads the mail... i need a list of them <0> well, it can store them locally though, drafts, inboxes and stuff <0> there is a mailbox module for that <9> i'm thinking about a list or a dictonary <16> Alpha: There's not a /limit/ per se. If you're dumping your data into TCP, then you trust it to do what it needs to do. It may fragment your data across packets, which is invisible to you. It may fail to send some of the data, and tell you about it, by return a lower count of sent bytes than you exepct. <9> mailbox is a module for a mailbox access <14> are there protocols out there that simply discard data when the buffer is full? <0> you can write the mails to a mailbox, then access it through that module.. that way you store the messages in a rather standard way (even if there's no such thing as mailbox standard) <17> when I do a for loop, and print out stuff to the screen, it automatically adds a linebreak, how can I prevent that? <9> and for the persistence ? <16> Alpha: UDP might, depending on what you mean by "buffer". <0> the mailbox is in disk <14> i mean the hardware buffer <16> ErikHK: "print" always appends some kind of space. If you add a comma on the end of your expression, it's a space, " ". Else, it's a newline. <16> ErikHK: If you need fine-grained control, use sys.stdout.write() <17> CardinalFang: thank you very much <9> ok thanks <9> i'll try mailbox module <16> Alpha: I don't know about that -- a hardware buffer could only be addressed on the link layer, which is below TCP, and below IP. Perhaps, e.g., on the Ethernet layer.
Return to
#python or Go to some related
logs:
#web #math os dev geus reg emulator
/dev/fuse permissions permanent masnam0x
radeon +xorg +dbms anti vuires Error: Failed to find a running server firefox ismod debian
|
|