Re: Roguelike programmers needed

2005-09-17 Thread rpgnethack
LOL... I know, I know"true" roguelikes only use ASCII. But a number of people seem to want to add graphics eventually, probably via tiles, and I don't see the harm in it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Roguelike programmers needed

2005-09-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > I'm pretty sure we'll be using PyGames for the graphics, although a > traditional ASCII roguelike interface would be nice to have too. ??!!! How can you call it roguelike if it's not ascii ??? -- http://mail.python.org/mailman/listinfo/python-list

Roguelike programmers needed

2005-09-17 Thread rpgnethack
Hi everyone, A few of us over at RPGnet (http://www.rpg.net) have been talking about writing an open-source roguelike in Python. Right now, I'm looking for a few people join the dev team. All I'm asking is that you post one piece of code for the game per week. If we get enough people, the collabor

Re: End or Identify (EOI) character ?

2005-09-17 Thread Terry Reedy
"Madhusudan Singh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > I was wondering how does one detect the above character. It is returned > by > an instrument I am controlling via GPIB. EOI = chr(n) # where n is ASCII number of the character. # then whenever later if gpid_

Re: complex data types?

2005-09-17 Thread Steven D'Aprano
On Sat, 17 Sep 2005 20:49:32 -0500, richard wrote: > I'd like to have an array in which the elements are various data types. > How do I do this in Python? > > For example: > > array[0].artist = 'genesis' > array[0].album = 'foxtrot' > array[0].songs = ['watcher', 'time table', 'friday'] > arr

Re: complex data types?

2005-09-17 Thread [EMAIL PROTECTED]
That is a great example Gustavo... One way that Richard's error of array[0] equaling array[1] could be introduced would be by accidentally appending the 'music' class object onto his list, rather than creating a new instance of music each time. Changing the code: array.append(music()) array.appen

Re: reading files with error

2005-09-17 Thread Christian Stapfer
Maurice Ling <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > >>I have written a program to do something similar. My strategy is: >> * use os.read() to read 512 bytes at a time >> * when os.read fails, seek to the next multiple of 512 bytes >> and write '

Re: Software bugs aren't inevitable

2005-09-17 Thread Terry Hancock
On Saturday 17 September 2005 06:03 pm, Scott David Daniels wrote: > Sybren Stuvel wrote: > > ... Computers aren't happy. They couldn't care less about the > > programming language. > > This reminds me of a quote I love (and wish I could cite the > originator): > > Don't anthropomorphize com

Python game coding

2005-09-17 Thread Lucas Raab
Saw this on Slashdot (http://developers.slashdot.org/article.pl?sid=05/09/17/182207&from=rss) and thought some people might be interested in it. Direct link to the article is http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/ --

Re: complex data types?

2005-09-17 Thread Gustavo Picon
On Sat, 2005-09-17 at 23:34 -0500, Gustavo Picon wrote: > Maybe something like this? > > class music(object): > def __init__(self): > self.lst = {} > def __setattr__(self, name, value): > self.__dict__[name] = value > > array = [] > array.append(music()) > array.append(mus

Re: complex data types?

2005-09-17 Thread Gustavo Picon
On Sat, 2005-09-17 at 20:49 -0500, richard wrote: > I'd like to have an array in which the elements are various data types. > How do I do this in Python? > > For example: > > array[0].artist = 'genesis' > array[0].album = 'foxtrot' > array[0].songs = ['watcher', 'time table', 'friday'] > array

Re: MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Carsten Haese
On Sat, 17 Sep 2005 15:50:29 -0400, Ed Hotchkiss wrote > Ok. I am trying to read a csv file with three strings separated by commas. > I am trying to insert them into a MySQL DB online. > MySQLdb is installed, no problems. > > I think that I am having some kind of error with my csv going into > th

Re: complex data types?

2005-09-17 Thread [EMAIL PROTECTED]
richard wrote: > I'd like to have an array in which the elements are various data types. > How do I do this in Python? > > For example: > > array[0].artist = 'genesis' > array[0].album = 'foxtrot' > array[0].songs = ['watcher', 'time table', 'friday'] > array[1].artist = 'beatles' > array[1].album

Re: reading files with error

2005-09-17 Thread Maurice Ling
[EMAIL PROTECTED] wrote: I have written a program to do something similar. My strategy is: * use os.read() to read 512 bytes at a time * when os.read fails, seek to the next multiple of 512 bytes and write '\0' * 512 to the output I notice this code doesn't deal properly with short reads, but

Re: socket.gethostbyaddr problem

2005-09-17 Thread Irmen de Jong
Mohammed Smadi wrote: > hi; > I am trying to do some very basic socket programming and i get the > following error. Any help will be appreciated: > > Code: > import socket > x = socket.gethostbyaddr("www.google.ca") > > return an error: socket.herror: (1, 'Unknown host') You're using the wrong

Re: socket.gethostbyaddr problem

2005-09-17 Thread jepler
Perhaps you mean to use the function socket.gethostbyname instead. >>> import socket >>> socket.gethostbyaddr("www.google.ca") Traceback (most recent call last): File "", line 1, in ? socket.herror: (1, 'Unknown host') >>> socket.gethostbyname("www.google.ca") '64.233.167.147' Jeff pgpsZ1m3Oc

Re: Python 2.5 alpha

2005-09-17 Thread Aahz
In article <[EMAIL PROTECTED]>, D.Hering <[EMAIL PROTECTED]> wrote: > >Generally, what sort of compatibility problems should I expect if I >were to replace 2.4.1 with 2.5 alpha (current cvs dist)? I'm working >under gentoo linux 2.6. There is no Python 2.5 alpha. There is CVS head, which is curre

socket.gethostbyaddr problem

2005-09-17 Thread Mohammed Smadi
hi; I am trying to do some very basic socket programming and i get the following error. Any help will be appreciated: Code: import socket x = socket.gethostbyaddr("www.google.ca") return an error: socket.herror: (1, 'Unknown host') I tried replacing the web URL with an IP address on the net, o

Re: influence platorm during install -end user question

2005-09-17 Thread Tim Roberts
Peter Hartmann <[EMAIL PROTECTED]> wrote: >How do I influence the platform type during install? Could you look >at this and tell me what I'm doing wrong? It's still using >information from get_platform instead of using my preference. > >[EMAIL PROTECTED] pyosd-0.2.14]# python setup.py install >-

Re: Python:C++ interfacing. Tool selection recommendations

2005-09-17 Thread Diez B. Roggisch
> (I wonder, by the way, if it's a good idea to provide a very rich interface > between an application and embedded Python. I have no experience in the > area, but intuition tells me that simplicity and minimalism is important. > How well has this worked out in past projects?) Check out SIP and th

Re: reading files with error

2005-09-17 Thread jepler
I have written a program to do something similar. My strategy is: * use os.read() to read 512 bytes at a time * when os.read fails, seek to the next multiple of 512 bytes and write '\0' * 512 to the output I notice this code doesn't deal properly with short reads, but in my experience they ne

Re: Can someone explain what I've done wrong...

2005-09-17 Thread Jason
Thanks for the explanation JP Calderone. Have to say, I was confused with the post (I received via email, can't see it on the newsgroup yet) from Astan Chee saying he couldn't understand how the Person class was destroyed. I'm still new(ish) with Python but I was lead to believe the __del__ ca

complex data types?

2005-09-17 Thread richard
I'd like to have an array in which the elements are various data types. How do I do this in Python? For example: array[0].artist = 'genesis' array[0].album = 'foxtrot' array[0].songs = ['watcher', 'time table', 'friday'] array[1].artist = 'beatles' array[1].album = 'abbey road' array[1].songs

Re: Can someone explain what I've done wrong...

2005-09-17 Thread Jp Calderone
On Sun, 18 Sep 2005 02:10:50 +0100, Jason <[EMAIL PROTECTED]> wrote: >Hi, > >I'm following a tutorial about classes, and have created the following >(well, copied it from the manual buy added my own and wifes names)... > >class Person: > population=0 > > def __init__(self,name): > s

reading files with error

2005-09-17 Thread Maurice LING
Hi, I'm trying to read some files (video files) that seems to have some errors in it. Basically, I cannot copy it out of discs as that gives me an error message but I can still play the file using a media player like VLC or QuickTime. I understand that copying a file will also invoke checking

Can someone explain what I've done wrong...

2005-09-17 Thread Jason
Hi, I'm following a tutorial about classes, and have created the following (well, copied it from the manual buy added my own and wifes names)... class Person: population=0 def __init__(self,name): self.name=name print '(Initialising %s)' % self.name Person.p

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Pedro Werneck
On Sat, 17 Sep 2005 15:07:01 -0400 "Terry Reedy" <[EMAIL PROTECTED]> wrote: > If, after any further responses, you still think you have discovered a > bug, do file a report on SourceForge. Thanks... report id 1294232, Error in metaclass search order http://sourceforge.net/tracker/index.php?fun

End or Identify (EOI) character ?

2005-09-17 Thread Madhusudan Singh
Hi I was wondering how does one detect the above character. It is returned by an instrument I am controlling via GPIB. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wanted: mutable bitmap

2005-09-17 Thread vel . accel
You'd might be better off with Numarray or Scipy. Image and sparse matrix modules are with in the package, and there is direct functionality for PIL integration. Numarray is better documented: http://stsdas.stsci.edu/numarray/numarray-1.3.html/index.html -- http://mail.python.org/mailman/listinf

Re: threading.Thread vs. signal.signal

2005-09-17 Thread Jp Calderone
On Sat, 17 Sep 2005 19:24:54 -0400, Jack Orenstein <[EMAIL PROTECTED]> wrote: >I'd like to create a program that invokes a function once a second, >and terminates when the user types ctrl-c. So I created a signal >handler, created a threading.Thread which does the invocation every >second, and star

Re: Wanted: mutable bitmap

2005-09-17 Thread Tom Anderson
On Sat, 17 Sep 2005, it was written: > Tom Anderson <[EMAIL PROTECTED]> writes: > >> One thing that would be rather useful in various bits of programming >> i've done would be a mutable bitmap type. Am i right in thinking >> there's no such thing in the standard library? Is there an >> implemen

threading.Thread vs. signal.signal

2005-09-17 Thread Jack Orenstein
I'd like to create a program that invokes a function once a second, and terminates when the user types ctrl-c. So I created a signal handler, created a threading.Thread which does the invocation every second, and started the thread. The signal handler seems to be ineffective. Any idea what I'm doin

Re: Software bugs aren't inevitable

2005-09-17 Thread Scott David Daniels
Sybren Stuvel wrote: > ... Computers aren't happy. They couldn't care less about the > programming language. This reminds me of a quote I love (and wish I could cite the originator): Don't anthropomorphize computers, they don't like that. --Scott David Daniels [EMAIL PROTECTED] -- http://m

Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
> Unfortunatly I stiill get the same error. :-( The same "metaclass bases[]" error?? > Here is the code: > import ftplib -snip- > if __name__ == '__main__': > ftp = ftplib.FTP("ftp.sadpanda.cjb.cc") > ftp.login("sadpanda","PASSWORDEDITIEDOUT") > filename = "/FrenchBrochure.pages

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

2005-09-17 Thread Jorgen Grahn
On Mon, 12 Sep 2005 12:52:52 +0200, gabor <[EMAIL PROTECTED]> wrote: > hi, > > there are 2 versions of a simple code. > which is preferred? I don't know. Who cares? > === > try: > text = line[n] > except IndexError: > text = 'nothing' > === > > > which is the one you would use? The '

Re: FTP status problems. (Again)

2005-09-17 Thread Nainto
Unfortunatly I stiill get the same error. :-( Here is the code: import ftplib class ProgressFile(file): def read(self, size = None): from sys import stdout if size is not None: buff = file.read(self, size) if bu

Python 2.5 alpha

2005-09-17 Thread D.Hering
Generally, what sort of compatibility problems should I expect if I were to replace 2.4.1 with 2.5 alpha (current cvs dist)? I'm working under gentoo linux 2.6. Specifically, should I expect any problems with Numarray, Scipy, or Pytables or IDE's. My degree of understanding such things is limited,

Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
Hello, > file = "/FrenchBrochure.pages.zip" > ftp.storbinary("STOR " + file, ProgressFile(file, "rb"), 1024) You are using file = "/FrenchBrochure.pages.zip" (sorry I did not notice earlier). You can not use file as variable name like you have, as it represents a file object in pyt

Re: pinging from within python

2005-09-17 Thread Jorgen Grahn
On Mon, 12 Sep 2005 01:36:35 +0200, billiejoex <[EMAIL PROTECTED]> wrote: > Impacket module can helps you to construct the ip/icmp packet structure, > then you can send the packet and wait for the ECHOREPLY by using a > RAW_SOCKET. > Here's an example: > http://oss.coresecurity.com/impacket/ping.

Re: pcapy listen on multiple devices

2005-09-17 Thread Jorgen Grahn
On Mon, 12 Sep 2005 17:02:31 +0200, billiejoex <[EMAIL PROTECTED]> wrote: > Hi all. I noticed that with the original pcap sniffing library it is > possible to listen on multiple devices by using "select()" or "poll()" > function. Yes; you can ask pcap for the file descriptor which corresponds to

Re: xml2schema

2005-09-17 Thread jegenye2001
Er, do you mean to generate a Relax NG (or possibly a DTD in fact) from some XML file?? If you do mean this then just think of that how you could generate grammar from some paragraphs of English text... Sorta non-trivial, if possible at all, isn't it? :-) Best regards, Miklos -- The ring of the

Re: urllib.open problem

2005-09-17 Thread Astan Chee
OKay, but how do I check (and possibly change) _proxy environment variables in python? I know in perl its somewhere along the lines of  $ENV{'env_name'}, is it the same in python? Thanks again Cheers Fredrik Lundh wrote: Astan Chee wrote: I have a python script which runs per

Re: "week-year" conversion to date

2005-09-17 Thread Jorgen Grahn
On 14 Sep 2005 06:26:01 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I was wondering if it there is an "easy" way to get the dd-mm- from > ww-. Note that there are different standards[0] for assigning numbers to weeks in a year. Whatever software or algorithm you use, make sure it

Re: disabling TCP connections, just for one script

2005-09-17 Thread dify . ltd
>From the post I gather that you are looking for a solution under Linux. I don't know much linux, but under Windows you could patch the IAT (import address table) of the running process temporarly to redirect calls to the socket winsock api to a stup function, which simply fails. If you are interes

Re: Wanted: mutable bitmap

2005-09-17 Thread Paul Rubin
Tom Anderson <[EMAIL PROTECTED]> writes: > One thing that would be rather useful in various bits of programming > i've done would be a mutable bitmap type. > Am i right in thinking there's no such thing in the standard library? > Is there an implementation out there somewhere else? Is there a hack

Wanted: mutable bitmap

2005-09-17 Thread Tom Anderson
Hello! One thing that would be rather useful in various bits of programming i've done would be a mutable bitmap type. Basically, this would behave like a set, where the items were constrained to be positive integers (perhaps less than some limit set at construction time). The advantage over a s

Re: Looking for a database. Sugestions?

2005-09-17 Thread Jarek Zgoda
ionel napisał(a): > I'm looking for a thread-safe database. > Preferably an embedded, sql database. > > What are the best choices in terms of speed ? Interbase/Firebird is thread-safe, is SQL-compliant. And once it was embedded. In a tank. M1 Abrams, specifically. At least the tale tells that...

Re: Looking for a database. Sugestions?

2005-09-17 Thread Jorgen Grahn
On 15 Sep 2005 22:22:30 -0700, Jeff Shell <[EMAIL PROTECTED]> wrote: > If it's embedded, is there any reason why it should be SQL? A solid > alternative could me MetaKit, which has Python bindings: Or Berkeley DB, which has bindings in the standard Python library: the bsddb module. But we know al

Re: Python:C++ interfacing. Tool selection recommendations

2005-09-17 Thread Jorgen Grahn
On Fri, 16 Sep 2005 12:04:40 -0400, Neal Becker <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> Hi, >> >> I am embedding Python with a C++ app and need to provide the Python >> world with access to objects & data with the C++ world. >> >> I am aware or SWIG, BOOST, SIP. Are there more?

MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Ed Hotchkiss
Ok. I am trying to read a csv file with three strings separated by commas. I am trying to insert them into a MySQL DB online. MySQLdb is installed, no problems. I think that I am having some kind of error with my csv going into the fields and being broken apart correctly. Can someone please help?

Re: FTP status problems. (Again)

2005-09-17 Thread Nainto
I'm really sorry that I keep having problems with this. :-( Now I get: TypeError: Error when calling the metaclass bases[] str() takes at most 1 arguement (3 given) and the Traceback is: file "formattedthing", line 2, in '?' classProgressFile(file) With the following code: import ftplib class P

Re: MySQLdb - create table problem

2005-09-17 Thread Ed Leafe
On Sep 17, 2005, at 3:04 PM, Ed Hotchkiss wrote: > There is no oreilly in the code ... I still get an error, any other > ideas? sorry ... Strange; can you explain where the text quoted (reilly, Python, Archive, http:// python.oreilly.com/archive.html) came from, then? Also I notice

Re: Software bugs aren't inevitable

2005-09-17 Thread Terry Reedy
"Aahz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Note that I said "one reason". The primary reason is that tail-call > optimization destroys the call stack, which means that exception > semantics would have to change. If tail-call optimization were more > useful, he might be

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Terry Reedy
"Pedro Werneck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I still think this is a bug, not a documentation issue. As an sometimes bug report reviewer, I appreciate your posting this issue here to get a wider and quicker variety of responses than you might have on SF. If, a

Re: Inserting tuple from text file into database fields

2005-09-17 Thread Ed Hotchkiss
So I changed the code a little, still throwing the SQL syntax error. I still cannot seem to identify the problem.   # Script to add links from a comma deliminated file to a MySQL database# 9/16/05 import MySQLdb conn=MySQLdb.connect( host="www.freesql.org",   user="edhotchkiss",   port=3306,   pas

Re: sorting tuples...

2005-09-17 Thread Bengt Richter
On 17 Sep 2005 06:41:08 -0700, [EMAIL PROTECTED] wrote: >Hello guys, > >I made a script that extracts strings from a binary file. It works. > >My next problem is sorting those strings. > >Output is like: > > snip >200501221530 >John >*** long string here *** > >200504151625 >Clyde >*** cl

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Pedro Werneck
On 17 Sep 2005 08:51:50 -0700 "Michele Simionato" <[EMAIL PROTECTED]> wrote: Hi > I think this is more of a documentation issue than of a bug. No... I don't think it's a documentation issue. What's the problem with the documentation in this case ? Trying to use 'type' as a metaclass with a subcl

Re: Why doesn't IDLE editor windows have horizontal scrollbars?

2005-09-17 Thread D H
chuck wrote: > Well I don't want to start yet another thread on IDE's. I've googled > and all of that an am aware of most of the IDE's that are out there. I > am curious if there is someplace where statistics have been captured on > what IDE's most people are using. Since IDLE ships with Python

Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
That is because you have just taken marduk's program and included your ftp code... please see what he has done in the if __name__ == '__main__' part. He expects the file name as an commandline argument (sys.argv[1]) and since you just copied his code, you are invoking the script *without* the

Re: Software bugs aren't inevitable

2005-09-17 Thread Aahz
In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Aahz) writes: >> In article <[EMAIL PROTECTED]>, >> Paul Rubin wrote: >>> >>>Every serious FP language implementation optimizes tail calls and thus >>>using recursion instead of it

Re: p2exe using wine/cxoffice

2005-09-17 Thread Tim Roberts
James Stroud <[EMAIL PROTECTED]> wrote: > >I think the motivation is to ween people off of M$ products altogether, Well, CrossOver Office doesn't really do that. You're still running Microsoft Office. >...to get >them used to working an a unix environment and to the idea of using open >altern

Re: Dictionary sorting problem

2005-09-17 Thread Bengt Richter
On 17 Sep 2005 11:01:41 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: > >> or tell sorted what to do ;-) >> >> >>> original= { >> ... 'hello':135, >> ... 'goodbye':30, >> ... 'lucy':4, >> ... 'sky':55, >> ... 'diamonds':239843, >> ... 'yesterday':4 } >> >>> list(sorted(

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Michele Simionato
I think this is more of a documentation issue than of a bug. It may seems strange at first, but __metaclass__ and __class__ may be different. For instance, if M is metaclass >>> class C(object): pass >>> C.__metaclass__ = M you get a class with metaclass hook equal to M, but C.__class__ is stil

Re: Britney Spears nude

2005-09-17 Thread robin
"Ian Osgood" <[EMAIL PROTECTED]> wrote: >Wouldn't Natasha Kinski be more apropos for this newsgroup? (In case >Python needs a poster girl...) > >http://snakeskins0.tripod.com/eden.html That would be Nastassja Kinski. But you are correct, it is a python. Photo by Richard Avedon. - robin noi

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Pedro Werneck
On 17 Sep 2005 02:04:39 -0700 "Simon Percivall" <[EMAIL PROTECTED]> wrote: > Have you read the "Metaclasses" part of "Unifying types and classes in > Python 2.2"? (http://www.python.org/2.2.3/descrintro.html#metaclasses) Yes, I read. Have you read and understood my message ? :) A class B, subcla

Shed Skin under Windows and OSX

2005-09-17 Thread Mark Dufour
> By the way, I read in your blog that you would be releasing a windows > intaller soon. > Have you, or anyone else, managed to do it? I just finished making a 20 MB (!) package for Windows XP (I'm not sure which older versions of Windows it will run on.) It includes the Boehm garbage collector an

traceback from embedded python

2005-09-17 Thread Skink
hi, I'm using boost::python for calling some python code and when the exception is thrown I want to get type, value and traceback of it. The problem is with traceback: I got only *one* frame (the first one) // this always returns Py_None tb_frame = PyObject_GetAttrString(tb_frame, "f_back"); Wh

Re: First release of Shed Skin, a Python-to-C++ compiler.

2005-09-17 Thread Luis M. Gonzalez
This is great news. Congratulations! By the way, I read in your blog that you would be releasing a windows intaller soon. Have you, or anyone else, managed to do it? Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode-aware file shortcuts in Windows

2005-09-17 Thread Martin v. Löwis
John Bauman wrote: > I see that another way is available here: > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp > I haven't tried, and I don't have the knowledge to convert the C++ to

ANN: eric3 3.7.2 released

2005-09-17 Thread Detlev Offenbach
Hi, this is to let you know about the release of eric3 3.7.2. This is a bugfix release, which is compatible with PyQt 3.15. It is available at http://www.die-offenbachs.de/detlev/eric3.html What is it? --- Eric3 is a Python and Ruby IDE written in Python and PyQt. It comes with all batte

Re: Brute force sudoku cracker

2005-09-17 Thread Bas
>> def all(seq, pred=bool): >What's this? What is bool? That came straight out of the manual for itertools: http://docs.python.org/lib/itertools-recipes.html -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with setup.py

2005-09-17 Thread Robert Kern
andrea valle wrote: > Thanks a lot. > I have bash as shell but I ignore what > >>your ~/.bashrc > > means. > > Have I to edit a file? > Where should it be? It's a file. ~/ means your home directory. The name of the file is .bashrc . You can't see it with the finder, so you have to edit it from

Re: Why doesn't IDLE editor windows have horizontal scrollbars?

2005-09-17 Thread Jussi Jumppanen
chuck wrote: > > The browser windows do. Why not the editor windows? > > I hate to complain but is there any way to get IDLE to > run in more of an MDI mode? FWIW the Zeus editor uses the MDI interface model: http://www.zeusedit.com/lookmain.html Zeus also has syntax highlighting and code

Re: sorting tuples...

2005-09-17 Thread bearophileHUGS
Uhm, if the file is clean you can use something like this: data = """\ 200501221530 John *** long string here *** 200504151625 Clyde *** clyde's long string here *** 200503130935 Jeremy *** jeremy string here """ records = [rec.split("\n") for rec in data.split("\n\n")] records.sort() print

Re: problem with setup.py

2005-09-17 Thread andrea valle
Thanks a lot. I have bash as shell but I ignore what > your ~/.bashrc means. Have I to edit a file? Where should it be? Thanks again -a- On 17 Sep 2005, at 12:46, Robert Kern wrote: > andrea valle wrote: >> Hi to all, >> and sorry for cross-posting. >> >> I'm having troubles with installin

Re: Brute force sudoku cracker

2005-09-17 Thread David Durkee
Hi Bas, I came across Soduko puzzles recently too and had the same reaction: why waste my time solving the things when it would be much more fun to write a Python program to do so? #!/usr/bin/python import sys import copy import EasyDialogs # Solve functions return these result codes: k

sorting tuples...

2005-09-17 Thread nidhog
Hello guys, I made a script that extracts strings from a binary file. It works. My next problem is sorting those strings. Output is like: snip 200501221530 John *** long string here *** 200504151625 Clyde *** clyde's long string here *** 200503130935 Jeremy *** jeremy string here **

Re: Brute force sudoku cracker

2005-09-17 Thread Benji York
Sybren Stuvel wrote: >>def all(seq, pred=bool): > > What's this? What is bool? See http://docs.python.org/lib/built-in-funcs.html#l2h-10 -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Brute force sudoku cracker

2005-09-17 Thread Pierre Barbier de Reuille
Tom Anderson a écrit : > On Fri, 16 Sep 2005, Bas wrote: > >> -any ideas how to easily incorporate advanced solving strategies? >> solve(problem1) and solve(problem2) give solutions, but >> solve(problem3) gets stuck... > > > the only way to solve arbitrary sudoku problems is to guess. Well, th

Re: Do thread die?

2005-09-17 Thread Maurice LING
> >> My current implementation may be ugly. I have a class >> >> class myThread(threading.Thread): >> def __init__(self, func): >> self.func = func >> threading.Thread.__init__(self) >> def run(self): >> print '%s function running' % self.func >> self.func(

Re: FTP status problems. (Again)

2005-09-17 Thread Nainto
When I execute the folllowing code with all of the address, username, and passwords filled out I gt an error saying: "/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python" "/Users/zacim/Documents/FireUpFTP/foramttedthing" ; exit Traceback (most recent call l

Re: Do thread die?

2005-09-17 Thread Steve Horsley
Maurice LING wrote: > Hi, > > I just have a simple question about threads. My classes inherits from > threading.Thread class. I am calling threading.Thread.run() method to > spawn a few threads to parallel some parts of my program. No thread > re-use, pooling, joining ... just plainly spawn a t

Re: FTP status problems. (Again)

2005-09-17 Thread Nainto
Thanks, I'll give this a try. This will print a period right? -- http://mail.python.org/mailman/listinfo/python-list

Re: Lines of Strings

2005-09-17 Thread Tom Anderson
On Thu, 15 Sep 2005, Reem Mohammed wrote: > Suppose we have data file like this one (Consider all lines as strings ) > > 1 2 3 3 4 4 4 4 5 6 > 2 2 2 5 5 5 6 > 3 2 1 1 1 3 3 3 4 6 > > I would like to remove line if its belong to another one, and will be > able to do this if longer line come after

Re: Brute force sudoku cracker

2005-09-17 Thread Tom Anderson
On Fri, 16 Sep 2005, Bas wrote: > -any ideas how to easily incorporate advanced solving strategies? > solve(problem1) and solve(problem2) give solutions, but solve(problem3) > gets stuck... the only way to solve arbitrary sudoku problems is to guess. of course, you have to deal with guessing w

Re: Dictionary sorting problem

2005-09-17 Thread Duncan Booth
Bengt Richter wrote: > or tell sorted what to do ;-) > > >>> original= { > ... 'hello':135, > ... 'goodbye':30, > ... 'lucy':4, > ... 'sky':55, > ... 'diamonds':239843, > ... 'yesterday':4 } > >>> list(sorted(original.iteritems(), None, lambda t:t[1], True)) > [('diamonds', 239843), ('hell

Re: problem with setup.py

2005-09-17 Thread Robert Kern
andrea valle wrote: > Hi to all, > and sorry for cross-posting. > > I'm having troubles with installing packages. > I'm on macosx 10.3.8 and I have activestate python 2.4 > > For example, pyrtf an pyx. > it is the first time I install packages so pardon me if it's obvious. > > I call python from

Re: Wrapping float

2005-09-17 Thread Sybren Stuvel
Bengt Richter enlightened us with: > Float is an immutable, so you need to override __new__ Thanks, that works! Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let

Re: Wrapping float

2005-09-17 Thread Robert Kern
Sybren Stuvel wrote: > Hi all, > > I'm trying to make a float-like class (preferably a subclass of > 'float') that wraps around. The background: I'm modeling a > multi-dimensional space, and some of those dimensions are circular. > > Here is my code so far: > > class WrapFloat(float): > def

problem with setup.py

2005-09-17 Thread andrea valle
Hi to all, and sorry for cross-posting. I'm having troubles with installing packages. I'm on macosx 10.3.8 and I have activestate python 2.4 For example, pyrtf an pyx. it is the first time I install packages so pardon me if it's obvious. I call python from terminal, I pass the absolute path of t

Re: Do thread die?

2005-09-17 Thread Bryan Olson
Maurice LING wrote: > Hi, > > I just have a simple question about threads. My classes inherits from > threading.Thread class. I am calling threading.Thread.run() method to > spawn a few threads to parallel some parts of my program. No thread > re-use, pooling, joining ... just plainly spawn a

Re: Wrapping float

2005-09-17 Thread Bengt Richter
On Sat, 17 Sep 2005 11:12:34 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >Hi all, > >I'm trying to make a float-like class (preferably a subclass of >'float') that wraps around. The background: I'm modeling a >multi-dimensional space, and some of those dimensions are circular. > >Here is my co

Re: Brute force sudoku cracker

2005-09-17 Thread Sybren Stuvel
Bas enlightened us with: > I came across some of these online sudoku games and thought after > playing a game or two that I'd better waste my time writing a solver > than play the game itself any longer. I managed to write a pretty > dumb brute force solver that can at least solve the easy cases >

Re: Do thread die?

2005-09-17 Thread Sybren Stuvel
Maurice LING enlightened us with: > So, at the end of run(), what happens to the thread? Just die? Yep. > While I am on it, can threading.Thread.run() accept any parameters? Nope. Pass them to the constructor and remember them. > class myThread(threading.Thread): > def __init__(self, func)

Re: Software bugs aren't inevitable

2005-09-17 Thread Sybren Stuvel
phil hunt enlightened us with: > If a program is too slow to respond isn't that about "system time"? Not by definition. Could be anything. If it's slow to respond due to a slow harddisk, then you're right. If it's slow to respond due to not putting the I/O and the GUI main loop in different thread

Wrapping float

2005-09-17 Thread Sybren Stuvel
Hi all, I'm trying to make a float-like class (preferably a subclass of 'float') that wraps around. The background: I'm modeling a multi-dimensional space, and some of those dimensions are circular. Here is my code so far: class WrapFloat(float): def __init__(self, value, wrap = None):

Re: 2.3 -> 2.4: long int too large to convert to int

2005-09-17 Thread Reinhold Birkenfeld
Grant Edwards wrote: > I give up, how do I make this not fail under 2.4? > > fcntl.ioctl(self.dev.fileno(),0xc0047a80,struct.pack("HBB",0x1c,0x00,0x00)) > > I get an OverflowError: long int too large to convert to int > > ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has > the hi

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Simon Percivall
Have you read the "Metaclasses" part of "Unifying types and classes in Python 2.2"? (http://www.python.org/2.2.3/descrintro.html#metaclasses) It discusses and explains the issues you seem to have. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rendering HTML

2005-09-17 Thread Jorgen Grahn
On 16 Sep 2005 22:56:06 -0700, Harlin Seritt <[EMAIL PROTECTED]> wrote: > Hi DH, > > Thanks for this blurb from ASPN. I am really looking, however, to do http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52297 > this on a Windows machine as opposed to a Unix one at this point. This > will c