Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > If you need help in figuring out how to walk through all 4096 possible > switch sets, just ask. Ok, thanks to your list, I figured out a program that works! It's probably not the best, and it doesn't really display which switches are correct in any apparent way (you h

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > John Salerno wrote: >> John Salerno wrote: >>> [EMAIL PROTECTED] wrote: >>> No. First of all, combining them with the & operator would be the asnswer to having all four lamps lit in the same position. But you want exactly 3 (in any combination). The correct

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > John Salerno wrote: > > [EMAIL PROTECTED] wrote: > > > >> No. First of all, combining them with the & operator would be > >> the asnswer to having all four lamps lit in the same position. > >> But you want exactly 3 (in any combination). The correct way > >> to combine the sw

Re: a problem to solve

2006-03-24 Thread John Salerno
John Salerno wrote: > [EMAIL PROTECTED] wrote: > >> No. First of all, combining them with the & operator would be >> the asnswer to having all four lamps lit in the same position. >> But you want exactly 3 (in any combination). The correct way >> to combine the switches (using my answer of a[7] b[

Re: PEP for nondeterminism.

2006-03-24 Thread Terry Reedy
"Adam DePrince" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I think this should have better been posted to comp.lang.python My reletively short answer should explain why. >I frequently find myself in a situation where I wish I could say "the > execution order of these two lines

Re: newbie parsing question

2006-03-24 Thread Fredrik Lundh
"Kun" wrote: > i tried to parse (below) with the regular expression: emails = > re.findall('\S*\s([EMAIL PROTECTED])', senders) > > and got the following error: > > Traceback (most recent call last): >File "/Life/School/Homework/Spring 2006/OPIM > 399/Tutorial/IMAP/scannermailer.py", line 19,

Re: How do I handle #

2006-03-24 Thread Fredrik Lundh
Michael Sperlle wrote: > I need to write out a file containing the # comment. When I try to specify > it as part of a literal, everything afterward turns into a comment. "turns into a comment" in what sense ? from your description, it sounds like a bug in your editor's syntax highlighter. Pytho

Re: encoding problems (é and è)

2006-03-24 Thread Serge Orlov
Jean-Paul Calderone wrote: > On Fri, 24 Mar 2006 09:33:19 +1100, John Machin <[EMAIL PROTECTED]> wrote: > >On 24/03/2006 8:36 AM, Peter Otten wrote: > >> John Machin wrote: > >> > >>>You can replace ALL of this upshifting and accent removal in one blow by > >>>using the string translate() method wi

Re: New development windows, IronPython or PythonWin

2006-03-24 Thread sanxiyn
Caleb Hattingh wrote: > Also, I think IronPython is also supported by only one guy - Jim > Hugunin. The fact that IronPython development is effectively being > sponsored by Microsoft doesn't fill me with great expectations either, > although it would be a good thing if they really supported it wel

PEP for nondeterminism.

2006-03-24 Thread Adam DePrince
I frequently find myself in a situation where I wish I could say "the execution order of these two lines just doesn't matter." Proposed here are two freshly drafted PEP's advocating for the addition of nondeterminism as a spring board for future automatic parallelism. The first calls for core

Re: Use of Python with GDAL. How to speed up ?

2006-03-24 Thread Serge Orlov
Julien Fiore wrote: > Thank you Serge for this generous reply, > > Vectorized code seems a great choice to compute the distance. If I > understand well, vectorized code can only work when you don't need to > access the values of the array, but only need to know the indices. You can access array el

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > No. First of all, combining them with the & operator would be > the asnswer to having all four lamps lit in the same position. > But you want exactly 3 (in any combination). The correct way > to combine the switches (using my answer of a[7] b[2] c[5] d[3]) > is to use th

Re: New development windows, IronPython or PythonWin

2006-03-24 Thread sanxiyn
Dan wrote: > > I realise its in beta. But long term, do you think that the win32com, > win32gui etc... will have no support because everyone jumps on the > Microsoft bandwagon? Aren't the windows support extensions supported > primarily by one guy, Mark Hammond? As a developer, this seams to leave

send email to string of emails

2006-03-24 Thread Kun
the code below outputs a string of emails (e.g. ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] i would like to somehow send an email to everyone on the string of emails telling them 'thanks for emailing me' anyone know how to do this? much thanks ahead of time. from imaplib import * import getpas

Re: don't understand popen2

2006-03-24 Thread Kent Johnson
Sion Arrowsmith wrote: > Kent Johnson <[EMAIL PROTECTED]> wrote: > >>Sion Arrowsmith wrote: >> >>>(and please avoid the abuse of raw strings for Windows paths). >> >>Why do you consider that abuse of raw strings? > > I consider it abuse because it's not what they were invented for. > I consider

Re: Why are so many built-in types inheritable?

2006-03-24 Thread Kent Johnson
Fabiano Sidler wrote: > Hi folks! > > For debugging purposes I tried this: > > --- snip --- > def foo(): pass > function = type(foo) > > class PrintingFunction(function): > def __init__(self, func): > self.func = func > def __call__(self, *args, **kwargs): > print args, kwargs >

Re: encoding problems (é and è)

2006-03-24 Thread Serge Orlov
Martin v. Löwis wrote: > John Machin wrote: > >> and, for things like u'\u0565\u0582' (ARMENIAN SMALL LIGATURE ECH > >> YIWN), it does not even work. > > > > Sorry, I don't understand. > > 0565 is stand-alone ECH > > 0582 is stand-alone YIWN > > 0587 is the ligature. > > What doesn't work? At first

Re: Remove integer from float number

2006-03-24 Thread Michael Tobis
I think you ought to make your own class and define some of the special methods. mt -- http://mail.python.org/mailman/listinfo/python-list

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > >> (homework? a puzzle book?), I am just > >> wondering where the puzzle came from. > > > > The OP mentioned it came from a puzzle game That made me > > think there was likely at least one solution. > > Right, a computer puzzle game (a Myst-style

Re: Caching in memory for Apache

2006-03-24 Thread grahamd
Simon Johnson wrote: > Dear All, > > I have decided to take the big plunge and drop the Microsoft platform > and use Mod_Python and Apache in it's place. > > I've never used Linux before this project so it's a really big learning > curve, but so far it's going well. I've managed to create some si

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > You have 4 panels, each with 20 lamps (label them 19 to 0): > > > > panel A > > panel B > > panel C > > panel D > > I'm sorry for being so dense, but I don't und

Re: New Python logo in high resolution format

2006-03-24 Thread Adam DePrince
On Fri, 2006-03-24 at 10:49 -0800, Robert Hicks wrote: > How about we all get tatoos? : ) ... still trying to scrape the old one off ... > > Robert > -- http://mail.python.org/mailman/listinfo/python-list

Re: Incremental Compression

2006-03-24 Thread Adam DePrince
On Sat, 2006-03-25 at 03:08 +0200, Eyal Lotem wrote: > Hey. > > I have a problem in some network code. I want to send my packets compressed, > but I don't want to compress each packet separately (via .encode('zlib') or > such) but rather I'd like to compress it with regard to the history of the >

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > a = [0xf5fdc,0xf6edb,0xbddb7,0x6fddd,0xeb7ed,0xb977f,0xbfed3,0xedef5] > > b = [0xddb7d,0xfaddb,0xde75f,0xeef7a,0xdd77b,0xdfbce,0xb77dd,0x7ef5d] > > c = [0xf37bd,0xdfaee,0xddd6f,0xddfb6,0xb9efb,0xb7bbe,0xecfbd,0xb75df] > > d = [0x77edb,0xbb7ee,0x

Re: newbie parsing question

2006-03-24 Thread Kun
[EMAIL PROTECTED] wrote: > Use Regular expressions > http://docs.python.org/lib/module-re.html > i tried to parse (below) with the regular expression: emails = re.findall('\S*\s([EMAIL PROTECTED])', senders) and got the following error: Traceback (most recent call last): File "/Life/School/H

Incremental Compression

2006-03-24 Thread Eyal Lotem
Hey. I have a problem in some network code. I want to send my packets compressed, but I don't want to compress each packet separately (via .encode('zlib') or such) but rather I'd like to compress it with regard to the history of the compression stream. If I use zlib.compressobj and flush it to ge

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > a = [0xf5fdc,0xf6edb,0xbddb7,0x6fddd,0xeb7ed,0xb977f,0xbfed3,0xedef5] > b = [0xddb7d,0xfaddb,0xde75f,0xeef7a,0xdd77b,0xdfbce,0xb77dd,0x7ef5d] > c = [0xf37bd,0xdfaee,0xddd6f,0xddfb6,0xb9efb,0xb7bbe,0xecfbd,0xb75df] > d = [0x77edb,0xbb7ee,0xdf773,0x7bdeb,0x7ddaf,0xdeeeb,0x

Re: How do I handle #

2006-03-24 Thread Irmen de Jong
Michael Sperlle wrote: > I need to write out a file containing the # comment. When I try to specify > it as part of a literal, everything afterward turns into a comment. > > I finally created a file containing the #, read it in, and used the > resulting variable as part of the string I created. >

Re: How do I handle #

2006-03-24 Thread Felipe Almeida Lessa
Em Sáb, 2006-03-25 às 00:46 +, Michael Sperlle escreveu: > I need to write out a file containing the # comment. When I try to specify > it as part of a literal, everything afterward turns into a comment. $ python Python 2.3.5 (#2, Mar 6 2006, 10:12:24) [GCC 4.0.3 20060304 (prerelease) (Debian

How do I handle #

2006-03-24 Thread Michael Sperlle
I need to write out a file containing the # comment. When I try to specify it as part of a literal, everything afterward turns into a comment. I finally created a file containing the #, read it in, and used the resulting variable as part of the string I created. But that is so kludgy, even a newb

Re: newbie parsing question

2006-03-24 Thread raviteja . bhupatiraju
Use Regular expressions http://docs.python.org/lib/module-re.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Caching in memory for Apache

2006-03-24 Thread Adam DePrince
On Fri, 2006-03-24 at 06:56 -0800, Simon Johnson wrote: > Dear All, > > I have decided to take the big plunge and drop the Microsoft platform > and use Mod_Python and Apache in it's place. > > I've never used Linux before this project so it's a really big learning > curve, but so far it's going w

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > You have 4 panels, each with 20 lamps (label them 19 to 0): > > panel A > panel B > panel C > panel D I'm sorry for being so dense, but I don't understand this. There are four panels,

newbie parsing question

2006-03-24 Thread Kun
i have a list of that is: [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] how do i parse the email addresses out of it into another list or string? -- http://mai

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: >> (homework? a puzzle book?), I am just >> wondering where the puzzle came from. > > The OP mentioned it came from a puzzle game That made me > think there was likely at least one solution. Right, a computer puzzle game (a Myst-style game called Realms of Illusion), an

Re: C-API: A beginner's problem

2006-03-24 Thread baalbek
Fabian Steiner wrote: > What do I have to change in order to make the code work? I'm afraid to say: your knowledge of C :-) But don't worry, C is an easy language to learn, and a very valuable skill to have. Baalbek -- http://mail.python.org/mailman/listinfo/python-list

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
Michael Tobis wrote: > Yeah, I misread the question, but the gist of my query remains. > > > The odds are 100% if there is at least one solution. > > Let's not get too philosophical. My question was whether there was an a > priori reason for believing that there is a solution. > > > You want perm

Re: Why are so many built-in types inheritable?

2006-03-24 Thread Fabiano Sidler
Hello? Or, is there any obvious reason for this behaviour I don't see? -- http://mail.python.org/mailman/listinfo/python-list

Re: imap folder scanner

2006-03-24 Thread Kun
Marco Carvalho wrote: > On 3/24/06, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > >> m.select('myfolder') > > Some attention is required here to retrieve subfolders. > Some imap servers like Cyrus and Courier uses "INBOX.subfolder" to > access subfolders. > -- > Marco Carvalho (macs) | marcoacarv

Re: a problem to solve

2006-03-24 Thread Michael Tobis
Yeah, I misread the question, but the gist of my query remains. > The odds are 100% if there is at least one solution. Let's not get too philosophical. My question was whether there was an a priori reason for believing that there is a solution. > You want permutations with replacement, so there

Re: imap folder scanner

2006-03-24 Thread Marco Carvalho
On 3/24/06, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > m.select('myfolder') Some attention is required here to retrieve subfolders. Some imap servers like Cyrus and Courier uses "INBOX.subfolder" to access subfolders. -- Marco Carvalho (macs) | marcoacarvalho(a)gmail.com http://arrakis.no-ip.i

Re: encoding problems (é and è)

2006-03-24 Thread Martin v. Löwis
John Machin wrote: >> and, for things like u'\u0565\u0582' (ARMENIAN SMALL LIGATURE ECH >> YIWN), it does not even work. > > Sorry, I don't understand. > 0565 is stand-alone ECH > 0582 is stand-alone YIWN > 0587 is the ligature. > What doesn't work? At first guess, in the absence of an Armenian

Re: imap folder scanner

2006-03-24 Thread Kun
Sebastjan Trepca wrote: > A very simple example... > > import imaplib > m = imap.IMAP4() > m.login(username,password) > m.select('myfolder') > status, data = m.search(None,'(SUBJECT "BIKES")') > assert status=='OK', "Error. Message: %s"%data > data = data[0] #you get your results in a list and sea

Re: Python types

2006-03-24 Thread Bruno Desthuilliers
Salvatore a écrit : > Hello, > > I've read several articles where it's said that Python is weakly typed. > I'm a little surprised. All objects seem to have a perfectly defined > type > Am i wrong? Depends on your definition of 'type'. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiplying sequences with floats

2006-03-24 Thread Fredrik Lundh
Caleb Hattingh wrote: > I agree that integer division should return an integer, because > using the operator at all means you expect one. so what is x / y ? an integer division ? something else ? -- http://mail.python.org/mailman/listinfo/python-list

Please help me to resolve this issue

2006-03-24 Thread Yanping Zhang
Hello everyone, I am pretty new in python. Please give me any idea about this issue: There is a function like this in my c dll: typedef void (WINAPI *myCallBack) (unsigned int myarg1, unsigned int myarg2) bool myfunc(myCallBack mycall) In my python code, I was able to access other functions

Re: Multiplying sequences with floats

2006-03-24 Thread Caleb Hattingh
Hi Christoph On my linux py-2.4.1: >>> 4.0//2 # Integer division, but still returns a float. 2.0 >>> 4.0//2 == 2 True >>> 4.0//2 doesn't return an integer, but the equality against an integer still holds. I agree that integer division should return an integer, because using the operator at all

Re: Python types

2006-03-24 Thread [EMAIL PROTECTED]
Salvatore wrote: > Hello, > > I've read several articles where it's said that Python is weakly typed. > I'm a little surprised. All objects seem to have a perfectly defined > type > > Am i wrong? No, you're right. It seems like a lot of people conflate weak vs. strong typing and static vs. dyna

Python C wrapper question

2006-03-24 Thread Shi, Jue
Hello, Gurus, I have a question on wrapping C function in Python. My C code is like this: typedef void (WINAPI *myCallBack) (unsigned int myarg1, unsigned int myarg2) bool myfunc(myCallBack callfunc) Now I want to call myfunc in Python, what should I do? Thanks, Stone -- http://mail.py

Re: Python types

2006-03-24 Thread Steven Bethard
Salvatore wrote: > I've read several articles where it's said that Python is weakly typed. > I'm a little surprised. All objects seem to have a perfectly defined > type Hoping to head off another debate: http://wiki.python.org/moin/StrongVsWeakTyping STeVe -- http://mail.python.org/mailman/

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > John Salerno wrote: > > John Salerno wrote: > > > > > Anyway, any advice for how to proceed would be great! I hope I described > > > it well enough. > > > > Ok, after reading the suggestions, I feel better about proceeding. But > > one question: how exactly do I come up

Re: Python types

2006-03-24 Thread Ben Finney
"Salvatore" <[EMAIL PROTECTED]> writes: > I've read several articles where it's said that Python is weakly > typed. I'm a little surprised. All objects seem to have a perfectly > defined type > > Am i wrong? You're right. All Python values are strongly typed; they don't, in general, change their

Re: Strings and % sign fails - Help Please

2006-03-24 Thread Fredrik Lundh
Siah wrote: > Problem Solved. The problem was with psycopg.Binary whose mere job is > to convert bytes into clear text for sql statement. no, its job is to wrap strings that contain binary blobs, so that data binding works properly. you're supposed to do cursor.execute(statement, Binary(da

Re: New development windows, IronPython or PythonWin

2006-03-24 Thread Caleb Hattingh
Hi Dan Pythonwin just adds support for specifically MS Windows features, most prominently COM; writing Excel scripts in python is so cool. The standard python distribution for windows runs perfectly on windows. I'm not sure whether this was clear to you or not. Also, Thomas ctypes and comtypes

Re: COM Client / Server creation?

2006-03-24 Thread John J. Lee
[EMAIL PROTECTED] (John J. Lee) writes: [...] > Not covered in the book, and particularly useful for implementing > native clients and servers is ctypes / comtypes (but still not stable; > also, I've only personally used it for writing a client, and a very > simple one at that): > > http://starshi

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
Michael Tobis wrote: > First do a little estimation. We know we have to find four out of 16 > switches, 4 panels, eight switches each, 32 total. > so the number of possibilities to search is only C(4,16) = > 1820, so an exhaustive search will work. Yes, but for the wrong reason. It's not combina

Re: Performance profiling Python code

2006-03-24 Thread Felipe Almeida Lessa
Em Sex, 2006-03-24 às 15:58 -0500, Jack Diederich escreveu: > As a last resort you can write the sensitive bits in C and add a python > wrapper. For the ICFP contest[1] each year I write the few primitives > in C and all the logic in python and it works quite well. Before that, try Psyco. It help

Looking for a Python wrapper for Nvidia Cg

2006-03-24 Thread AIM
Hello all, I am working on some games and some Nvidia Cg graphics. I am looking for python that provides wrappers over the Nvidia Cg API. Does anyone know where I may find what I am looking for? AIM -- http://mail.python.org/mailman/listinfo/python-list

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > John Salerno wrote: > > > Anyway, any advice for how to proceed would be great! I hope I described > > it well enough. > > Ok, after reading the suggestions, I feel better about proceeding. But > one question: how exactly do I come up with 32 different 20-bit integers > for ea

Re: Strings and % sign fails - Help Please

2006-03-24 Thread Siah
Problem Solved. The problem was with psycopg.Binary whose mere job is to convert bytes into clear text for sql statement. I'll be filing a bug. Thanks everyone, Sia -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test wxPython by unittest

2006-03-24 Thread Frank Niessink
sillyemperor: > I was a new guy of Python,when i want to test my wxPython app by > unittest,it couldn`t work.I fund a stubmaker.py but it only for > wxDialog but all widgets.Can someone can tell me how test wxPython by > unittest?Thanks > Here's a small example to get you started: import unitte

Re: converting to a binary number?

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > John Salerno wrote: >> I'm having some trouble finding a function that converts numbers >> (whether integer, hex, whatever) to its binary representation. Is there one? >> >> Thanks. > > Get the Gnu Multiple Precision library for Python module (Google GMPY). Thanks! --

Re: Linear regression in NumPy

2006-03-24 Thread nikie
> The version I have in front of me is a bit shorter, 252 pages, but describes > polyfit in section 5.3 on page 91 along with the other polynomial functions. > lstsq (linear_least_squares is a backwards-compatibility alias that was > recently > moved to numpy.linalg.old) is described in section 10

Re: What's The Best Editor for python

2006-03-24 Thread Christoph Zwerschke
Just because nobody has mentioned them so far: - SciTe is a perfect editor for Pyhton on Win and Linx - PyScripter is a wonderful IDE (but only on Win) - DrPython is a nice platform independent editor/mini-IDE There is no one editor that could be called the best one, but there are many which are

Re: a problem to solve

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > Then you'll want to represent the lights as a 20-bit binary number. > > > > Each bit position corresponds to 4 lamps > > I'm not sure I understand that. If I use a 20-bit number, wouldn't each > bit correspond to a single light on each switch? Wh

Re: Multiplying sequences with floats

2006-03-24 Thread Christoph Zwerschke
Andrew Koenig wrote: > Christoph Zwerschke wrote: > >> Anyway this would be an argument only against the variant of typecasting a >> float with a fractional part. But what about the other variant which >> raises an error if there is a fractional part, but works if the float is >> actually an ex

Re: What's the best way to learn perl for a python programmer?

2006-03-24 Thread Paddy
Tell 'them' you need a uniform installation of your scipting language across all servers to ensure correct operation of your script then ensure its python that gets loaded ;-) I took a course in perl from Well House Consultants in the UK, which was good; then had an immediate use for perl, which h

Re: converting to a binary number?

2006-03-24 Thread Kent Johnson
John Salerno wrote: > I'm having some trouble finding a function that converts numbers > (whether integer, hex, whatever) to its binary representation. Is there one? You might like this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286 Kent -- http://mail.python.org/mailman

Re: What's The Best Editor for python

2006-03-24 Thread Miguel E.
PythonStudent wrote: > Hi, > Can one of you say to me what's the best editor for editing the python > programs ( for linux or windows ) What may be "best" for me, may not necessarily work for you nor anybody else. Personally, I like to use Kate, Pico, or Joe on Linux, and Notepad2 or IDLE editor

Re: Performance profiling Python code

2006-03-24 Thread Jack Diederich
On Fri, Mar 24, 2006 at 09:33:55PM +0100, Andreas R?sdal wrote: > Hi, > > I'm using the Python profiler to optimize a pathfinding algorithm of a > game, and would like some help from someone who knows how to improve the > performance of Python code. The algorithm is A-Star, and it works > correctl

Re: Help: Creating condensed expressions

2006-03-24 Thread Michael Spencer
[EMAIL PROTECTED] wrote: > Nevermind, I didn't understand the problem/question... Sorry. > > Bye, > bearophile > Really? Your solution looks fine to me. In any case, here's an alternative approach to the (based on the same understanding of the problem as bearophile's, but with the additional

Re: a problem to solve

2006-03-24 Thread Michael Tobis
First do a little estimation. We know we have to find four out of 16 switches, so the number of possibilities to search is only C(4,16) = 1820, so an exhaustive search will work. These will turn on 15 lights in each set of 20, of which the number of possibilities is C(15,20)**4 = 57779667567968256

Re: Python types

2006-03-24 Thread Diez B. Roggisch
Steve M schrieb: > I think it means that names, not objects, are weakly typed. So you can > have: > a = 4 > a = 'hello' > > and there is no problem. The name 'a' doesn't have any type associated > with it. This contrasts with strongly typed language like C where you > declare the type of the name

Performance profiling Python code

2006-03-24 Thread Andreas Røsdal
Hi, I'm using the Python profiler to optimize a pathfinding algorithm of a game, and would like some help from someone who knows how to improve the performance of Python code. The algorithm is A-Star, and it works correctly. However, the interface that I made between the A-Star pathfinding algorit

Re: converting to a binary number?

2006-03-24 Thread astyonax
that's great! I will try! :-)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help: Creating condensed expressions

2006-03-24 Thread Eddie Corns
David Hirschfield <[EMAIL PROTECTED]> writes: >Here's the problem: Given a list of item names like: >apple1 >apple2 >apple3_SD >formA >formB >formC >kla_MM >kla_MB >kca_MM >which is a subset of a much larger list of items, >is there an efficient algorithm to create condensed forms that match >t

Re: converting to a binary number?

2006-03-24 Thread [EMAIL PROTECTED]
John Salerno wrote: > I'm having some trouble finding a function that converts numbers > (whether integer, hex, whatever) to its binary representation. Is there one? > > Thanks. Get the Gnu Multiple Precision library for Python module (Google GMPY). >>> import gmpy >>> help(gmpy.digits) Help on

Re: Python types

2006-03-24 Thread Steve M
I think it means that names, not objects, are weakly typed. So you can have: a = 4 a = 'hello' and there is no problem. The name 'a' doesn't have any type associated with it. This contrasts with strongly typed language like C where you declare the type of the name (variable) and the compiler objec

Re: Help: Creating condensed expressions

2006-03-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Nevermind, I didn't understand the problem/question... Sorry. actually, I think *you* got it right. -- http://mail.python.org/mailman/listinfo/python-list

Python types

2006-03-24 Thread Salvatore
Hello, I've read several articles where it's said that Python is weakly typed. I'm a little surprised. All objects seem to have a perfectly defined type Am i wrong? Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: a problem to solve

2006-03-24 Thread John Salerno
John Salerno wrote: > Anyway, any advice for how to proceed would be great! I hope I described > it well enough. Ok, after reading the suggestions, I feel better about proceeding. But one question: how exactly do I come up with 32 different 20-bit integers for each switch? Do I need to figure

Re: overlapping sets

2006-03-24 Thread Lonnie Princehouse
There is a sets.Set class built in to Python. You might want to use this instead of lists. It defines some handy set operations like intersection, union, and so on. from sets import Set my_sets = { 'one' : Set([0,4,7,9]), 'two' : Set([0,3,7,9]), etc... } -- http://mail.python.org/mailm

Re: a problem to solve

2006-03-24 Thread John Salerno
[EMAIL PROTECTED] wrote: > Then you'll want to represent the lights as a 20-bit binary number. > > Each bit position corresponds to 4 lamps I'm not sure I understand that. If I use a 20-bit number, wouldn't each bit correspond to a single light on each switch? What do you mean that each bit is

converting to a binary number?

2006-03-24 Thread John Salerno
I'm having some trouble finding a function that converts numbers (whether integer, hex, whatever) to its binary representation. Is there one? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: encoding problems (� and

2006-03-24 Thread Fredrik Lundh
John Machin wrote: > Some of the transformations are a little unfortunate :-( here's a slightly silly way to map a unicode string to its "unaccented" version: ### import unicodedata, sys CHAR_REPLACEMENT = { 0xc6: u"AE", # LATIN CAPITAL LETTER AE 0xd0: u"D", # LATIN CAPITAL LETTER ETH

Attempting to get lighttpd, fastcgi & python working

2006-03-24 Thread venkatbo
Hi folks, I'm trying to get lighttpd, fastcgi & python working on a 2.4.21.x i686 linux system. I tried following the steps in: http://www.cleverdevil.org/computing/24/python-fastcgi-wsgi-and-lighttpd Some of the lighttpd.conf setting are slightly different from those in that article - fixing som

Re: Help: Creating condensed expressions

2006-03-24 Thread bearophileHUGS
Nevermind, I didn't understand the problem/question... Sorry. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Help: Creating condensed expressions

2006-03-24 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > David Hirschfield a écrit : > >> Here's the problem: (snip) >> >> is there an efficient algorithm to create condensed forms that match >> those items, Sorry, answered to fast... Well, at least you have a way to test the algo !-) -- http://mail.python.org/mailm

Re: Help: Creating condensed expressions

2006-03-24 Thread Bruno Desthuilliers
David Hirschfield a écrit : > Here's the problem: Given a list of item names like: > > apple1 > apple2 > apple3_SD > formA > formB > formC > kla_MM > kla_MB > kca_MM > > which is a subset of a much larger list of items, > is there an efficient algorithm to create condensed forms that match > tho

Re: Help: Creating condensed expressions

2006-03-24 Thread bearophileHUGS
This is a first try, is something like this enough for you? data = """apple1 apple2 apple3_SD formA formB formC kla_MM kla_MB kca_MM""".split() headtails = {} for word in data: head = word[:-1] if head in headtails: headtails[head].append(word[-1]) else: headtails[hea

Re: What's The Best Editor for python

2006-03-24 Thread Ian Parker
In message <[EMAIL PROTECTED]>, flamesrock <[EMAIL PROTECTED]> writes >I agree, Kate is a great linux editor! > >On windows, I'd have to say notepad2- kate for windows > Well, Notepad might be a bare-bones. I enjoy using UltraEdit, though not UEStudio (the IDE version). You can include a "wordf

Re: New development windows, IronPython or PythonWin

2006-03-24 Thread Bruno Desthuilliers
Dan a écrit : >>>IronPython is currently nowhere near production quality. I would not >>>recommend it. > > I realise its in beta. But long term, do you think that the win32com, > win32gui etc... will have no support because everyone jumps on the > Microsoft bandwagon? Aren't the windows support e

Re: Multiplying sequences with floats

2006-03-24 Thread Andrew Koenig
"Christoph Zwerschke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Anyway this would be an argument only against the variant of typecasting a > float with a fractional part. But what about the other variant which > raises an error if there is a fractional part, but works if the

Re: What's The Best Editor for python

2006-03-24 Thread Azolex
Wildemar Wildenburger wrote: > just to bloat this thread some more: > > Am I the only one using jEdit? I've yet to find better for developing in jython -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python logo in high resolution format

2006-03-24 Thread Robert Hicks
How about we all get tatoos? : ) Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: encoding problems (é and è)

2006-03-24 Thread John Machin
On 24/03/2006 11:44 PM, Peter Otten wrote: > John Machin wrote: > > >>0x00d0: ord('D'), # Ð >>0x00f0: ord('o'), # ð >>Icelandic capital eth becomes D, OK; but the small letter becomes o!!! > > > I see information flow from Iceland is a bit better than from Armenia :-) No information flow neede

Re: What's The Best Editor for python

2006-03-24 Thread Harlin Seritt
Was actually going to throw in jEdit for the category of what's good on both platforms... For someone who despises Java, I actually like it. :-) Harlin -- http://mail.python.org/mailman/listinfo/python-list

Re: What's The Best Editor for python

2006-03-24 Thread jlowery
Been using PyDev plugin for Eclipse for a week now... works pretty good, and integrates well with PyLint. Has some context-sensitive help, but not much. I wonder if writing a script to convert Python HTML docs to Javadoc format would help? H maybe I'll ask. -- http://mail.python.org/mail

Help: Creating condensed expressions

2006-03-24 Thread David Hirschfield
Here's the problem: Given a list of item names like: apple1 apple2 apple3_SD formA formB formC kla_MM kla_MB kca_MM which is a subset of a much larger list of items, is there an efficient algorithm to create condensed forms that match those items, and only those items? Such as: apple[12] apple3

Re: What's The Best Editor for python

2006-03-24 Thread Wildemar Wildenburger
just to bloat this thread some more: Am I the only one using jEdit? (really, I never see it mentioned anywhere ...) wildemar -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >