How can I wrap a binary file-like object with an IO stream?

2013-03-21 Thread Will McGugan
stream that handles the encoding/decoding. I'm sure I could implement the logic myself by looking at the mode/ encoding and return the appropriate IO interface, but I was hoping there was something in the stdlib to do this, or some pre-existing code I can lift? Thanks in advance, Will McGugan

Re: Simple HTML template engine?

2007-10-15 Thread Will McGugan
allen.fowler wrote: Hello, Can anyone recommend a simple python template engine for generating HTML that relies only on the Pyhon Core modules? Mako (http://www.makotemplates.org/) sounds like what you want.. Will McGugan http://www.willmcgugan.com -- http://mail.python.org/mailman

Re: Simple HTML template engine?

2007-10-15 Thread Will McGugan
allen.fowler wrote: Hello, Can anyone recommend a simple python template engine for generating HTML that relies only on the Pyhon Core modules? Mako (http://www.makotemplates.org/) sounds like what you want.. Will McGugan http://www.willmcgugan.com -- http://mail.python.org/mailman

Order of tuples in dict.items()

2007-10-14 Thread Will McGugan
, 'c': 2, 'b': 1} a.items() [('a', 1), ('c', 2), ('b', 1)] b.items() [('a', 1), ('c', 2), ('b', 1)] Can I rely on this behavior? Regards, Will McGugan blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Cross platform Python app deployment

2007-07-30 Thread Will McGugan
Hi, Is there some reference regarding how to package a Python application for the various platforms? I'm familiar with Windows deployment - I use Py2Exe InnoSetup - but I would like more information on deploying on Mac and Linux. TIA, Will McGugan -- http://www.willmcgugan.com -- http

Per thread data

2007-07-09 Thread Will McGugan
Hi, Is there a canonical way of storing per-thread data in Python? Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

error return without exception set

2007-07-03 Thread Will McGugan
Hi, Can anyone suggest a likely cause for the following exception... Exception exceptions.SystemError: 'error return without exception set' in generator object at 0x0345CF30 ignored Thanks Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

Re: error return without exception set

2007-07-03 Thread Will McGugan
Peter Otten wrote: The error return without exception set part looks like a failed consistency check in ceval.c -- perhaps caused by a broken extension written in C. But you'd have to give some more context. Thanks for the explanation. It happens when I'm debugging a wxWidgets

Re: Matrix Multiplication

2007-06-18 Thread Will McGugan
/gameobjects/ Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Vector classes

2007-04-22 Thread Will McGugan
Mizipzor wrote: During my coding Ive found two vector classes on the internet. Ive modified them both a little but the do both have advantages and disadvantages. I'm working on a vector class at the moment, in my 'gameobjects' library. It's not really ready for public consumption, but feel

Re: 16bit RGB with Image module

2007-03-27 Thread Will McGugan
makes it use 16 bit. Although, I couldn't find any reference in the docs! I'm sure Fredrik Lundh could shed some light on this... Will McGugan -- blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: execution speed increase after compile py code into exe?

2007-03-24 Thread Will McGugan
Michael Bentley wrote: would there be any speed increase in code execution after python code being compiled into exe file with py2exe? No. I would expect slower startup followed by the same code execution time you'd get from running normally (not that I've actually tested it, mind

Announcing BBCode parsing module

2007-03-10 Thread Will McGugan
Hi, I have written a BBCode parsing module that may be of use to some people. It turns BBCode in to XHTML snippets. See the following page if you are interested... http://www.willmcgugan.com/2007/03/10/bbcode-python-module/ Will McGugan -- blog: http://www.willmcgugan.com -- http

generate tuples from sequence

2007-01-17 Thread Will McGugan
: yield tuple([i.next() for _ in xrange(count)]) Is this the most efficient solution? Regards, Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: generate tuples from sequence

2007-01-17 Thread Will McGugan
Will McGugan wrote: Hi, I'd like a generator that takes a sequence and yields tuples containing n items of the sqeuence, but ignoring the 'odd' items. For example Forgot to add, for my purposes I will always have a sequence with a multiple of n items. Will -- http://mail.python.org

sys.exit versus raise SystemExit

2007-01-08 Thread Will McGugan
Hi, Is there any difference between calling sys.exit() and raise SystemExit? Should I prefer one over the other? Regards, Will McGugan -- blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.exit versus raise SystemExit

2007-01-08 Thread Will McGugan
[EMAIL PROTECTED] wrote: sys.exit() raises a SystemExit, see http://docs.python.org/lib/module-sys.html Oh I know. I was just wondering if there was some sort of subtle 'best practice' recommendation that I wasnt aware of for using sys.exit over raising the exception manually. In the same

Re: trouble getting google through urllib

2006-12-19 Thread Will McGugan
I'm thinking thats the problem, does anyone know how I would make it keep the url as I intended it to be? Google doesnt like Python scripts. You will need to pretend to be a browser by setting the user-agent string in the HTTP header. Will McGugan -- blog: http://www.willmcgugan.com -- http

Re: trouble getting google through urllib

2006-12-19 Thread Will McGugan
using their official APIs if possible! Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm looking for an intelligent date conversion module

2006-12-16 Thread Will McGugan
mthorley wrote: Greetings, I'm looking for a python module that will take a datetime obj and convert it into relative time in english. For example: 10 minutes ago, 1 Hour ago, Yesterday, A few day ago, Last Week, etc I feel for you. I'm always on the lookout for an intelligent date. --

Re: YouTube written in Python

2006-12-13 Thread Will McGugan
youtube on Python.org http://www.python.org/about/quotes/ Will McGugan -- blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: write an update manager in python/wxPython

2006-12-07 Thread Will McGugan
a little more effort if you want to have some kind of automatic update... Will McGugan -- blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Will McGugan
it is divisible or do you want to make it divisible? And if you want to make it divisible do you want to go to the next multiple of 4, or the previous? Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: extremely slow array indexing?

2006-11-30 Thread Will McGugan
would expect to have enough time to go make a coffee, then drink it. If you think it is slower than it could be, post more code for optimization advice... Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-29 Thread Will McGugan
#!/usr/bin/python -OO import math import sys import psyco psyco.full() def primes(): primes=[3] for x in xrange(5,1000,2): maxfact = int(math.sqrt(x)) flag=True for y in primes: if y maxfact: break if

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-29 Thread Will McGugan
Steve Bergman wrote: Just wanted to report a delightful little surprise while experimenting with psyco. The program below performs astonoshingly well with psyco. It finds all the prime numbers 10,000,000 Actualy, it doesn't. You forgot 1 and 2. Will McGugan -- blog: http

Re: Remarkable results with psyco and sieve of Eratosthenes

2006-11-29 Thread Will McGugan
Beliavsky wrote: The number 1 is not generally considered to be a prime number -- see http://mathworld.wolfram.com/PrimeNumber.html . I stand corrected. -- blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Python work in UK

2006-11-23 Thread Will McGugan
development, applications, graphics or other interesting field. Here is a copy of my CV. http://www.willmcgugan.com/cvwillmcgugan.pdf Regards, Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 idle and print command How do I suppress a line feed?

2006-11-23 Thread Will McGugan
notejam wrote: Hi, I am having a problem with print statements always cause a line feed. I need to print a line of text, then the next print statement will start printing where the last one stopped rather than drop down a line. In basic we can do this with print texst; followed by next

Re: Python 2.5 idle and print command How do I suppress a line feed?

2006-11-23 Thread Will McGugan
notejam wrote: Hi, I am having a problem with print statements always cause a line feed. I need to print a line of text, then the next print statement will start printing where the last one stopped rather than drop down a line. In basic we can do this with print texst; followed by next

Re: 3d programming without opengl

2006-11-01 Thread Will McGugan
it on an ancient PC if that is an issue. If you really want to avoid OpenGL, then writing a custom 3D engine using flat shaded polys, with painters algorithm, rendered with your favourite gui toolkit isn't a great deal of work. Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman

Re: Alternative constructors naming convention

2006-10-12 Thread Will McGugan
Steven Bethard wrote: Are you really using staticmethod and calling __new__? It's often much easier to use classmethod, e.g.:: class Color(object): ... @classmethod def from_html(cls, r, g, b): ... # convert r, g, b to normal

Alternative constructors naming convention

2006-10-11 Thread Will McGugan
= Color.FromHtml(r, g, b) c = Color.from_html(r, g, b) Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython problems using GLCanvas

2006-10-09 Thread Will McGugan
and their intersections... OpenGL works rather well with wxPython. If it hangs your entire machine it can only be driver issues. Try downloading the latest video drivers and I suspect this problem will magically disapear! Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman

__init__ style questions

2006-10-02 Thread Will McGugan
programmers bad habbits! Any comments appreciated... Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ style questions

2006-10-02 Thread Will McGugan
Duncan Booth wrote: No it isn't Pythonic. Why not just require 3 values and move the responsibility onto the caller to pass them correctly? They can still use an iterator if they want: Vector3D(a, b, c) Vector3D(*some_iter) I kind of liked the ability to partially use iterators.

Re: __init__ style questions

2006-10-02 Thread Will McGugan
Duncan Booth wrote: Yes, it would, although since the implication is that your class expected numbers and the file iterator returns strings I'm not sure how much it matters: you are still going to have to write more code than in your example above. e.g. v1 = Vector3D(float(n) for n in

Re: Interfacing my chess client with GNU chess using python

2006-09-18 Thread Will McGugan
be appreciated. The subprocess module may help you... http://docs.python.org/dev/lib/module-subprocess.html Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python chess

2006-08-24 Thread Will McGugan
(http://www.alcyone.com/software/chess/). Does anyone konw about more chess related modules? I have written a chess module that may be of use to you. http://www.willmcgugan.com/2006/06/18/chesspy/ Will McGugan -- work: http://www.kelpiesoft.com blog: http://www.willmcgugan.com -- http

Python-like C++ library

2006-08-23 Thread Will McGugan
++ with Python in any way, just to emulate the strings / containers / slicing etc. I did google for it but my search terms were too vague... Thanks in advance, Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

iter(callable, sentinel)

2006-07-27 Thread Will McGugan
Hi, I've been using Python for years, but I recently encountered something in the docs I wasnt familar with. That is, using two arguements for iter(). Could someone elaborate on the docs and maybe show a typical use case for it? Thanks, Will McGugan -- work: http://www.kelpiesoft.com blog

Re: wxPython: wxStaticBitmap and large images

2006-07-20 Thread Will McGugan
a wxHtmlWindow to display it. Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple file writing techiques ...

2006-07-19 Thread Will McGugan
of the convertedData list out in one shot ... The OS should buffer it for you. Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Grid XY Coordinates question

2006-07-14 Thread Will McGugan
position in screen coordinates, you will need to convert them with the ScreenToClient for your grid. Will McGugan -- work: http://www.kelpiesoft.com blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Persistant dictionary with lockable elements

2006-07-12 Thread Will McGugan
typical database solution? Thanks, Will McGugan http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Chess module blog

2006-06-18 Thread Will McGugan
://www.willmcgugan.com/2006/06/18/chesspy/ Regards, Will McGugan -- work: http://www.kelpiesoft.com blog: http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Python netstring module

2006-06-04 Thread Will McGugan
Hi folks, I have just posted a python 'netstring' module on my blog. Comments welcome! http://www.willmcgugan.com/2006/06/04/python-netstring-module/ Regards, Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about idioms for clearing a list

2006-02-06 Thread Will McGugan
) and (2) preferred? I think the first two are changing the list in-place, but why is that better? Isn't the end result the same? I'm wondering why there is no 'clear' for lists. It feels like a common operation for mutable containers. :-/ Will McGugan -- http://mail.python.org/mailman/listinfo

Re: OpenGL

2006-01-22 Thread Will McGugan
_like_ a PyOpenGL implementation? What about PyOpenGL itself? http://pyopengl.sourceforge.net/ Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question on Parameters...

2005-12-28 Thread Will McGugan
to the tuple. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question on Parameters...

2005-12-28 Thread Will McGugan
= fillColor or Color(0.0, 0.0, 0.0, 0.25) Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting little gotcha with generators

2005-12-22 Thread Will McGugan
instead. Oh well, too let now I suppose... Would this work? def compilerOuter(self): raise StopIteration Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo

Re: Worthwhile to reverse a dictionary

2005-12-14 Thread Will McGugan
to your original problem (if you post more details Im sure there will be plenty of suggestions), but the following should reverse a dictionary.. testdict = dict(a=1, b=2) reversedict = dict( (value, key) for key, value in testdict.iteritems() ) Will McGugan -- http://www.willmcgugan.com .join

Re: Converting a List into a String

2005-11-05 Thread Will McGugan
list isnt a good name for a list, it hides the built in type. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython question

2005-10-18 Thread Will McGugan
for the animation. HTH, Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython question

2005-10-13 Thread Will McGugan
vpr wrote: Hi Does anyone have some example code to create a wx dialog that apears off screen on the bottom right hand corner and slides up into the screen ? Andrea Gavana does.. http://xoomer.virgilio.it/infinity77/eng/freeware.html#toasterbox Will McGugan -- http

Re: 1-liner to iterate over infinite sequence of integers?

2005-10-13 Thread Will McGugan
Neal Becker wrote: I can do this with a generator: def integers(): x = 1 while (True): yield x x += 1 for i in integers(): Is there a more elegant/concise way? import itertools for i in itertools.count(): print i Will McGugan

Re: 1-liner to iterate over infinite sequence of integers?

2005-10-13 Thread Will McGugan
Will McGugan wrote: Neal Becker wrote: I can do this with a generator: def integers(): x = 1 while (True): yield x x += 1 for i in integers(): Is there a more elegant/concise way? import itertools for i in itertools.count(): print

Re: Contest snub?

2005-10-08 Thread Will McGugan
perhaps? Its not irrational if you are a gator! Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: no variable or argument declarations are necessary.

2005-10-02 Thread Will McGugan
discovered unless the typo happens to exist in the current context. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python chess module

2005-09-30 Thread Will McGugan
(10) if 2x7] # 2x7 means 2x and x7 [3, 4, 5, 6] Read about it in the reference: http://www.python.org/doc/2.4.2/ref/comparisons.html Thanks. I was aware of that, I've just never got in to the habbit of using it.. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0

Re: New Python chess module

2005-09-30 Thread Will McGugan
There is a new version if anyone is interested... http://www.willmcgugan.com/chess.py It contains optimizations and bugfixes. Can anyone suggest a name for this module? pyChess is already taken... Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c

Re: ASCII

2005-09-30 Thread Will McGugan
Tuvas wrote: Is there a function that will take a char. and return the ascii value? Thanks! ord Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

New Python chess module

2005-09-29 Thread Will McGugan
for the fun of it. I wrote a chess game in C++ a while back (http://www.chesscommander.com) and I thought it would be interesting to re-implement the chess library part in Python. Regards, Will McGugan -- http://www.willmcgugan.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a number out of a string

2005-09-27 Thread Will McGugan
Claudio Grondi wrote: what about: lst = [digit for digit in '06897'] lst ['0', '6', '8', '9', '7'] Or.. list('06897') ['0', '6', '8', '9', '7'] Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http

Re: Creating Pie Chart from Python

2005-09-16 Thread Will McGugan
there is not that much to go wrong.. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating Pie Chart from Python

2005-09-15 Thread Will McGugan
piechartwindow.py). It can also be used to pre-generate images such as this.. http://www.foodfileonline.com/static/piecharts/pie01009.jpg Code is public domain. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) # Pie Chart

Re: Britney Spears nude

2005-09-15 Thread Will McGugan
Tim Peters wrote: [john basha] send me the britney nude photos Because they're a new feature, you'll have to wait for Python 2.5 to be released. She has just spawned a child process. Give her to Python 2.6 to get back in shape. Will McGugan -- http://www.willmcgugan.com .join

Re: Removing duplicates from a list

2005-09-14 Thread Will McGugan
that set does. I'm also not sure about removing an element whilst iterating, I think thats a no-no. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing duplicates from a list

2005-09-14 Thread Will McGugan
not currently optimizing I would go for the method with the best behaviour, which usualy means hashing rather than searching. Since even if it is actualy slower - its not likely to be _very_ slow. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26

Re: Python Search Engine app

2005-09-14 Thread Will McGugan
compressed binary structures - which is not Python's forte. You might be able to put a Python interface over an engine written in another language. Wasn't Google's first search engine actualy written in Python? Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr

Re: which is more 'pythonic' / 'better' ?

2005-09-12 Thread Will McGugan
there is not much difference either way.. Will McGugan -- http://www.kelpiesoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: which is more 'pythonic' / 'better' ?

2005-09-12 Thread Will McGugan
that 'line' would be a string, not a list. Seems more likely give the name and context. Will McGugan -- http://www.kelpiesoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: which is more 'pythonic' / 'better' ?

2005-09-12 Thread Will McGugan
of them, so I assumed it was string. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Has anybody tried to make a navigation like Google?

2005-09-05 Thread Will McGugan
. Will McGugan -- http://www.kelpiesoft.com -- http://mail.python.org/mailman/listinfo/python-list

Replacing large number of substrings

2005-09-04 Thread Will McGugan
.. dict_replace( a b c, dict(a=x, b=y) ) x y c Regards, Will McGugan -- http://www.kelpiesoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: how to join two Dictionary together?

2005-08-30 Thread Will McGugan
DENG wrote: dict1={...something...} dict2={...somethind else ..} dict1 + dict2 that's does works ..:(, it's not like List... I think you want.. dict1.update(dict2) Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy

Re: aproximate a number

2005-08-28 Thread Will McGugan
billiejoex wrote: Hi all. I'd need to aproximate a given float number into the next (int) bigger one. Because of my bad english I try to explain it with some example: 5.7 -- 6 52.987 -- 53 3.34 -- 4 2.1 -- 3 Have a look at math.ceil import math math.ceil(5.7) 6.0 Will McGugan

Re: Doubt C and Python

2005-08-23 Thread Will McGugan
praba kar wrote: Dear All, I want to know the link between c and python. Some people with C background use Python instead of programming in C.why? Because I can create software many times faster. And its more fun. Will McGugan -- http://www.kelpiesoft.com -- http

Re: First app, thanks people

2005-07-25 Thread Will McGugan
Jan Danielsson wrote: . Oh, I do have one more question though. I'm using wxPython, and when I check for keys I use the evt.GetKeyCode() call, and compare it with integers which I have found by printing what event.GetKeyCode() returns. I would prefer a more portable way, since I assume

dictionary that discards old items

2005-07-22 Thread Will McGugan
it. Can anyone enlighten me? Regards, Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

frozenset question

2005-07-06 Thread Will McGugan
Hi, Are there any benefits in using a frozenset over a set, other than it being immutable? Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: frozenset question

2005-07-06 Thread Will McGugan
Qiangning Hong wrote: On 7/6/05, Will McGugan [EMAIL PROTECTED] wrote: Hi, Are there any benefits in using a frozenset over a set, other than it being immutable? A frozenset can be used as a key of a dict: Thanks, but I meant to imply that. I was wondering if frozenset was faster

Re: frozenset question

2005-07-06 Thread Will McGugan
Steven D'Aprano wrote: There is no significant speed difference between immutable and mutable sets, at least for queries. Regardless of whether it is successful or unsuccessful, mutable or immutable, it takes about 0.025 second to do each test of item in set. Why would you need to

Database recommendations for Windows app

2005-06-22 Thread Will McGugan
googled and found plenty of information on databases, its just that I dont have enough experience with databases to know which one is best for my task! Thanks in advance, Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy

Re: Database recommendations for Windows app

2005-06-22 Thread Will McGugan
Thanks for the replies. I think I'm going to go with sqllite for now. For the curious, Im writing an interface to a nutritional database. So you can type in a foodstuff and it will tell you whats in it.. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97

Re: how to startup the default web browser to open a url?

2005-06-12 Thread Will McGugan
Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: Dealing with marketing types...

2005-06-10 Thread Will McGugan
and Java. What experiences have those in the Python community had in these kinds of situations? Marketing types need a bandwagon to jump on. Point out that Google is used by Google, ILM and NASA. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c

Re: Dealing with marketing types...

2005-06-10 Thread Will McGugan
Diez B. Roggisch wrote: Will McGugan wrote: Marketing types need a bandwagon to jump on. Point out that Google is used by Google, ILM and NASA. Certainly a true statement - but I've got the sneaky suspicion that the first google was supposed to be python. Indeed. D'oh. -- http

Re: maybe a bug in python

2005-06-05 Thread Will McGugan
want a tuple. Thusly... (a,) Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run functions in the background?

2005-05-31 Thread Will McGugan
Ognjen Bezanov wrote: I had a look into this, but have decided on pymedia, which was more focused on well... media. Either way thanks all of you, I have written my first threaded program, and it does what I need it to perfectly. The only thing i have a problem with now is how to

Re: How to run functions in the background?

2005-05-30 Thread Will McGugan
commands from it (e.g. pause, play etc...) How could I do this? Put your function in a thread, and add a queue to send your commands. Look up 'thread' and 'queue' in the help. Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c

Re: overflowerror!!

2005-05-26 Thread Will McGugan
[EMAIL PROTECTED] wrote: I tried that. Still get an Overflowerror: unsigned long is less than minimum. You'll also need to reserve enough space for the 256 ints. Try this.. data = array('L', '\0' * 256*4) Will -- http://www.willmcgugan.com .join( [ {'*':'@','^':'.'}.get(c,None) or

Re: pygame 1.6 for windows (python2.4)

2005-05-24 Thread Will McGugan
://www.pygame.org/download.shtml Will McGugan -- http://www.willmcgugan.com .join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz ] ) -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame 1.6 for windows (python2.4)

2005-05-24 Thread Will McGugan
bc wrote: Thanks for the reply, Will... I have been to the site, but I get a URL not found error when I try the pygame 1.6 for python24 link; I guess I will just keep trying until the HTML is fixed. Does seem to be broken at the moment. I've uploaded a copy to my server..

overhead of starting threads

2005-05-23 Thread Will McGugan
experience in this area that they could share? - before I start investigating myself.. I'm running on Windows, if thats relevant. Regards, Will McGugan -- http://www.willmcgugan.com .join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz ] ) -- http

Re: overhead of starting threads

2005-05-23 Thread Will McGugan
to do sample runs and find your sweet-spot. It all depends on what you're doing in the threads. I haven't had much luck with the profile module in the standard library. It only shows me data from the main thread. Is there a better way of profile heavily threaded code? Will McGugan -- http

Re: PyGame and Rotozoom (Sorry if OT)

2005-05-20 Thread Will McGugan
to draw it at the same position, move the rotated surface so that the centre point is the same as the original unrotated image. Creating a new sprite each time is probably quite inefficient. You might want to look at OpenGL, which is excellent for 2D and 3D games. HTH, Will McGugan -- http

Re: Reading image dimensions with PIL

2005-05-18 Thread Will McGugan
Dave Brueck wrote: If you're tossing images that are too _small_, is there any benefit to not downloading the whole image, checking it, and then throwing it away? Its a 'webscraper' app that downloads images based on search criteria. The user may want only images above 640x480, although

Re: Reading image dimensions with PIL

2005-05-18 Thread Will McGugan
Fredrik Lundh wrote: the right way to do this is to use the ImageFile.Parser class. see the last snippet on this page for an example: http://effbot.org/zone/pil-image-size.htm Excellent, thanks. Will -- http://www.willmcgugan.com .join( [ {'*':'@','^':'.'}.get(c,None) or

  1   2   >