Re: On-topic: alternate Python implementations
On Sat, 04 Aug 2012 19:24:12 +0100, Mark Lawrence wrote: >On 04/08/2012 11:59, Stefan Behnel wrote: >> Mark Lawrence, 04.08.2012 12:05: >>> I agree so it's off topic and can't be discussed here. Isn't that right, >>> Stefan? >> >> Hmm, in case you are referring to a recent friendly and diplomatic request >> of mine regarding a couple of people who were burdening a public high >> volume mailing list with a purely private back-and-forth chat about having >> beer and getting drunk - then, no, I don't think the discussion in this >> thread qualifies as yet another example for that so far. >> >> Stefan >> >> > >With arrogance like that German by any chance? Hey now, cool it with the passive-aggression. We're here to discuss code, right? If you want to fight it out, you can gladly do it by e-mail. ~Temia -- Invective! Verb your expletive nouns! -- http://mail.python.org/mailman/listinfo/python-list
Re: Eclipse and the Python plugin
On Fri, 3 Aug 2012 06:54:04 -0700 (PDT), rusi wrote: >On Aug 3, 4:34 pm, lipska the kat wrote: >> A while ago someone asked me what I thought of the Eclipse plugin for >> python, well I just downloaded and installed the latest version of >> Eclipse for Java (Juno) followed by the Python plugin. > >Thanks Lipska for reporting back. >I personally find the eclipse UI frightening but I am unwilling to >conclude that its eclipse and not me. > >By comparison, when I first heard of emacs, (about 20 years ago) the >local guru would come in the morning and start emacs then go out for a >smoke. When he came back it had finished started up. >So the acronym: Eight Megabytes And Constantly Swapping made a lot of >sense then. I guess today it would have to be Eight-hundred to make >any sense. > >More to the point, it seems to me that eclipse was today what emacs >was then -- seemingly too large but in time I expect it will not seem >so large. > >So one more request from me: > >Can you try the refactoring support and tell us how it fares? Having used PyDev for Eclipse for a while, I can honestly say its memory consumption, while definitely rather large for the task, isn't so large as to cause any trouble for most modern systems. I'm able to keep it in the background with no notable performance impact, and if I do have to reopen it for whatever reason, it only takes about ten seconds. A small price to pay for easy code completion, docstrings in tooltips, and a more user-friendly debugger (though some things like weakref containers will happily fool it and make debugging a little more difficult). ~Temia -- Invective! Verb your expletive nouns! -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: dbf.py 0.94
On 21 Jul 2012 03:34:44 GMT, Steven D'Aprano wrote: >tl;dr Easy there, tiger. No need to get riled up over a single nitpick over phrasing. ~Temia -- Invective! Verb your expletive nouns! -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: dbf.py 0.94
On Sat, 21 Jul 2012 13:02:55 +1000, Chris Angelico wrote: >On Sat, Jul 21, 2012 at 12:56 PM, Temia Eszteri >wrote: >> On 21 Jul 2012 00:50:13 GMT, Steven D'Aprano >> wrote: >> >>>> Latest version has a simpler, cleaner API, and works on PyPy (and >>>> hopefully the other implementations as well ;), as well as CPython. >>>> >>>> Get your copy at http://python.org/pypi/dbf. >>> >>>I don't generally click on arbitrary links to find out whether or not the >>>link is something that interests me enough to click on it. >> >> Can't really call a cheese shop link arbitrary. It's in the best place >> it could be for providing info about the package. > >True, but Steven's point still stands, that announcements of this >nature are far more readable when they open with a one-sentence >statement of what the package _is_. > >ChrisA If I wanted to counter his whole point, I would've quoted his whole post. ;P Yes, the post to the newsgroup is rather oblique, but the cheese shop is hardly arbitrary. ~Temia -- Invective! Verb your expletive nouns! -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: dbf.py 0.94
On 21 Jul 2012 00:50:13 GMT, Steven D'Aprano wrote: >> Latest version has a simpler, cleaner API, and works on PyPy (and >> hopefully the other implementations as well ;), as well as CPython. >> >> Get your copy at http://python.org/pypi/dbf. > >I don't generally click on arbitrary links to find out whether or not the >link is something that interests me enough to click on it. Can't really call a cheese shop link arbitrary. It's in the best place it could be for providing info about the package. ~Temia -- Invective! Verb your expletive nouns! -- http://mail.python.org/mailman/listinfo/python-list
Writing a wrapper - any tips?
I'm going to be looking into writing a wrapper for the Allegro 5 game development libraries, either with ctypes or Cython. They technically have a basic 1:1 ctypes wrapper currently, but I wanted to make something more pythonic, because it'd be next to impossible to deal with the memory management cleanly in the script itself. Anything I should keep in mind? Any tips to pass on to a first-time module writer, pitfalls to watch out for, etc.? ~Temia P.S. I know another game development library, SDL, was wrapped for Python in the form of Pygame, but I *really* don't like SDL. -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: Question:Programming a game grid ...
On Wed, 27 Jun 2012 19:43:07 -0700 (PDT), alex23 wrote: >There are two ways to help people: by trying to understand what >they're doing, or by submitting them to endless pedantry. Only one of >those is actually helpful. Is it alright if I use that as a quote? Properly attributed, of course. -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: PySerial could not open port COM4: [Error 5] Access is denied - please help
On Wed, 27 Jun 2012 22:18:59 + (UTC), Grant Edwards wrote: >> Can you post a small example showing what you're doing? > >The best way to get help is to write as small a program as possible >that demonstrates the problem, and post it. I'll help you get >started... > >Does this program work? > >import serial >ser = serial.Serial("COM4") >ser.close() > >At the moment, I don't have access to a Windows machine, but I think >the above should run without any errors. If it works, then you've >successfully opened and closed the COM4 port. Start adding >"features", in increments as small as possible, until the program >fails. > >Then try to remove stuff that's not needed while still keeping the >failure. > >IOW, try to find the smallest possible program that fails. > >Usually, in the process of doing that, you'll figure out what you were >doing wrong. If not, post the smallest failing program you can come >up with, and somebody will be able to help. > >If you won't show us what you're doing, we can't tell you what you're >doing wrong. Actually, I believe someone in an earlier thread in the newsgroup or elsewhere pointed out that serial ports automatically open under Windows. I'd have to look it back up when I have the time, which I don't have at the moment, unfortunately. ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: XPlatform ToolKit
On Wed, 27 Jun 2012 23:14:13 +0100, Mark Lawrence wrote: >On 27/06/2012 20:12, php...@gmail.com wrote: >> EnTK (batteries included) http://stk.phpyjs.com/ntk.zip >> EsTK (pilas incluidas) http://stk.phpyjs.com/stk.zip >> >> Reverse Engineer This >> > >sihT No no no, clearly it's sihT reenignE. ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: cmd i/o stream module
[Default] On Wed, 27 Jun 2012 18:37:52 +0530, prakash jp wrote: >Hi All, > >I am interested to interact with the command prompt, is there a module to >control the input/output stream. Thanks in advance for the pointers > >Thanks >Prakash Well, from the start, the sys module gives access to the stdin, stdout, and stderr as file-like objects. I also know that Unix Python users can make use of the curses module. Beyond that, I'm not sure. I'm sure someone more experienced can chip in with specific functionality in Windows, though. ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange threading behaviour
On Thu, 21 Jun 2012 10:12:07 -0700, Temia Eszteri wrote: > >Try appending the dump command with f.flush() and os.fsync(). > >~Temia Actually, wait, no. The behavior you're describing is indicating that the thread in question isn't even getting a chance to execute at all. I'd recommend going with Dave's idea then, see how it pans out. Still, a good set of commands to keep in mind. ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange threading behaviour
On Thu, 21 Jun 2012 16:19:41 +0100, Rotwang wrote: >Hi all, I'm using Python 2.7.2 on Windows 7 and a module I've written is >acting strangely. I can reproduce the behaviour in question with the >following: > >--- begin bugtest.py --- > >import threading, Tkinter, os, pickle > >class savethread(threading.Thread): > def __init__(self, value): > threading.Thread.__init__(self) > self.value = value > def run(self): > print 'Saving:', > with open(os.path.join(os.getcwd(), 'bugfile'), 'wb') as f: > pickle.dump(self.value, f) > print 'saved' > >class myclass(object): > def gui(self): > root = Tkinter.Tk() > root.grid() > def save(event): > savethread(self).start() > root.bind('s', save) > root.wait_window() > >m = myclass() >m.gui() > >--- end bugtest.py --- > > >Here's the problem: suppose I fire up Python and type > > >>> import bugtest > >and then click on the Tk window that spawns and press 's'. Then >'Saving:' gets printed, and an empty file named 'bugfile' appears in my >current working directory. But nothing else happens until I close the Tk >window; as soon as I do so the file is written to and 'saved' gets >printed. If I subsequently type > > >>> bugtest.m.gui() > >and then click on the resulting window and press 's', then 'Saving: >saved' gets printed and the file is written to immediately, exactly as I >would expect. Similarly if I remove the call to m.gui from the module >and just call it myself after importing then it all works fine. But it >seems as if calling the gui within the module itself somehow stops >savethread(self).run from finishing its job while the gui is still alive. > >Can anyone help? Try appending the dump command with f.flush() and os.fsync(). ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: Career related question
On Thu, 7 Jun 2012 22:23:47 +1000, Chris Angelico wrote: >On Thu, Jun 7, 2012 at 7:33 PM, Stanley Lee wrote: >> Hey all, >> >> Can I only post jobs on Python's official website, or can I also >> direct the message to the appropriate mailing list in http://mail.python.org/ >> ? Btw, do I have to be a subscriber of a given list in order to submit >> messages? > >Job postings are frowned upon here on the list; the job board is the >appropriate place (assuming that it's a definitely Python-related >job). You normally have to be subscribed to the list to post, since >responses are usually going to also be on-list; but python-list >cross-communicates with the newsgroup comp.lang.python, so you can be >on either (and there are web-based newsgroup readers too). > >Chris Angelico >From what I've seen, the cross-communication isn't working properly - it's all one-way, and nobody's done anything to look into it yet. Or, failing that, there's just some intercommunication problems between the NNTP servers and the mailing list just samples from multiple sources... ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: CPython 2.7: Weakset data changing size during internal iteration
On 03 Jun 2012 16:20:11 GMT, Steven D'Aprano wrote: >And should I have known this from your initial post? I did discuss the matter with Terry Reedy, actually, but I guess since the newsgroup-to-mailing list mirror is one-way, there's no actual way you could've known. :/ Sigh, another problem out of my hands to deal with. I do apologize for the snippy attitude, if it means anything. >Frankly, I still doubt that your analysis of the problem is correct: > >[quote] >Problem is that for certain high-frequency operations, it >seems there's too much data going in and out for it to handle >[end quote] > > >I still can't see any way for this bug to occur due to "too much data", >as you suggest, or in the absence of one thread modifying the set while >another is iterating over it. But I could be wrong. Well, in this case, I'd consider it more reasonable to look at it from a different angle, but it was rather poorly-phrased at the beginning. When you've got dozens of objects being garbage-collected from the set every 16 miliseconds or so though, that's certainly high-frequency enough to trigger the bug, is it not? >In any case, it appears that this bug has already been reported and fixed: > >http://bugs.python.org/issue14159 > >Consider updating to the latest bug fix of 2.7. Alas, I'm already on the latest official release, which doesn't have the patch yet. I'll just apply it manually. Though now I'm now curious about how regular sets get their truth value, since weaksets internally performing a length check every time a texture was being referenced or de-referenced, for simple lack of a faster explicit __bool__ value, is going to be rather costly when things'll be flying around and out of the screen area in large quantities. Hoo boy. ~Temia -- The amazing programming device: fuelled entirely by coffee, it codes while awake and tests while asleep! -- http://mail.python.org/mailman/listinfo/python-list
Re: CPython 2.7: Weakset data changing size during internal iteration
On 02 Jun 2012 03:05:01 GMT, Steven D'Aprano wrote: >I doubt that very much. If you are using threads, it is more likely your >code has a race condition where you are modifying a weak set at the same >time another thread is trying to iterate over it (in this case, to >determine it's length), and because it's a race condition, it only >happens when conditions are *just right*. Since race conditions hitting >are usually rare, you only notice it when there's a lot of data. Except that the few threads I use don't modify that data at all because the functions that even touch the references set rely on OpenGL contexts along with it which are thread-bound, ergo, impossible to call without stopping the code in its tracks to begin with unless the context's explicitly shifted (which it very much isn't). And I've done some looking through the weak set's code in the intervening time; it does easily have the potential to cause this kind of problem because the weak references made are set to a callback to remove them from the data set when garbage is collected. See for yourself.: Lines 81-84, _weakrefset.py: def add(self, item): if self._pending_removals: self._commit_removals() self.data.add(ref(item, self._remove)) <-- Lines 38-44, likewise: (for some reason called in __init__ rather than at the class level, but likely to deal with a memory management issue) def _remove(item, selfref=ref(self)): self = selfref() if self is not None: if self._iterating: <-- self._pending_removals.append(item) else: self.data.discard(item) <-- self._remove = _remove The thing is, as Terry pointed out, its truth value is tested based on __len__(), which as shown does NOT set the _iterating protection: def __len__(self): return sum(x() is not None for x in self.data) Don't be so fast to dismiss things when the situation would not have made a race condition possible to begin with. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: CPython 2.7: Weakset data changing size during internal iteration
On Fri, 01 Jun 2012 18:42:22 -0400, Terry Reedy wrote: >I gather that the .references attribute is sometimes/always a weakset. >To determine its boolean value, it computes its length. For regular >sets, this is sensible as .__len__() returns a pre-computed value. Indeed. Back when I was using 2.6 to develop, it was simply an integer counter, but that led to some difficulties in maintaining it in case some sprite objects hadn't been explicitly killed. >Given that len(weakset) is defined (sensibly) as the number of currently >active members, it must count. weakset should really have .__bool__ >method that uses any() instead of sum(). That might reduce, but not >necessarily eliminate your problem. Think it might be worth looking into submitting a patch for the next minor releases for Python if it turns out to solve the problem? Failing that, I might just have to check the truth value of the data attribute inside the weak set manually... >I can think of two reasons: > >1. You are using multiple threads and another thread does something to >change the size of the set during the iteration. Solution? put a lock >around the if-statement so no other thread can change self.data during >the iteration. > >2. Weakset members remove themselves from the set before returning None. >(Just a thought, in case you are not using threads). It's a multithreaded program to a small extent - I offload I/O operations, music handling, and a basic, optional debugger console (which I really wish I could set up to use the real interactive interpreter instead of the shoddy setup I've got now) to seperate threads, while the main logic operates in one thread due to OpenGL's issues with multiple Python threads. Since the sprite object calls to reference a texture in __init__(), that means no other thread could even safely reference the texture due to the potential of making OpenGL calls without the relevant context kept by the main thread (this has made the loading thread kind of useless, but the texture strings themselves can still be loaded into temporary memory, and other data like music still works). If the weak references removing themselves is the case, it seems like a kind of silly problem - one would imagine they'd wrap the data check in _IterationGuard in the _weakrefset.py file like they do for calls to __iter__(). Very strange. Anyway, I truly appreciate your input and suggestions. I'll see if they have any results, and if so, we can work out submitting a patch. If not, at least reading through this gave me the idea to just call the data set inside it, so I can use it as an imperfect but functional solution within the scope of my project. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
CPython 2.7: Weakset data changing size during internal iteration
I've got a bit of a problem - my project uses weak sets in multiple areas, the problem case in particular being to indicate what objects are using a particular texture, if any, so that its priority in OpenGL can be adjusted to match at the same time as it being (de)referenced by any explicit calls. Problem is that for certain high-frequency operations, it seems there's too much data going in and out for it to handle - the following traceback is given to me (project path changed to protect the innocent): Traceback (most recent call last): File "C:\foo\bar\game.py", line 279, in update self.player.update() File "C:\foo\bar\player.py", line 87, in update PlayerBullet((self.x + 8, self.y + 9), 0, self.parent) File "C:\foo\bar\player.py", line 96, in __init__ self.sprite = video.Sprite("testbullet", 0) File "C:\foo\bar\video.py", line 95, in __init__ self.opengl_id = reference_texture(self, target) File "C:\foo\bar\video.py", line 310, in reference_texture if not video_handler.textures[target].references: File "C:\Python27\lib\_weakrefset.py", line 66, in __len__ return sum(x() is not None for x in self.data) File "C:\Python27\lib\_weakrefset.py", line 66, in return sum(x() is not None for x in self.data) RuntimeError: Set changed size during iteration I can post the sources relevant to the traceback upon request, but hopefully a traceback is sufficient as the most immediate problem is in Python's libraries. Any suggestions on what to do about this? I can't exactly throw a .copy() in on top of the data iteration and call it good since it's part of the standard Python library. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: python for android anyone?
On Mon, 28 May 2012 08:56:51 -0700 (PDT), rusi wrote: >Ive been wanting to try the sl4a for a new android phone Ive got hold >of as spelt out at >http://www.linuxjournal.com/article/10940 > >Has anyone any experience/dos/donts for this? > >I am writing this while the update of the android sdk is happening and >its taking forever. >So just wondering if its worth the effort. > >Any specific tips will of course be welcome but also the general idea >-- is android really python friendly (yet)? > >Thanks I myself use it, though primarily for testing out concepts or blocks of code I think up on the road (or a quick and dirty profile if I think of two ways to do something and want to decide which is the best). I can't comment on its usefulness for app development, but looking over the article, it looks like for any such development you'd still be better off grabbing the Android SDK. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: usenet reading
On Fri, 25 May 2012 23:30:24 -0600, Jason Earl wrote: >On Fri, May 25 2012, Jon Clements wrote: > >> Hi All, >> >> Normally use Google Groups but it's becoming absolutely frustrating - >> not only has the interface changed to be frankly impractical, the >> posts are somewhat random of what appears, is posted and >> whatnot. (Ironically posted from GG) >> >> Is there a server out there where I can get my news groups? I use to >> be with an ISP that hosted usenet servers, but alas, it's no longer >> around... >> >> Only really interested in Python groups and C++. >> >> Any advice appreciated, >> >> Jon. > >I have had good success with news.eternal-september.org . > >http://www.eternal-september.org/ > >Jason Not sure if you can even see my original reply to you (I certainly can't), but it seems the Python mailing list (which I've been using rather extensively up until now) has some serious problems syncing to the newsgroup - large amounts of content simply isn't crossing over into Usenet's territory, if the synchronization is anything beyond read-only to begin with. It's a shame, but it looks like I'll have to go back to using the mailing list to read for completeness's sake. :/ Gonna be tricky juggling that for reading and keeping Usenet for writing (so as to not contribute to the information loss), but I'll make do somehow. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: usenet reading
[Default] On Fri, 25 May 2012 23:30:24 -0600, Jason Earl wrote: >On Fri, May 25 2012, Jon Clements wrote: > >> Hi All, >> >> Normally use Google Groups but it's becoming absolutely frustrating - >> not only has the interface changed to be frankly impractical, the >> posts are somewhat random of what appears, is posted and >> whatnot. (Ironically posted from GG) >> >> Is there a server out there where I can get my news groups? I use to >> be with an ISP that hosted usenet servers, but alas, it's no longer >> around... >> >> Only really interested in Python groups and C++. >> >> Any advice appreciated, >> >> Jon. > >I have had good success with news.eternal-september.org . > >http://www.eternal-september.org/ > >Jason I could definitely make use of this. Even though I use Agent, I've mostly just been using the mailing list in lieu of having an actual newsgroup subscription. Now I can turn that habit around! Not the OP, but you have my appreciation regardless! ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Namespace hack
[Default] On 25 May 2012 02:47:11 GMT, Steven D'Aprano wrote: >Do you object to the ability to write standard Python modules? > ># module.py >def spam(obj, n): >return len(obj) + n > >def ham(obj): >return spam(obj, 23) > > >By your apparent misunderstanding of the Zen, you think that this should >be written with oodles of more explicitness, 'cos explicit is always >better, right? > >keyword.def globals.spam(locals.obj, locals.n): >keyword.return builtin.len(locals.obj) + locals.n > >keyword.def globals.ham(locals.obj): >keyword.return globals.spam(locals.obj, 23) > > >Python, like most (all?) non-trivial languages, has scoping rules so that >you can refer to names without explicitly specifying which namespace they >are in. So long as this is unambiguous, Explicit vs Implicit is >irrelevant if not outright wrong. > >My namespace decorator simply applies a slightly different set of scoping >rules to the ones you are already used to in modules. It's no worse than >nested functions (hardly a surprise, because it is built on nested >functions!) or module-level scoping rules. > > >-- >Steven But then we've got "Simple is better than complex", and "Complex is better than complicated". Of course if we decided to start iterating through the zen of Python's verses and continually modifying the example code to fit, it would get rather silly rather fast. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Open Source: you're doing it wrong - the Pyjamas hijack
If the support you have from the other contributors is anywhere near what you claim it is, I may as well be kissing Pyjamas goodbye. Doubt it, though - this whole post reeks of vagueities and doublespeak garbage. Too many undefined "whos". I'll wait until Leighton gets the reins back. And you know what? Leighton was right to threaten legal action. What you did was not only in violation of his IP, but also multiple data theft laws. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: syntax for code blocks
You know what I find rich about all of this? >>>[ ... ]> I'd like to change the syntax of my module 'codeblocks' to make it >>>more >>>[ ... ]> pythonic. Kiuhnm posted a thread to the group asking us to help him make it more Pythonic, but he has steadfastly refused every single piece of help he was offered because he feels his code is good enough after all. So why are we perpetuating it? ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: syntax for code blocks
> if only Python wasn't so rigid. what. You realize you'd have a little more luck with Python if you weren't wielding it like a cudgel in the examples you've posted here, right? Because it looks like you're treating the language as everything it isn't and nothing it is this whole time. No wonder you're having trouble making your code Pythonic. Go with the flow. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyjamas / pyjs
>Anyone else following the apparent hijack of the pyjs project from its >lead developer? Not beyond what the lead developer has been posting on the newsgroup, no. Still a damn shame, though. What happens when you have an unresolvable ideological seperation like that is you branch, not take over. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: John Carmack glorifying functional programing in 3k words
>On 27/04/12 03:11, Xah Lee wrote: >> John Carmack glorifying functional programing in 3k words >> >> http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ >> >> where was he ten years ago? >> >> O, and btw, i heard that Common Lispers don't do functional >> programing, is that right? >> >> Fuck Common Lispers. Yeah, fuck them. One bunch of Fuckfaces. (and >> Fuck Pythoners. Python fucking idiots.) >> >> O, don't forget, >> >> 〈Programing: What are OOP's Jargons and Complexities (Object Oriented >> Program as Functional Program)〉 >> http://xahlee.org/Periodic_dosage_dir/t2/oop.html >> >> please you peruse of it. > >I'm not a 'Common Lisper' or a 'Pythoner' so I'm not directly or >personally affected by your retarded and offensive comment. However, who >the fuck do you think you are to post stuff of this nature? (I believe) >I'll understand if you've got some sort of psychological issue affecting >your behaviour. And another one gets trolled. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: linux
>can anyone say me how to subscribe linux mailing list like 'python >mailing list'. Actually i want to post question there. It'd probably be best to visit the mailing list (if any) for the distribution that you're using in particular. Odds are any such mailing list would be available on the distro's site. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: syntax for code blocks
Holy crap. Easy there, tiger. I understand you're frustrated, but the people here are trying to help, even if they've decided the means of helping is trying to explain why they feel your style of development isn't the best way to do things. You're going to wear out your welcome and not get any help at all if you go ballistic like that. :/ ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Installing pygame on MacOS-X Lion with Python 3.3
>I can't get it working : "No pygame module"... >Tried without success : >pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip >pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg > >I am using Python 3 last version on MacOS-X Lion. > >Where is a step-by-step installation procedure ? > >Thanks, > >franck That'd likely be because package installations are limited to the major and minor version they were built for. Those two packages, for example, were built for Python 2.7, which is significantly different from Python 3.3. I'm not seeing any 3.3 builds for Pygame *at all*, even for Windows, so you'd probably be best off moving to Python 2.7. You should be able to use Pygame freely then. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trouble splitting strings with consecutive delimiters
>> re.split(':|;|px', "width:150px;height:50px;float:right") > >You could recognize that the delimiter you want to strip is in fact px; >and not px in and of itself. > >So, try: > >re.split(':|px;', "width:150px;height:50px;float:right") > >Emile That won't work at all outside of the example case. It'd choke on any attribute seperator that didn't end in px. Honestly I'd recommend recovering the size measurement anyway, since there are pretty huge differences between each form of measurement in CSS. Seperating it from the number itself is fine and all since you probably still need to turn it into a number Python can use, but I wouldn't discard it outright. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Learn Technical Writing from Unix Man in 10 Days
>On Mon, Apr 30, 2012 at 2:50 PM, Xah Lee wrote: >> jason, are you trolling me, or me you? > >Am I Turing dreaming I am a machine, or a machine dreaming I am Turing? > >Personally, I've never Turred. > >ChrisA Turing got a pretty shit deal for all the great things he did - odds are a machine would look at his life and how it should've progressed a lot better than we humans decided how it should've went. So dream away, machine. Dream of a world we humans weren't smart enough to live in. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Learn Technical Writing from Unix Man in 10 Days
>jason, are you trolling me, or me you? > >? > > Xah Depends on what you classify as "trolling" these days. In all honesty, the original concept of trolling seems to have become a lost art, with only a few people even knowing what the act actually was anymore, and in its absence everyone seems to draw their own definitions and conclusions of the term where it can be applied to whoever is antagonistic towards them at the time. In one definition, that being the one defined by common sense of "getting a reaction out of people", you in fact succeeded rather well by getting a reaction in general, though it was mostly mockery and heckling. In another definitions calling trolling an attempt at getting upset reactions specifically, I'd have to say there isn't so much of that unless your inquiry into who's trolling whom was because you felt as if you had been slighted by Jason's statement. So really, it's a crapshoot at this point. Who's trolling whom indeed. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: syntax for code blocks
>> Current Syntax: >> >> with res << func(arg1) << 'x, y': >> print(x, y) >> >> with res << func(arg1) << block_name << 'x, y': >> print(x, y) >> >> New Syntax: >> >> with res == func(arg1) .taking_block (x, y): >> print(x, y) >> >> with res == func(arg1) .taking_block (x, y) as block_name: >> print(x, y) >[snip] > >Hey, guys, am I the only one here who can't even guess what >this code does? When did Python become so obscure? > >-- >To email me, substitute nowhere->spamcop, invalid->net. No, it's pretty impenetratable to me at a passing glance too. Not sure if I'd get anywhere handtracing it, though. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Learn Technical Writing from Unix Man in 10 Days
>On Sun, Apr 29, 2012 at 8:36 AM, Temia Eszteri wrote: >> And what does this have to do with a multiplatform language like >> Python? :P > >Nothing. Xah Lee is a professional troll. You can save yourself some >trouble by ignoring his posts altogether. > >ChrisA Professional? He's boring! I wanted to see if I could poke him into action. I know, I know, "don't feed the trolls." Just wanted to see if he would actually come up with something interesting. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Learn Technical Writing from Unix Man in 10 Days
And what does this have to do with a multiplatform language like Python? :P ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: confusing doc: mutable and hashable
>Yes, you're right. Being mutable and hashable are orthogonal properties. >The implication > mutable => non hashable >is just a design choice. > >The reason for such a choice is the following. If a key-element pair K:X >is added to a container C and then K is changed by some external Python >code without letting C know of this change, C may become inconsistent. >Some containers (e.g. set) assume that K=X and just take X. Modifying X >is equivalent to modifying K in the example above. >These kinds of problems are avoided if mutable objects can't be keys. >Some containers require that keys be hashable, but since, by design, >mutable objects can't be keys, there's no reason for them to be hashable >either. > >Kiuhnm Well, if worst comes to worst and you wind up in a programming situation where you needed to make a mutable object as a hash entry, it's still possible to subclass the object type and have __hash__() return the object's ID instead, right? I can only think of a few edge cases where that could even possibly be required though, such as membership testing for something and having a callback associated with each set of members... ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python id() does not return an address [was Re: why () is () and [] is [] work in other way?]
Steven, your posts are leaking out of their respective thread(s). Is this intentional? ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: generate random numbers in a deterministic way
Assuming you're using the Python's random module, which works based on the Mersenne Twister, you can preset the seed with random.seed(hashable). More details here: http://docs.python.org/library/random.html#random.seed ~Temia On Wed, 25 Apr 2012 07:51:18 +0200, you wrote: >Hi, > >I'm working with some sorting algorithms and I want to compare their >efficiency. One test fills a list with one million random integers, >which serves as input for the algorithms. However, if this list is >different each time I run the tests, the tests wouldn't be fair. At >the moment the selected sorting alg. can be specified with a switch >and only one alg. is tested each time. > >So what I want is the following: fill the list with random numbers, >but when I re-execute the script, I want the same "random" numbers in >the same order. This way each sorting alg. would get the same input. > >As a workaround, I made a generator that outputs a random list in a >file, and this list is read each time by the testing script. I just >wonder if there is a more elegant solution. > >Thanks, > >Laszlo -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: how many days in one year ?
Better yet, write them out as constants if they're referenced more than once. In that case, if the planet gets knocked into a new orbital and rotational pattern, you can update accordingly if you, civilization, and Python all still exist. ~Temia On Sun, 22 Apr 2012 13:44:15 +0400, you wrote: >import calendar > >print 366 if calendar.isleap(2003) else 365 > > > >On 22 April 2012 13:37, contro opinion wrote: >> i want to know how many days in one year, >> import time >> import datetime >> d1= datetime.datetime(2003, 1, 1) >> d2=datetime.datetime(2003, 21, 31) >> print? (d2-d1).days+1 >> >> i can get there are 365 days in the 2003, >> >> is there other way,better way? to calculate? ? -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: pygame: output to file?
Oh, forgot to mention some things. Also poorly phrased other things. Let me try that again. >* ImageMagick (http://www.imagemagick.org/) as Ian suggested - the >ctypes binding I found for this was too immature to use, and the other >option will require compiling, The 'other option' I meant here was a different Python binding, PythonMagick. In comparison, the ctypes-based binding is called PythonMagickWand. Failing that, both this and GraphicsMagick can be manipulated through shell libraries, but I haven't done anything like that yet so I'd be going in blind and hoping for the best. (I make no claim to be an expert or that I ever was or will be one - I'm just starting out and helping where I can) >* or a module I found on Google Code that greatly extends from PIL's >meager GIF-handling abilities, images2gif >(http://code.google.com/p/visvis/source/browse/vvmovie/images2gif.py). While you said you preferred animated GIFs in your opening message, the visvis project at Google code (behind images2gif) also has images2avi, which could possibly be used with conversion software down the line to output to a different container and codec if you wanted to go with the video stream. Once again, let me know what you think. As for the other comp.lang.python folks, please tell me if I'm overlooking something that'll throw a spanner in the works. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: pygame: output to file?
Okay, superpollo. I'm looking at a few possible ways to do this (the Zen of Python hates me, even though I'm dutch-blooded!), and I'd like to ask a couple more questions before I dive into writing up a solution. First, are you simply trying to capture the framebuffer of a Pygame-made game in realtime, or are you using Pygame to explicitly render and build a movie or GIF animation sequence? I need to know what kind of overhead is permissible, and in the former case I know there won't be a lot of allowance due to how slow Pygame's drawing operations can get when they stack up, especially at high resolutions. Secondly, how much are you willing to install to have a means to do this? Because from the looks of things, this'll have to either be tackled with: * ImageMagick (http://www.imagemagick.org/) as Ian suggested - the ctypes binding I found for this was too immature to use, and the other option will require compiling, * A branch someone on EsperNet pointed me to called GraphicsMagick (http://www.graphicsmagick.org/) - haven't looked into this much so I can't comment on it yet, * or a module I found on Google Code that greatly extends from PIL's meager GIF-handling abilities, images2gif (http://code.google.com/p/visvis/source/browse/vvmovie/images2gif.py). Let me know what you think of the options, and I'm sorry this has gotten a little too complex. I was hoping animated GIF sequencing in Python would be a simple matter too! ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: pygame: output to file?
On Mon, 16 Apr 2012 12:48:37 -0400, you wrote: >On 4/16/2012 8:37 AM, superpollo wrote: >> alex23 ha scritto: >>> On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... >>> >>> There is, but it's probably not going to be as performant as using >>> something external: >>> >>> http://stackoverflow.com/questions/6087484/how-to-capture-pygame-screen >> >> but where in the code should i put the line: >> >> pygame.image.save(window, "screenshot.jpeg") >> >> ? > >Somewhere in the loop that draws frames, perhaps just before or after >flipping to the screen. Of course, number the frames. > >framenum = 0 # somewhere, just once ># in loop >pygame.image.save(window, 'frame%05d' % framenum) >framenum += 1 > >5 digits for frames is just an example. > >>> 'frame%05d.jpg' % 21 >'frame00021.jpg' > >>> 'frame{:0>5d}.jpg'.format(21) >'frame00021.jpg' > >You might consider saving .bmp bitmaps, as mpeg compresses across frames >as well as within frames. If you have sprites moving over a static >background, only the changes need to be encoded. > >-- >Terry Jan Reedy If there's a image-handling library out there for Python that can make animated GIFs, I might be able to come up with a faster and more internalized solution using surface.convert() to paletted modes and image.tostring() functions or similarmeans to pass the frames to said library. Problem is that I can't seem to find a library that does handle animated GIFs. My google-fu has always been weak, alas. Does anyone feel up to confirming whether one exists or not? ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie python questions...
>3) When ever I cllick on *.py file, >it runs by so fast that I can't see what's going on. > ?Is there a way to keep the pyconsole open 'til i decide to close >it? >Thanks...Vernon This one's answered easily enough - just open a command prompt window at that directory (shift-right click the folder and select "Open Command Prompt Window", unless the Home version of Win7 lacks that...) and run "python .py" from it. ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list