Nevermind, I didn't understand the problem/question... Sorry.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
[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
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
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
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
[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
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
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
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
that's great! I will try! :-))
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
[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
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
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
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
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
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
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
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
> 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
[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!
--
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
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
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
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
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
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
[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
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
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
"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
[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
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/
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
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
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
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
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
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
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
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
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
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
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
Hello? Or, is there any obvious reason for this behaviour I don't see?
--
http://mail.python.org/mailman/listinfo/python-list
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
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
[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
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
[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,
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
Use Regular expressions
http://docs.python.org/lib/module-re.html
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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.
>
[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
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
[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
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
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
>
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
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
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
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
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
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
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
>
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
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
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
[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
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
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
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
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
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
"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,
"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
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[
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
[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
[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
101 - 187 of 187 matches
Mail list logo