Thread-safe way to prevent decorator from being nested

2013-06-06 Thread Michael
I'm writing a decorator that I never want to be nested. Following from the answer on my StackOverflow question (http://stackoverflow.com/a/16905779/106244), I've adapted it to the following. Can anyone spot any issues with this? It'll be run in a multi-threaded environment serving Django reques

Re: Python path and append

2016-04-26 Thread Michael
If you want to read an entire file, append a space and asterisk and write it to another file, this is the code you need: infile = open('win.txt', 'r') text = f.read() infile.close() text += " *" outfile = open('outfile.txt', 'w') outfile.write(text) outfile.close() If, on the other hand, you wis

Re: [Python-Dev] [WARNING] Some users who downloaded the Python 3.5.8 .xz tarball got the wrong version

2019-10-31 Thread Michael
On 31/10/2019 00:17, Larry Hastings wrote: > > > Due to awkward CDN caching, some users who downloaded the source code > tarballs of Python 3.5.8 got a preliminary version instead of the > final version.  As best as we can tell, this only affects the .xz > release; there are no known instances of u

Re: [Python-Dev] PEP 350: Codetags

2005-09-27 Thread Michael
ut have a big set of tags is a problem there, since no one will ever really remember a big list of random tags (or is that just me?). I also think the fields idea is a big mistake. As a code standard for a *particular* project it looks fine, but not for all. Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to find python c-sources

2005-10-01 Thread Michael
oo.com or ask a friend) The search terms might be obvious to you, but it simply means your google-fu is strong, and the strong should help the weak. (or not attack them at least...) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nufox : Xul + Python

2005-10-01 Thread Michael
he webpages appears to try and contact a server in a private address space, specifically 192.168.0.40. Which is a pity, because it looks interesting :-) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Michael
kills, and if people take a *civil* tone in suggested improvements, criticism (and suggestions) can be helpful. However, I'd suggest /finishing/ your glass house /before/ you start throwing stones, or else you'll never be able to smash it up the neighbourhood properly. Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Michael
quot;,3), ("j",-3,3)) [[-0.41614683654714241, 0.54030230586813977, 1.0], [0.54030230586813977, 1.0, 0.54030230586813977], [1.0, 0.54030230586813977, -0.41614683654714241], [0.54030230586813977, -0.41614683654714241, -0.98999249660044542], [-0.41614683654714241, -0.98999249660044542, -0.65364362086361194], [-0.98999249660044542, -0.65364362086361194, 0.28366218546322625], [-0.65364362086361194, 0.28366218546322625, 0.96017028665036597]] Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-02 Thread Michael
that static types only really help you find bugs (in terms of aiding development), whereas TDD actually helps you write your code. (Hopefully with less bugs!) Best Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-02 Thread Michael
x27;d hope that any code-linting tools would flag such expressions as potentially bad because they're not clear. (Whereas bracketed expressions instantly help here). Best Regards, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-02 Thread Michael
speaking better english than those with english as their mother tongue :-) And sometimes that different way can be better ? Direct translation of german grammatical form for example - resulting in something looking like yoda speak... Personally I like this form :) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to find python c-sources

2005-10-03 Thread Michael
John J. Lee wrote: > [Tor Erik S�nvisen] >> socketmodule.c, but I can't locate this file... Where should I look? > > [John, finding 'socketmodule.c' responds well to "I'm Feeling Lucky"] >> Does google vary in its results across the globe? >

Re: python getopt functionality

2005-10-03 Thread Michael
getopt - Parser for command line options. FILE /usr/lib/python2.4/getopt.py MODULE DOCS http://www.python.org/doc/current/lib/module-getopt.html [ ... snip ... ] Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-03 Thread Michael
Christophe wrote: > Michael a écrit : >> Rocco Moretti wrote: >> >> >>>That is, what would happen with the following constructs: >>> >>>A if B else C if D else F >>>A if B if C else D else F >> >> >> The correct answ

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-08 Thread Michael
ing rules based on how people *used* to speak and *used* to define words? (NB, I *did* say majority above ;-) Does /human/ language _require_ backwards compatibility? ;-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-08 Thread Michael
Terry Hancock wrote: > > Well, yeah, although the correct pronunciation is apparently > "te-tra-HEE-dra-GON". > As opposed to a "te-tra-SHE-dra-GON" ? ;-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Continuous system simulation in Python

2005-10-08 Thread Michael
ng to move themselves around continuous spaces and visualised at indeterminate frame or display rates. Best Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: What is executed when in a generator

2005-10-09 Thread Michael
ple. The first hadn't done any programming before, except a small amount of VB - he was a pre-university trainee. The second was a university vacation trainee who'd done 2 years, but had no experience of the ideas in the tutorial or python before joining us. It's specifically targeted at

Capturing audio from a microphone on Mac OS X

2005-10-14 Thread Michael
ematic (famous last works). Thanks in advance to anyone who replies, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: High Order Messages in Python

2005-10-23 Thread Michael
or "claimants". I'm also pretty sure there's other things you'd want to do more than the above generally speaking if you wanted to handle inheritance/etc nicely. (That does make me wonder as well if you'd need to do more in ruby as well) However, this certainly isn't a case of "ruby can do this, and python can't", because clearly python CAN do it :-) Regards, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: MSH (shell)

2005-10-27 Thread Michael
ed as a pipeline/graphline (1d,2d,n-d) system from the ground up, so having a shell for it was a logical step :-) ... I suppose the difference between python and MSH is you don't need a separate language, maybe a module or three, but you don't need to modify the language :) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Expanding Python as a macro language

2005-10-29 Thread Michael
t linux specific either... Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread Michael
o this. However, it's python, so of course you *can*, but just because you *can* do something doesn't mean that you *should*. You'll note that in order to make the reference to the plain mutable value (i) work the set_val had to mark the value as global, which isn't quite right. (You might be able to trick it into using the "right" scope using lambda somehow, maybe) Once again, don't use it! (hopefully of interest though) Regards, Michael. -- http://kamaelia.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Map of email origins to Python list

2005-11-09 Thread Michael
a creepy sort of way, or creepy in a cool sort > of way. As long as it gets my location WRONG, I'm happy. :-| Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: JAPH

2005-11-13 Thread Michael
s /= n > if s==1: > break > print japh More pythonic: print "Just another Python hacker." :-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal for adding symbols within Python

2005-11-13 Thread Michael
me having done lots of perl in the past $foo looks very firmly like a mutable, rather than an immutable. The reason I'm more interested in seeing usecases, is because I'd rather see where the existing approaches people use/define symbols has caused the OP problems to the extent he feels the language needs to change to fix these real world problems. Michael. -- http://mail.python.org/mailman/listinfo/python-list

Python/Qt Problem

2005-01-07 Thread Michael
inside the button action method (not using proper temrinology, sorry) of another window. Why is that? This works fine for the other windows. Have I explained my problem properly? Thanks for any advice, Michael -- http://mail.python.org/mailman/listinfo/python-list

property () for Java Programmers ?

2005-01-12 Thread michael
_new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'delx', 'getx', 'setx', 'x'] >>> c.x >>> ?? What can I do with this "property object" now. Confused greetings Michael -- http://mail.python.org/mailman/listinfo/python-list

dynamically inserting function into an object

2005-01-13 Thread michael
(20) curriedcell = Cell (100) print "uncurried initial %d " % (curriedcell.value) curriedcell.value = 60 print "uncurried set %d " % (curriedcell.value) curriedcell.curry (func, cell0, cell1) curriedcell.value = 62 print "curried set %d " % (curriedcell.value) Is t

Dynamic properties

2005-01-21 Thread michael
elf, attrname, value) fdel = lambda self: mydelattr(self, attrname) # fget, fset, fdel are used to reconstruct the byte field setattr (self, key, property (fget, fset, fdel)) :-) This inserts me pgm.LZ and pgm.LVI000 but when trying to access print pgm.LZ it gives me What am I doing wrong here Regards Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding user's home dir

2005-02-03 Thread Michael
) if not pdir: pdir = default return pdir -- Michael <[EMAIL PROTECTED]> http://kavlon.org -- http://mail.python.org/mailman/listinfo/python-list

character sets? unicode?

2005-02-03 Thread Michael
libraries? Is it better to save the text as-is in my db and save the character set type too or should I try to convert all text to some default format like UTF-8? Any advice? Thanks. -- Michael <[EMAIL PROTECTED]> http://kavlon.org -- http://mail.python.org/mailman/listinfo/python-list

Re: global variables

2005-02-03 Thread Michael
e thing I did learn though is that it's best to keep these modules simple. Don't make them import or define classes or functions if you can avoid it. It's easy to get into a mess of recursive imports if you start doing that. Just a good newbie tip. *** if runtime.verbose: print

Command Line arguments

2005-08-24 Thread michael
this is a test I get ['test.py]. NO arguments are passed. NOTE: This can NOT be blamed on Windows in my mind because Python2.2 and earlier works FINE. Any one have an idea? Thank you! Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Command Line arguments

2005-08-25 Thread michael
On Thu, 25 Aug 2005 00:46:41 -0700, Tim Roberts wrote: > michael <[EMAIL PROTECTED]> wrote: > >>I have a question about Windows based python (2.4 and later). >> >>For example, if I make a script called test.py like so: >> >>import sys >>print sys

Re: Command Line arguments

2005-08-25 Thread michael
On Thu, 25 Aug 2005 00:46:41 -0700, Tim Roberts wrote: > michael <[EMAIL PROTECTED]> wrote: > >>I have a question about Windows based python (2.4 and later). >> >>For example, if I make a script called test.py like so: >> >>import sys >>print sys

Re: Doubt C and Python

2005-08-25 Thread michael
in Python. My advice is to just TRY python and resolve the "slow" speed if you ever hit it. I never have and I write a lot of code, even hardcore math and image processing (See PIL - python Imaging Library). Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Command Line arguments

2005-08-26 Thread michael
On Thu, 25 Aug 2005 11:39:48 -0700, Trent Mick wrote: > [michael wrote] >> SOLVED! Thank you. >> >> I wonder why this was needed for 2.4 and not 2.2? I don't think it was >> lingering things from old installs because it happened on a persons >> computer t

Memory Based File Objects

2005-02-22 Thread michael
Does anybody have an example how to do that or maybe a snipplet for an "In Memory" File Object with an unknown size. Kind Regards Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: SysLogHandler is drivin me nuts PEBCAC

2004-11-29 Thread michael
Vinay Sajip <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > michael wrote: > > Yep it was incomplete heres the complete config as it has to be > > > [config file snipped] > > The complete file looks OK. Thx. with this file it is working.

Converting String to Class

2004-12-01 Thread michael
## or less :-) ['ProcessName', '', '48s']] ## or less :-) 1. is the attributename 2. is the default 3. is the format in the string So the string could be parsed with the opts Info and the attributes could be inserted into the class. I don

I've broken PythonWin2.4 - Dialogs don't pop up!

2005-04-06 Thread Michael
4 version. I can go down into the Python2.3 directories to PythonWin, which is actually ver 2.3.4, and fire up PythonWin and I don't have any of these problems. After I have a problem with PythonWin2.4 I notice weird UI behavior from my other apps until I kill PythonWin. Any ideas? Thanks, ~Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: I've broken PythonWin2.4 - Dialogs don't pop up!

2005-04-11 Thread Michael
Rebooting does not help. I uninstalled and removed everything from c:\python2.4 and then downloaded and installed the latest version. Right after installing it, everything worked fine. But when I rebooted, the problem came back. Sigh... ~Michael. -- http://mail.python.org/mailman/listinfo

Installation problem

2015-10-08 Thread MICHAEL
Hello, Please forgive a new user's ignorance. I am trying to install Python 3.5.0 on my laptop (Windows 10). The default installation directory is shown as c:\Users\(my user name)\AppData\Local\Programs\Python\Python35-32. However, if I select Custom Install then the default installation dir

Re: Python on GP2X (Linux Based Handheld Console)

2005-12-16 Thread Michael
Jérôme Laheurte wrote: > On Thu, 15 Dec 2005 08:43:34 +0000, Michael Sparks wrote: > >> I hadn't seen any announcements regarding this, but there's a little >> device recently released called a GP2X which is a small dual CPU >> (2x200Mhz) device which runs Lin

Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-27 Thread Michael
Py to experiment and play in ... :) Merry Christmas/Happy New Year :-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: python concurrency proposal

2006-01-03 Thread Michael
s more concrete, less abstract goals - even if it's not there yet. (portability of ideas to other languages is important to me, which again is another reason for an API based view rather than syntax). If you're willing to take a look at it, and make suggestions as to how your ideas might f

Re: [ANNOUNCE] MyHDL 0.5 released

2006-01-19 Thread Michael
yHDL is getting up to a very interesting level. This probably comes across as a bit random, but it struck me as quite exciting to see :-) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANNOUNCE] MyHDL 0.5 released

2006-01-21 Thread Michael
Jan Decaluwe wrote: > Michael wrote: ... >>* http://article.gmane.org/gmane.comp.python.myhdl/19/match=mu0 >> >> One question I've got, mainly because it strikes me as very intriguing is >> do you know if the MU0 processor as described is synthesisable or have

Re: Info on continuations?

2006-08-08 Thread Michael
nlets could result in something). (In fact the way seaside uses them as far as I can tell is more to implement co-routine like behaviour than anything else (!)) Anyway, hope that's interesting/useful - looking at your other comments, you're just looking for information and usecases at the moment :-) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Component framework

2006-08-11 Thread Michael
use it, but I'm aware of it. I use a component framework I develop for work & fun called Kamaelia - but PEAK is what you're thinking of. BTW, since it might be helpful, from your request I punched the following search terms into google - which links to the tutorial mentioning cars and whee

Re: Generator-based microthreads and games

2006-08-11 Thread Michael
sidering whether generators are a good approach :-) * http://thfsoc.blogspot.com/ * http://rjlsoc.blogspot.com/ Anyway, I've rambled on far too long, and now well off topic for the questions you were asking, so I'll be quiet :-) Have fun, and IMO, the generator approach (using Kamaelia, LGT, or home rolled), is very much worth going down. Best Regards, Michael. -- Michael Sparks, Kamaelia Project Lead http://kamaelia.sourceforge.net/Home http://yeoldeclue.com/blog -- http://mail.python.org/mailman/listinfo/python-list

Re: cloning generator iterators

2006-08-20 Thread Michael
in the way that you want. FWIW, I can see lots of situations where this would be useful - mainly in the area of dealing with search spaces (After all, this effectively allows you to fork the generator). Michael. -- http://kamaelia.sourceforge.net/Home - Concurrency, Networking, Simplicity --

Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-20 Thread Michael
s constantly improving. The TODO-list is still generous. """ I've not tried this, but I suspect this might be a good place to start (though coaxing it to do english might well be a project in itself, depending on what they mean by "some semblance of English" :-) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python component model

2006-10-09 Thread Michael
forge.net/screenshots/KamaeliaOpenGL.png (example of putting components in places they don't realise) * http://kamaelia.sourceforge.net/screenshots/AxonVisualiser.png Regards, Michael. -- Kamaelia Project Lead http://kamaelia.sourceforge.net/Home http://yeoldeclue.com/blog -- http://mail.python.org/mailman/listinfo/python-list

Kamaelia 0.4.0 RELEASED - Faster! More Tools! More Examples! More Docs! ; -)

2006-06-21 Thread Michael
//cvs.sourceforge.net/viewcvs.py/kamaelia/ Tutorial for the core component/concurrency system: * http://kamaelia.sourceforge.net/MiniAxon/ Project Motivations: * http://kamaelia.sourceforge.net/Challenges/ Licensing = Kamaelia is released under the Mozilla tri-license scheme (MPL1.

ANN: Axon 1.5.0 RELEASED!

2006-06-21 Thread Michael
maelia project and as a result is released under the Mozilla tri-license scheme (MPL1.1/GPL2.0/LGPL2.1). See http://kamaelia.sourceforge.net/Licensing.html Best Regards, Michael. -- Michael Sparks, Senior Research Engineer, BBC Research, Technology Group [EMAIL PROTECTED], Kamaelia Project Lead, ht

Re: Kamaelia 0.4.0 RELEASED - Faster! More Tools! More Examples! More Docs! ; -)

2006-06-24 Thread Michael
Robin Becker wrote: > Michael wrote: >> I'm extremely pleased to say - Kamaelia 0.4.0 has been released! > Windows users might see problems with the attempt at importing libc.so.6 > in the Axon Scheduler. > > I changed the lines at line 44 of scheduler.py to some

PEP thought experiment: Unix style exec for function/method calls

2006-06-25 Thread Michael
hat this has similarities to call with continuation, and that you can use statesaver.c & generators to achieve something vaguely similar to continuations, but I'm more after this specific approach, rather than that general approach. (After all, even ruby notes that their most common use for call/cc is to obfuscate code - often accidentally - and I'm not particularly interested in that :) Whereas the unix style exec is well understood by many people, and when it's appropriate can be extremely useful. My suspicion is that my ideasabove actually maps to a common idiom, but I'm curious to find that commonidiom. I'm fairly certain something like this could be implemented using greenlets, and also fairly certain that Stackless has been down this route in the past, but I'm not able to find something like this exec style call there. (Which is after all more constrained than your usual call with continuation approach) So, sorry for the length of this, but if anyone has any thoughts, I'd be very interested. If they don't, I hope it was interesting :) Regards, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Event notification system - where to start ?

2006-07-01 Thread Michael
ort pipeline from Kamaelia.Internet.TCPClient import TCPClient from Kamaelia.Util.Console import ConsoleReader, ConsoleEchoer pipeline( ConsoleReader(">>> "), TCPClient(sys.argv[1], 1601), ).activate() pipeline( TCPClient(sys.argv[1], 1600), ConsoleEchoer(), ).run() That's rather messy (in terms of UI) though - the talk from the chatroom will overtype the text, so a nice client would be to use a pygame text display instead (we've got something called a Ticker which would be useful here): Client: ~~~ import sys from Kamaelia.Util.PipelineComponent import pipeline from Kamaelia.Internet.TCPClient import TCPClient from Kamaelia.UI.Pygame.Ticker import Ticker from Kamaelia.Util.Console import ConsoleReader pipeline( ConsoleReader(">>> "), TCPClient(sys.argv[1], 1601), ).activate() pipeline( TCPClient(sys.argv[1], 1600), Ticker(), ).run() (Unfortunately, no, we don't have a text edit/entry box for pygame yet :-) Anyway, hope this was useful/interesting! Regard, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python CGI Scripting Documentation

2006-07-02 Thread Michael
are hammers) * Someone needs to understand the nuts and bolts of what's going on * Just because something is difficult doesn't mean its not worth doing * Understanding what's actually going on But the killer answer for me really is: "Why not" :-) Have fun :-)

Re: PEP thought experiment: Unix style exec for function/method calls

2006-07-02 Thread Michael
: "__main__", pc : 12 }, ] And after: [ { "context" : "greet", pc : 5 }, { "context" : "__main__", pc : 12 }, ] We'd then execute line 6, and after executing that line, our stack would look like this: [ { "context" : "greet", pc : 6 }, { "context" : "__main__", pc : 12 }, ] We're falling off the end of a function at that point, so we'd pop the top stack frame, as follows: [ { "context" : "__main__", pc : 12 }, ] Which means we return to the line after 12, and continue on with line 13 print "see what I mean". That means the '''print "We don't reach here"''' code isn't executed. >> * Am I mad? :) > > Yep. :) Thought so! Thanks :-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Broadcast server

2006-09-03 Thread Michael
(I'll probably add these to our SVN distribution since the question does seem to crop up fairly often generally speaking!) If you're looking to do this in a production environment I'm personally an advocate of learning what's going on in the core and then using an existing library. (The reason Kamaelia exists is because I wondered if there was an alternative, potentially clearer way of writing these things, most people would quite sensibly just use Twisted - especially given you can buy a book on it! I personally think Kamaelia is cleaner, but then I would think that :) Have fun! Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie pipe question

2006-09-05 Thread Michael
script you have "-u" after the python path. ie your minimal script should look something like: #!/usr/bin/python -u import sys while 1: line = sys.stdin.readline() # do something sys.stdout.write(line) Really quite simple you'll be pleased to see. Regards, Michael. -- h

Re: Help me use my Dual Core CPU!

2006-09-12 Thread Michael
here aside from anything else...). Also, Paul Boddie posted a module for parallel systems a while back as well which might be useful (at least for ideas): * http://cheeseshop.python.org/pypi/parallel I'd be interested in helping out BTW :) Michael. -- http://kamaelia.sourceforge.net/Home http://yeoldeclue.com/blog -- http://mail.python.org/mailman/listinfo/python-list

How do I converted a null (0) terminated string to a Python string?

2006-09-13 Thread Michael
Hi All, I've received (via UDP) a null terminated string and need to convert it into a Python string. Can anyone tell me how this is done? If it helps, I know the number of characters in the string. Thanks, M. McDonnell -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-13 Thread Michael
John Machin wrote: > Michael wrote: > > Hi All, > > > > I've received (via UDP) a null terminated string and need to convert it > > into a Python string. Can anyone tell me how this is done? If it helps, > > I know the number of characters in the string.

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-13 Thread Michael
John, Thanks for your reply. Just wondering... how are Python strings formatted? Evidently they're not 0 terminated. Thanks again, MDM John Machin wrote: > Michael top-posted [corrected]: > > John Machin wrote: > > > Michael wrote: > > > > Hi All, > > &

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-14 Thread Michael
John, Since I'm new to Python, I'm having trouble understanding what this means (see below). Would appreciate any help. if strg[-1] == "\0": strg = strg[:-1] Thanks, MDM John Machin wrote: > Fredrik Lundh wrote: > > Michael wrote: > > > > > Than

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-14 Thread Michael
I guess, I still don't see how this will work. I'm receiving a C zero-terminated string in my Python program as a 1K byte block (UDP datagram). If the string sent was "abc", then what I receive in Python is <0> How is Python going to know where in this 1K byte block the end of the string is? It

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-15 Thread Michael
Robert, Thanks to you and everyone else for the help. The "s.split('\x00', 1)[0] " solved the problem. Thanks again, MDM Robert Kern wrote: > Michael wrote: > > I guess, I still don't see how this will work. I'm receiving a C > > zero-terminated s

Re: Help me use my Dual Core CPU!

2006-09-28 Thread Michael
Paul Rubin wrote: > "Michael Sparks" <[EMAIL PROTECTED]> writes: >> > Kamaelia doesn't attempt concurrency at all. Its main idea is to use >> > generators to simulate microthreads. >> >> Regarding Kamaelia, that's not been the case f

Re: Recursive descent algorithm able to parse Python?

2006-09-28 Thread Michael
erything is a function. I was pondering giving it a lisp backend or transforming to lisp but never got a round tuit) If however you're doing this because you're not aware of the compiler module, it's worth knowing that compiler.parse is a pretty useful function :-) Michael. -- http://mail.python.org/mailman/listinfo/python-list

[ANNOUNCE] Kamaelia 0.5.0 Released - now enhanced by Summer of Code :-)

2006-10-01 Thread Michael
Kamaelia is heavily based on python generators (they're not scary, really [5]), but also support threaded components and is designed to work with any version of python since python 2.2a1, and is not limited to Python 2.5. [5] http://kamaelia.sourceforge.net/MiniAxon/ Have fun! Michael -- Michael Sparks, Kamaelia Project Lead http://kamaelia.sourceforge.net/Home blog: http://yeoldeclue.com/blog -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me use my Dual Core CPU!

2006-10-01 Thread Michael
Paul Rubin wrote: > Michael <[EMAIL PROTECTED]> writes: >> > But ordinary programmers write real-world applications with shared data >> > all the time, namely database apps. >> >> I don't call that shared data because access to the shared data is

Re: Will GPL Java eat into Python marketshare?

2006-11-17 Thread Michael
>> Short answer: People use Python instead of Java because people (at >> least intelligent people) tend to avoid pain. >> > Intelligent people don't suffer from fanboy sentiments. They just pick a > language that works best for them. I agree with the previous poster and don't think it's just

Re: Python Parallel Paradigm

2006-11-17 Thread Michael
e's Stackless Python (which I can't make head or tail of; I have been > unable to find any lucid overview, Finally, if the descriptions you find on the Kamaelia website don't make sense to you, PLEASE tell us. I consider that as much of a bug as anything else. (and we can'

Re: Why does this code crash python?

2006-11-17 Thread Michael
rror: times_info[player] = (0, now) if not self.anyReady(): self.pause() yield 1 Pipeline( KeyEvent(key_events = { pygame.K_SPACE: ("SPACE", "outbox")} ), ChessTurnLogic(), TimerLogic(),

Page layouts in mod_python?

2006-12-19 Thread Michael
facility using mod_python. (Similar to the layout capability in Ruby on Rails.) Thank you in advance, -Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: code optimization (calc PI)

2007-01-03 Thread Michael
Ah, no. It was a HASH (assoziative Array or somethings like that). mm wrote: > > I konw, that for example while-loops in Perl are very slow. Maybe this > is also known in Pyhton. Then, I can translate the while-loops in to > for-loops, for example. > More general, maybe there is a speed optim

Re: C/C++, Perl, etc. to Python converter

2007-01-03 Thread Michael
Yes, I konw what you mean. And thats the right way to do it - for beginners. --But not for someone who allready know programmings things for many years. They ask themself: How can I do this in Python? I can remember, it was that-way with Perl or C or C++ or whatever. So, not only a ververter c

Re: code optimization (calc PI)

2007-01-03 Thread Michael
Hmm.. thanks. I did this changes, but without any performance profits. Matimus wrote: > Using the '+' operator for string concatonation can be slow, especially > when done many times in a loop. > > >> pi = pi + str("%04d" % int(e + d/a)) ## this should be fast?! I dont > > > The accepted

Re: code optimization (calc PI)

2007-01-03 Thread Michael
Yes. But it still runns very slowly. If someone is really interested in speed optimization, I can publish my PI-calc code. Maybe for some Python compiler/interpreter hackers... ;-) (There are only 2 while-loops, one within another, and some simple basic calculations. Nothing special.) Stefan

Jabber/XML-RPC lib in Python?

2005-05-10 Thread Michael
and just worry about the logic of my own program. Any ideas? -- Michael <[EMAIL PROTECTED]> http://kavlon.org -- http://mail.python.org/mailman/listinfo/python-list

mod_python seg faults with xml

2005-05-13 Thread Michael
and similar modules? Thanks. -- Michael <[EMAIL PROTECTED]> http://kavlon.org -- http://mail.python.org/mailman/listinfo/python-list

moving from c++ to python

2005-05-21 Thread Michael
Hi, I'm a pretty sound programmer in C++, but would like to learn python! Does anyone know of any tutorial s aimed at me?? My biggest confusion so far is the lack of pointers in Python .. Regards Michael -- http://mail.python.org/mailman/listinfo/python-list

Newbie python design question

2005-05-22 Thread Michael
Hi, I'm trying to write a script to parse a .cpp file and begin to create a 'translational unit'. To do this i need to: Go through the file and remove all 'C' comments as /* Comment 1*/ (can be on multiple lines) Go through and remove all 'C++' comments, anything between // and '\n' char. The st

Incrementing letters

2005-05-27 Thread Michael
Hi, I've got a string s, and i want to shift all the letters up by one, eg a->b, b->c z->a In c++ i can do this quite simply with if(C == 'z') C='a'; else C++; but i can't work out how to do this this in python?? Regards Michael -- http://

Is there a better way of doing this?

2005-05-28 Thread Michael
Hi, I'm fairly new at Python, and have the following code that works but isn't very concise, is there a better way of writing it?? It seems much more lengthy than python code i have read. :-) (takes a C++ block and extracts the namespaces from it) def ExtractNamespaces(data): print("Extract

working with pointers

2005-05-31 Thread Michael
Do expicit pointers exist in python?? if i do: a = [5,7] b = a a.empty() b = ? how do i do explicit pointers?? Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: working with pointers

2005-05-31 Thread Michael
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael wrote: > > Do expicit pointers exist in python?? > > > > if i do: > > > > a = [5,7] > > b = a > > > > a.empty() > > > > b = ? >

Re: working with pointers

2005-05-31 Thread Michael
except numbers?? "Dave Brueck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael wrote: > > sorry, I'm used to working in c++ :-p > > > > if i do > > a=2 > > b=a > > b=0 > > then a is still 2!? > > > &g

wxPython

2005-06-02 Thread Michael
Hi, I've got a question about wxPython, wheres the best place to ask?? Mike -- http://mail.python.org/mailman/listinfo/python-list

Software for System Builders, Resellers, and Hardware Purchasers Only.

2005-06-08 Thread Michael
GET latest softwares, 99% savings. http://djjnjs.b0fqeab48lt0qub.risalafe.com There is a fullness of all things, even of sleep and love. Be not ashamed of mistakes and thus make them crimes. -- http://mail.python.org/mailman/listinfo/python-list

Why are functions atomic?

2007-05-01 Thread Michael
a new copy, but I would like to know the rational behind the decision to make functions atomic before I shoot myself in the foot;-) Thanks, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are functions atomic?

2007-05-01 Thread Michael
On May 1, 9:34 am, John Nagle <[EMAIL PROTECTED]> wrote: > Michael wrote: > > Why are functions atomic? (I.e. they are not copied.) > > Because Python has objects for when you need to associate > state with a function. > > John

Re: Why are functions atomic?

2007-05-01 Thread Michael
>From TFM "Function objects also support getting and setting arbitrary attributes, which can be used, for example, to attach metadata to functions. Regular attribute dot-notation is used to get and set such attributes. Note that the current implementation only supports function attributes on user-

Re: Why are functions atomic?

2007-05-01 Thread Michael
A bit more info, but still no clear picture about why functions are mutable but have immutable copy symantics. There are arguments why functions should be immutable, but the decision was to make user- defined functions mutable. My question is still: why the present ummutable copy symantics? http

Re: Why are functions atomic?

2007-05-01 Thread Michael
roach that would justify the added complications of more complicated wrappings and the performance hit. Pickling is an obvious issue, but it seems like there is nothing wrong with the copy semantics and that the limitations are artificial and out of place. (It is also easily fixed: if the object has a

Re: Why are functions atomic?

2007-05-03 Thread Michael
On May 2, 6:08 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Tue, 2007-05-01 at 22:21 -0700, Michael wrote: > > Is there a reason for using the closure here? Using function defaults > > seems to give better performance:[...] > > It does? Not as far as I can me

  1   2   3   4   5   6   7   8   9   10   >