Re: Semaphore or what should I use?

2004-12-06 Thread Pierre Barbier de Reuille
Sergei Organov a ecrit : Pierre Barbier de Reuille [EMAIL PROTECTED] writes: Ville Vainio a ecrit : Bastian == Bastian Hammer [EMAIL PROTECTED] writes: Bastian Now I have to make sure, that both threads are Bastian synchronal, 1 thread edits something and the other is Bastian blocked

Re: convert string to raw string?

2004-12-06 Thread Terry Reedy
Phd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm writing a regex related program that lets the user supplies the regex definition. Is there an easy way to convert a string into a raw string? There ain't no such thing as raw strings. Just 'raw' string *literals*,

[pywin32] windows shares, was os.listdir(\\\\delta\\public)

2004-12-06 Thread Egor Bolonev
Try grabbing the output of os.popen(rnet view \\delta) and parse it to get a list of the shares: c:\net view \\monolith Shared resources at \\monolith Share name Type Used as Comment --- Printer Print

Re: convert string to raw string?

2004-12-06 Thread Duncan Booth
Phd wrote: I'm writing a regex related program that lets the user supplies the regex definition. Is there an easy way to convert a string into a raw string? A raw string is a feature of the syntax of Python. Python gives you several ways to write strings: single quoted, double quoted,

Re: teaching OO

2004-12-06 Thread Alan Gauld
On 24 Nov 2004 18:31:13 GMT, Gabriel Zachmann [EMAIL PROTECTED] wrote: You know, I keep wondering exactly what we will be teaching as programming languages become easier and easier to learn. Programming itself? -- won't be enough for a whole semester. Oh no way. You could teach a whole

PDF count pages

2004-12-06 Thread Jose Benito Gonzalez Lopez
Hi there, Does anyone know how I could do in order to get/count the number of pages of a PDF file? (from python of course ;) ) Thanks beforehand. Cheers, Jose -- Jose Benito Gonzalez Lopez CERN Document Server ** http://cds.cern.ch/ ** cds.support @ cern.ch InDiCo Project **

Re: installing wxPython on Linux and Windows

2004-12-06 Thread rido dodol
Install ubuntu linuxget wxpython with synaptic...is easy!!! On Thu, 02 Dec 2004 10:19:12 +0100, Peter Maas [EMAIL PROTECTED] wrote: Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as

Re: pre-PEP generic objects

2004-12-06 Thread Jacek Generowicz
Jp Calderone [EMAIL PROTECTED] writes: When the class object is created, the namespace is scanned for instances of type 'function'. For those and only those, a descriptor is created which will produce bound and unbound methods. This isn't quite correct. A descriptior is any object which has

Re: Quixote+Nevow+LivePage

2004-12-06 Thread mirnazim
I m still without any helpful answers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive list comprehension

2004-12-06 Thread Peter Otten
Timothy Babytch wrote: Hi all. I have a list that looks like [['N', 'F'], ['E'], ['D']] I try to make it flat one: ['N', 'F', 'E', 'D'] How can I archieve such an effect with list comprehension? Two cycles did the job, but that way did not look pythonic.. I tried print [x for x in y

RE: [pywin32] windows shares, was os.listdir(\\\\delta\\public)

2004-12-06 Thread Tim Golden
[Egor Bolonev] | how to get list of shares using pywin32? You want to be looking at the NetShareEnum function in the win32net module. TJG This e-mail has been scanned for all viruses by Star. The service is powered by

suffix .py in IDLE

2004-12-06 Thread p.kosina
Its just for my convienience: When saving new file in IDLE I HAVE to always manually add suffix .py, otherwise it is saved without ANY suffix. Can it be set somewhere? Thank you Pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: PDF count pages

2004-12-06 Thread Andreas Lobinger
Aloha, Jose Benito Gonzalez Lopez wrote: Does anyone know how I could do in order to get/count the number of pages of a PDF file? Like this ? Python 2.2.2 (#3, Apr 10 2003, 17:06:52) [GCC 2.95.2 19991024 (release)] on sunos5 Type help, copyright, credits or license for more information. import

xmlrpclib or twisted?

2004-12-06 Thread flupke
Hi, previously i made an application that used sockets to do some network based processing. My next app is again going to be a client/server app and i wanted to see if i can't find an easier way to make the networking going. I bumped into xmlrpclib and also twisted (pb). I'm not sure which on of

Re: Recursive list comprehension

2004-12-06 Thread Peter Nuttall
On Monday 06 Dec 2004 09:26, Timothy Babytch wrote: Hi all. I have a list that looks like [['N', 'F'], ['E'], ['D']] I try to make it flat one: ['N', 'F', 'E', 'D'] How can I archieve such an effect with list comprehension? Two cycles did the job, but that way did not look pythonic.. I

Re: Curses programming, threads?

2004-12-06 Thread Bartlomiej Rymarski
Carl Banks [EMAIL PROTECTED] wrote: (...) But I recommend threads for this. It's one of the easiest possible uses of threads. There's no complex communication involved; locks and semaphores and stuff aren't required. Just connect to the database in a subthread, and have it set a global

Re: Recursive list comprehension

2004-12-06 Thread Nick Coghlan
Peter Nuttall wrote: I think you do it with a generator like this: def flatten(nested): for sublist in nested: for element in sublist: yield element n=[['N', 'F'], ['E'], ['D']] output=[] for value in flatten(n): output.append(value) print output I highly recommend learning about the

CTYPE 0.9.2 porting problems

2004-12-06 Thread Armin Steinhoff
Hi all, I ported ctypes 0.9.2 to QNX6.3 ... 99.9 % is working but only the unittest test_functions.py makes some problem. Here is the code: p = pointer(c_int(99)) result = f(p) self.failUnlessEqual(result.contents.value, 99) #--- works!! # We need to keep the

Re: long number multiplication

2004-12-06 Thread Nick Craig-Wood
I.V. Aprameya Rao [EMAIL PROTECTED] wrote: i have been wondering, how does python store its very long integers and perform aritmetic on it. i needed to implement this myself and was thinking of storing the digits of an integer in a list. however this would be very slow for

Re: Recursive list comprehension

2004-12-06 Thread Peter Otten
Nick Coghlan wrote: from itertools import chain n = [['N', 'F'], ['E'], ['D']] print [chain(*n)] However, [generator] is not the same as list(generator): from itertools import chain n = [['N', 'F'], ['E'], ['D']] print [chain(*n)] [itertools.chain object at 0x402ac60c] print

Re: Recursive list comprehension

2004-12-06 Thread Nick Coghlan
Peter Otten wrote: Nick Coghlan wrote: from itertools import chain n = [['N', 'F'], ['E'], ['D']] print [chain(*n)] However, [generator] is not the same as list(generator): Heh - good point. As you say, replacing with list() gives the intended answer. With regards to laziness, my main point was

Re: Quixote+Nevow+LivePage

2004-12-06 Thread Carlos Ribeiro
On 6 Dec 2004 01:15:35 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I m still without any helpful answers. I'm sorry to hear that. There were some answers (including mine) that may have not solved your problem, but at least we did try. That's the best one can ask far while posting on a

Float to int conversions (was: int(float(sys.maxint)) buglet)

2004-12-06 Thread Nick Coghlan
Sorry for the disconnected reply -I've been having news server issues, and just switched to the mailing list instead A quick check of the source code reveals that this behaviour is deliberate. There is apparently an issue with the corner case breaking badly (potentially raising an exception)

MySQL-python-1.0.0.win32-...

2004-12-06 Thread Henning Hanusa
Could anybody please provide me with a compiled version of the above (MySQLdb 1.0.0 for Python on Win 2000 / XP) for Python version 2.4, as I do not have any possibility of compiling?? Many thanks in advance Henning -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive list comprehension

2004-12-06 Thread Serhiy Storchaka
Timothy Babytch wrote: I have a list that looks like [['N', 'F'], ['E'], ['D']] I try to make it flat one: ['N', 'F', 'E', 'D'] How can I archieve such an effect with list comprehension? Two cycles did the job, but that way did not look pythonic.. I tried print [x for x in y for y in c_vars] and

Re: help asap

2004-12-06 Thread Steve Holden
the_proud_family wrote: HELP ME PLEASE!! my email is [EMAIL PROTECTED] I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be

Win32 Libs for 2.4

2004-12-06 Thread Robin Becker
Does anyone know if it is feasible to have static libraries for both 2.3 and 2.4 compatible extensions. I'm worrying about libjpeg etc in a win32 environment. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeking Python + Subversion hosting.

2004-12-06 Thread Roy Smith
[EMAIL PROTECTED] (Tom Locke) wrote: Anyone know of a good hosting company that offers both server-side Python and a subversion repository? Panix (www.panix.com) has svn and python installed on their unix hosts. You could certainly do CGI in python. Don't know if they have mod_python

Re: Ptyon 2.3.5 probably coming in January; get your bugs/patches reported!

2004-12-06 Thread Roy Smith
In article [EMAIL PROTECTED], Brett C. [EMAIL PROTECTED] wrote: Anthony Baxter, our ever-diligent release manager, mentioned this past week that Python 2.3.5 will most likely come to fruition some time in January (this is not guaranteed date). Interesting. Does that mean that 2.3 and 2.4

Re: exec and global puzzle

2004-12-06 Thread Steve Holden
Andr? Roberge wrote: I have the following two files: #--testexec.py-- def exec_code(co): try: exec co except: print error #-- test.py-- import thread import testexec import time code = def a():\n print 'a'\n\n +\ def c():\n a()\n\nc() code2 = def a():\n print 'a'\n\n

byte code generated under linux == bad magic number under windows

2004-12-06 Thread Philippe C. Martin
Hi, I understand from my reading that a .pyc generated by python anywhere should run anywhere else - is that true ? If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I get a 'bad magic number' trying to execute it under windows (2.4). What am I doing wrong ? are the pyc

Re: Win32 Libs for 2.4

2004-12-06 Thread Daniel Dittmar
Robin Becker wrote: Does anyone know if it is feasible to have static libraries for both 2.3 and 2.4 compatible extensions. I'm worrying about libjpeg etc in a win32 environment. Could you be a bit more specific: do you want to create a binary python extension that is compatible with both

Re: [pywin32] windows shares, was os.listdir(\\\\delta\\public)

2004-12-06 Thread Peter Hansen
Egor Bolonev wrote: Try grabbing the output of os.popen(rnet view \\delta) and parse it to get a list of the shares: c:\net view \\monolith No doubt you can also do this much more easily with the pywin32 package, or via COM (using pywin32 or ctypes), but I'll leave that response to someone else.

Re: I need to create the table and I want to edit its content from www level.

2004-12-06 Thread Fred Pacquier
[EMAIL PROTECTED] (Rootshell) said : I need to create the table and I want to edit its content from www level. Here is some example: http://www.rootshell.be/~flash44 There is a table. Is there possibilty to edit the content using input command? Could you show me the way how to do

Re: I need to create the table and I want to edit its content from www level.

2004-12-06 Thread Peter Hansen
Rootshell wrote: Yo, thanks for help Yeap, wikipedia is one of examples, the wikipedia script includes 'action=edit' command and it edits the file called 'wiki.phtml'. I want to edit the content of casual table. Have no idea how to give the password to a few users, so they can edit this small

RPC with Python - Comparison?

2004-12-06 Thread Wolfgang Keller
Hello, has anyone done a comparison of the different RPC protocols implementations available for Python that is more extensive and exhaustive than the one on http://www-106.ibm.com/developerworks/webservices/library/ws-pyth9/? Topics would be: - Runtime efficiency - Development efficiency -

Re: Deadlock detection

2004-12-06 Thread Stephen Kellett
Does anyone know of a deadlock detector for Python? I don't think it would be too hard to hook into the threading module and instrument mutexes so they can be tested for deadlocks. I've googled around but I haven't found anything. Software Verification have Python Thread Validator. Its not

Re: byte code generated under linux == bad magic number under windows

2004-12-06 Thread Laszlo Zsolt Nagy
I understand from my reading that a .pyc generated by python anywhere should run anywhere else - is that true ? If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I get a 'bad magic number' trying to execute it under windows (2.4). What am I doing wrong ? You should use the

Python parsers for C/C++/Java

2004-12-06 Thread shivaram.upadhyayula
Title: Python parsers for C/C++/Java Hi, I am looking for a parser generator to parse C, C++ and Java (including popular extensions from various compilers) source code; I have come across PLY, SPARK, D-parser (there seems to be a all-python version itself for this one), etc. and am

Re: Book Recommendations

2004-12-06 Thread elbows
Manuzhai wrote: Check this thread currently going on: http://groups.google.com/groups?hl=enlr=c2coff=1safe=offthreadm=coqd91%246m2%241%40news.doit.wisc.eduprev=/groups%3Fhl%3Den%26lr%3D%26c2coff%3D1%26safe%3Doff%26group%3Dcomp.lang.python The link doesn't work -- maybe because of the new

Re: Recursive list comprehension

2004-12-06 Thread Timothy Babytch
Serhiy Storchaka wrote: sum([['N', 'F'], ['E'], ['D']], []) ['N', 'F', 'E', 'D'] THE BEST! -- Timothy Babytch, PHP-dev Teamleader -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32 Libs for 2.4

2004-12-06 Thread Robin Becker
Daniel Dittmar wrote: Robin Becker wrote: Does anyone know if it is feasible to have static libraries for both 2.3 and 2.4 compatible extensions. I'm worrying about libjpeg etc in a win32 environment. Could you be a bit more specific: do you want to create a binary python extension that is

Re: xmlrpclib or twisted?

2004-12-06 Thread Istvan Albert
flupke wrote: I am planning to build a web GUI for the client so if i If you are planning to build a browser based interface then use an available webserver and don't build your own. Istvan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ptyon 2.3.5 probably coming in January; get your bugs/patches reported!

2004-12-06 Thread Aahz
In article [EMAIL PROTECTED], Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Brett C. [EMAIL PROTECTED] wrote: Anthony Baxter, our ever-diligent release manager, mentioned this past week that Python 2.3.5 will most likely come to fruition some time in January (this is not

Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-06 Thread Tim Peters
[Bengt Richter] Peculiar boundary cases: 2.0**31-1.0 2147483647.0 int(2147483647.0) 2147483647L int(2147483647L ) 2147483647 -2.0**31 -2147483648.0 int(-2147483648.0) -2147483648L int(-2147483648L ) -2147483648 some kind of one-off error? It would help if you were

Re: Ptyon 2.3.5 probably coming in January; get your bugs/patches reported!

2004-12-06 Thread Tim Peters
[Brett C] Anthony Baxter, our ever-diligent release manager, mentioned this past week that Python 2.3.5 will most likely come to fruition some time in January (this is not guaranteed date). [Roy Smith] Interesting. Does that mean that 2.3 and 2.4 will be maintained in parallel for a while?

Re: RPC with Python - Comparison?

2004-12-06 Thread has
Wolfgang Keller wrote: Candidates could be: - Pyro - Twisted.spread - OSE (XML-RPC) - ICE - ...others? MacPython also supports Apple events (high-level bridge: http://freespace.virgin.net/hamish.sanderson/appscript.html) HTH -- http://mail.python.org/mailman/listinfo/python-list

Re: byte code generated under linux == bad magic number underwindows

2004-12-06 Thread Fredrik Lundh
Aaron Bingham wrote: .pyc files are platform-independant but are incompatible between major Python versions. are incompatible should be may be incompatible you can use imp.get_magic() to get a string that identifies the bytecode version supported by the current interpreter; any interpreter

Re: The python2.4 IDLE can't be lanuched.

2004-12-06 Thread Brian Beck
AnkyHe wrote: I downloaded the python 2.4 final from the offical website and installed it on the WindowsXP+SP2 (Chinese version). There was not any problem in this process, but the IDLE can't be lanuched without any warnning. Is there anybody else encount this problem and how to resolve it?

Re: The python2.4 IDLE can't be lanuched.

2004-12-06 Thread Brian Beck
Brian Beck wrote: I have the exact same problem. The IDLE window just never opens, and checking the process list shows that is was never even launched. So I can't make much use of Python 2.4 since I use IDLE as my IDE... I forgot to note that I am also using Windows XP SP2 and this happens on

Re: The python2.4 IDLE can't be lanuched.

2004-12-06 Thread Abe Mathews
Don't know if this would help or not, but on my Linux 2.3 IDLE, I get the following warning on startup: Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's

Re: Win32 Libs for 2.4

2004-12-06 Thread Daniel Dittmar
Robin Becker wrote: actually I want to build the PIL extension for 2.4 as pyd and include various libraries eg zlib and jpeg. To avoid the missing dlls issue we have done this in the past by incorporating the zlib/jpeg code using static libraries for both zlib and jpeg. It seems I can use the

Re: help using sockets, and OOP?

2004-12-06 Thread Dfenestr8
On Sun, 05 Dec 2004 22:29:26 +, Jp Calderone wrote: Your problem doesn't seem to have anything to do with OOP (whatever that is). Rather, you are trying to use two blocking sockets at once. socket.connect() and socket.recv() are both blocking operations by default -

Re: any good, free web hosts supporting python cgi scripts?

2004-12-06 Thread araspus
please come to my website www.arasp.net You may be qualified. for my hosting plans. -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32 Libs for 2.4

2004-12-06 Thread Robin Becker
Daniel Dittmar wrote: Robin Becker wrote: actually I want to build the PIL extension for 2.4 as pyd and include various libraries eg zlib and jpeg. To avoid the missing dlls issue we have done this in the past by incorporating the zlib/jpeg code using static libraries for both zlib and jpeg.

Re: The python2.4 IDLE can't be lanuched.

2004-12-06 Thread Brian Beck
Abe Mathews wrote: I'm not running SP 2 on any machines, so I can't test it for you, but it may be that the personal firewall being activated on SP 2 is blocking IDLE from starting up. You might try turning that off and seeing if that helps. IIRC, part of SP 2 was port disabling. I do remember

Re: help using sockets, and OOP?

2004-12-06 Thread Grant Edwards
On 2004-12-06, Dfenestr8 [EMAIL PROTECTED] wrote: Ok, so what if I remove the while loop from the Botling class, and include it in the __main__ ? Might this work as a solution then? No. Ok, so are there other types of sockets that aren't blocking ? Yes, non-blocking ones. -- Grant

Re: help using sockets, and OOP?

2004-12-06 Thread Diez B. Roggisch
Ok, so are there other types of sockets that aren't blocking ? You don' want other types of sockets (they are pretty good the way the are) but other ways of using them. The topics you might need to delve into are threading, the select module and twisted. Which at least in part Jp already

Re: Mean, median, and mode

2004-12-06 Thread Josiah Carlson
[EMAIL PROTECTED] (Sean McIlroy) wrote: median = lambda x: (max(x)-min(x))/2 That is /not/ the median in the general case. median = lambda x: x.sort() or x[len(x)//2] - Josiah -- http://mail.python.org/mailman/listinfo/python-list

RE: Mean, median, and mode

2004-12-06 Thread Robert Brewer
Josiah Carlson wrote: [EMAIL PROTECTED] (Sean McIlroy) wrote: median = lambda x: (max(x)-min(x))/2 That is /not/ the median in the general case. median = lambda x: x.sort() or x[len(x)//2] That...is a really sneaky use of null return values. I like. :) Robert Brewer MIS Amor

Re: using cmd.exe as a telnet client

2004-12-06 Thread Donnal Walter
Grant Edwards wrote: You don't have to start from scratch. The telnet module has hooks built-into it1 so that you can have it call your routines to handle option negotiation. I did it once to impliment some extra Telnet protocol features, and it wasn't difficult. Ok, you've inspired me to give it

Re: help using sockets, and OOP?

2004-12-06 Thread Andy Gross
On Dec 6, 2004, at 12:04 PM, Dfenestr8 wrote: Ok, so are there other types of sockets that aren't blocking ? Yes, sockets can be either blocking or non-blocking. An I/O operation on a 'blocking' socket will not return until the operation is complete. If you try to read more bytes than are

Re: PIL and antialiasing problem

2004-12-06 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: Statement: Sometimes PIL is better than Adobe Photoshop. :-) I also found these with the aid of the wonderful dir() function: MinFilter, MaxFilter, MedianFilter, ModeFilter, RankFilter, BuiltInFilter They do not have a docstring and they are not documented in the

Re: asynchat and threading

2004-12-06 Thread Fredrik Lundh
Anthony Baxter wrote: AFAICT, the main complaint is that it is tied to the TCP transport, the sockets API, and the select/poll API. IOW, it cannot easily: - integrate TLS on top of TCP (because TLS might involve no-data communications, e.g. when TLS negotation happens in the middle

Re: using cmd.exe as a telnet client

2004-12-06 Thread Donnal Walter
Grant Edwards wrote: You don't have to start from scratch. The telnet module has hooks built-into it1 so that you can have it call your routines to handle option negotiation. I did it once to impliment some extra Telnet protocol features, and it wasn't difficult. Ok, you've inspired me to

Re: RPC with Python - Comparison?

2004-12-06 Thread Wolfgang Keller
Candidates could be: - Pyro I forgot to mention Corba here: - Omniorb - Orbit - Fnorb BTW: It seems to me that none of these provides an AMI implementation...? - Twisted.spread - OSE (XML-RPC) - ICE - ...others? MacPython also supports Apple events (high-level bridge:

ANN: eGenix mx Base Package 2.0.6 (mxDateTime, mxTextTools, etc.)

2004-12-06 Thread M.-A. Lemburg
ANNOUNCING eGenix.com mx Base Extension Package Version 2.0.6 Open Source Python extensions providing important and useful services for Python programmers.

Re: Mean, median, and mode

2004-12-06 Thread Michael Fuhr
Josiah Carlson [EMAIL PROTECTED] writes: Robert Brewer [EMAIL PROTECTED] wrote: Josiah Carlson wrote: median = lambda x: x.sort() or x[len(x)//2] That...is a really sneaky use of null return values. I like. :) Thank you, I'm just using a paradigm (exploiting lambdas) that I

Trying to understand a little python

2004-12-06 Thread McCarty, Greg
Ok, I'm new to python, and I'm trying to come to grips with a few things. Got lots of years of experience with Java and asp/aspx, etc. Trying to relate Python's behavior to what I already know. Here's the python code (line #'s added for my question) - 01 class Tester: 02 def

Re: Mean, median, and mode

2004-12-06 Thread Paul McGuire
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This median expression is incorrect. median is *not* the midpoint between max and min values. It is the middle value when all values are sorted (for an odd number of values), or the average of the two middle values when

Re: Trying to understand a little python

2004-12-06 Thread Jeremy Jones
McCarty, Greg wrote: Ok, I'm new to python, and I'm trying to come to grips with a few things. Got lots of years of experience with Java and asp/aspx, etc. Trying to relate Python's behavior to what I already know. Here's the python code (line #'s added for my question)

cut strings and parse for images

2004-12-06 Thread Andreas Volz
Hi, I used SGMLParser to parse all href's in a html file. Now I need to cut some strings. For example: http://www.example.com/dir/example.html Now I like to cut the string, so that only domain and directory is left over. Expected result: http://www.example.com/dir/ I know how to do this in

Re: Any affordable Python-based CRM ERP solutions?

2004-12-06 Thread EuGeNe
Will wrote: Hi all, Please excuse the longish post. I'm new to Python (and programming), but love what I see and believe it to be an important language. I have (at least) one retail client (with single outlet at present) that requires a total business solution for their operation, preferably open

Re: byte code generated under linux == bad magic number under windows

2004-12-06 Thread Jarek Zgoda
Aaron Bingham wrote: .pyc files are platform-independant but are incompatible between major Python versions. You can not use a .pyc file generated with Python 2.3 with Python 2.4 or vice versa. AFAIK, they *are* platform dependent. You can not share pyc files between ASCII and EBCDIC machine.

Re: [Python-Help] Programming help

2004-12-06 Thread Danny Yoo
On Mon, 6 Dec 2004, Alfred Canoy wrote: Please help me out:(.. I've been trying to figure this out for 2 days now.. I don't know what to use to print all the list of numbers. I hve know idea how should I do this. I tried a lot of trial error for the the def, dict, .list( ). have no luck.

Re: file descriptors fdopen

2004-12-06 Thread Jeremy Jones
Scott Frankel wrote: Why does os.fdopen('foo.txt', 'w') require an integer? Ultimately, I want to create a new file on disk. Funny, I can't seem to suss-out how to create a new file without resorting to os.system('touch foo.txt'). ... Or maybe not so funny ... foo = os.fdopen('foo.txt', 'w')

Re: file descriptors fdopen

2004-12-06 Thread Scott Frankel
foo = open('foo.txt', 'w') duh. Thanks - Scott On Dec 6, 2004, at 11:27 AM, Scott Frankel wrote: Why does os.fdopen('foo.txt', 'w') require an integer? Ultimately, I want to create a new file on disk. Funny, I can't seem to suss-out how to create a new file without resorting to os.system('touch

Re: cut strings and parse for images

2004-12-06 Thread Paul McGuire
Andreas Volz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I used SGMLParser to parse all href's in a html file. Now I need to cut some strings. For example: http://www.example.com/dir/example.html Now I like to cut the string, so that only domain and directory is left

Re: Mean, median, and mode

2004-12-06 Thread Josiah Carlson
[EMAIL PROTECTED] (Michael Fuhr) wrote: Josiah Carlson [EMAIL PROTECTED] writes: Robert Brewer [EMAIL PROTECTED] wrote: Josiah Carlson wrote: median = lambda x: x.sort() or x[len(x)//2] That...is a really sneaky use of null return values. I like. :) Thank you,

Re: byte code generated under linux == bad magic number under windows

2004-12-06 Thread Jarek Zgoda
Fredrik Lundh wrote: AFAIK, they *are* platform dependent. You can not share pyc files between ASCII and EBCDIC machine. however, that could be seen as be a flaw in the EBCDIC ports. We'll see if this could be fixed. I try to foster some movement in Python/400 (I love this name, please, dont

Re: cut strings and parse for images

2004-12-06 Thread Steve Holden
Andreas Volz wrote: Hi, I used SGMLParser to parse all href's in a html file. Now I need to cut some strings. For example: http://www.example.com/dir/example.html Now I like to cut the string, so that only domain and directory is left over. Expected result: http://www.example.com/dir/ I know how

Re: why python is slower than java?

2004-12-06 Thread fuzzylollipop
yeah, but a lie unanswered by the truth becomes the truth. you state opinon as fact and someone comes along reads your statement that Python is so much slower and believes it is true because there is no disententing voice to say, wait just a sec, this guy is clueless and has no idea what he is

Re: Seeking Python + Subversion hosting.

2004-12-06 Thread remi
Anyone know of a good hosting company that offers both server-side Python and a subversion repository? I know of one: www.textdrive.com - they're a bit pricey, but I s'pose you gets what you pays for - they look good. Just FYI - right now I'm with sapphiresoft.co.uk. They're cheap and in

RE: Mean, median, and mode - third time's the charm!!!

2004-12-06 Thread Frohnhofer, James
median = lambda x: x.sort() or ((len(x) % 2) and (x[(len(x)1)])) or (sum(x[((len(x)1)-1):(len(x)1)+1])/2.0) median( [2,3,4,5,6,7]) 4.5 median( [2,3,4,5,6]) 4 How about median = lambda x: x.sort() or (x[(len(x)-1)/2] + x[len(x)/2])/2.0 median([2,3,4,5,6,7]) 4.5 median( [2,3,4,5,6])

Re: How is Python designed?

2004-12-06 Thread Limin Fu
Hi, So I guess you don't use classic parser techniques then? You are right. The Yuan interpreter scans the tokens resulted from lexical analysis and matches them to the syntax patterns. There are 3 basic patterns defined in Yuan: arithmetic a*b+c, chain (as I called it) objs[i]-func() and

Re: Mean, median, and mode

2004-12-06 Thread Scott David Daniels
How about: def median(lst): lst = sorted(lst) inner = lst[(len(lst) - 1) // 2 : (len(lst) + 2) // 2] if len(inner) 1: return sum(inner) / 2. else: return inner[0] --Scott David Daniels [EMAIL PROTECTED] --

Re: GUI Frames and classmethod

2004-12-06 Thread Zak Arntson
On Mon, 06 Dec 2004 13:08:15 -0800, Scott David Daniels [EMAIL PROTECTED] wrote: Zak Arntson wrote: On Fri, 03 Dec 2004 14:48:30 -0800, Scott David Daniels Most likely so. Possibly an equal amount of has work -- hash of a pair is a function of hashes of the lelements, but fewer trips in and

Re: Mean, median, and mode

2004-12-06 Thread Paul Rubin
Josiah Carlson [EMAIL PROTECTED] writes: median = lambda x: x.sort() or x[len(x)//2] That...is a really sneaky use of null return values. I like. :) Thank you, I'm just using a paradigm (exploiting lambdas) that I picked up while going through various functional programming modules.

Re: Mean, median, and mode

2004-12-06 Thread Fredrik Lundh
Paul Rubin wrote: median = lambda x: x.sort() or x[len(x)//2] Yucch!! median = x.sorted()[len(x)//2] that doesn't do the same thing, and doesn't work on pre-2.4 releases. try again. (learning how or and and works in Python doesn't hurt, either; value or value is a very common idiom in

Re: GUI Frames and classmethod

2004-12-06 Thread Scott David Daniels
Zak Arntson wrote: On Mon, 06 Dec 2004 13:08:15 -0800, Scott David Daniels [EMAIL PROTECTED] wrote: Zak Arntson wrote: On Fri, 03 Dec 2004 14:48:30 -0800, Scott David Daniels wrote: ...The real advantage is clarity: the inner dictionaries in a dict-of-dict implementation have no real meaning. The

RE: byte code generated under linux == bad magic number under windows

2004-12-06 Thread Delaney, Timothy C (Timothy)
Philippe C. Martin wrote: I understand from my reading that a .pyc generated by python anywhere should run anywhere else - is that true ? If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I ^ get a 'bad magic number' trying

Re: Help with super()

2004-12-06 Thread Peter Otten
Christopher J. Bottaro wrote: Why don't this code work? import PRI class Poscdnld_PYIO(PRI.BasicBatch): def __init__(self, *argv): super(Poscdnld_PYIO, self).__init__(*argv) x = Poscdnld_PYIO() I get this exception: File poscdnld_pyio.py, line 52, in __init__

Re: Help with super()

2004-12-06 Thread Steven Bethard
Christopher J. Bottaro wrote: Why don't this code work? import PRI class Poscdnld_PYIO(PRI.BasicBatch): def __init__(self, *argv): super(Poscdnld_PYIO, self).__init__(*argv) x = Poscdnld_PYIO() I get this exception: File poscdnld_pyio.py, line 52, in __init__ super(Poscdnld_PYIO,

Re: cut strings and parse for images

2004-12-06 Thread Andreas Volz
Am Mon, 06 Dec 2004 20:36:36 GMT schrieb Paul McGuire: Check out the urlparse module (in std distribution). For images, you can provide a default addressing scheme, so you can expand images/marine.jpg relative to the current location. Ok, this looks good. But I'm a really newbie to python

Re: Win32 Libs for 2.4

2004-12-06 Thread Daniel Dittmar
Robin Becker wrote: I guess that it won't work if something malloc'ed from the MSC 6 runtime is free'd by the MSC 7.1 runtime. I thought that static .libs didn't make reference to the dll's they need; isn't that done at load time? You're right, DLL-phobia made my thinking less than precise. The

Re: why no python setup.py uninstall?

2004-12-06 Thread alia_khouri
Peter Hansen wrote: On your specific reason for asking: I would suggest just not worrying about being extra clean about it. Python's generally pretty good about not messing up when you install a new version of something without uninstalling the previous version. Granted. However, the reason

SOAP failure

2004-12-06 Thread savio
Hi I am trying to run the following code snip - it works on my machine at home - does not work in the office - is it a firewall thing? Can anyone help? from SOAPpy import WSDL wsdlFile = 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl' server = WSDL.Proxy(wsdlFile)

regex syntax

2004-12-06 Thread Andreas Volz
Hi, ich kann nicht gut regex, aber für das nötigste reicht es eigentlich. Irgendwie komm ich aber mit der Syntax der re.* Befehle in Python nicht klar Vielleicht kann mir das an diesem Beispiel jemand zeigen: string = bild.jpg ich möchte jetzt einfach wissen ob in dem string ein .jpg vorkommt

Re: cut strings and parse for images

2004-12-06 Thread Paul McGuire
Andreas Volz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Am Mon, 06 Dec 2004 20:36:36 GMT schrieb Paul McGuire: Check out the urlparse module (in std distribution). For images, you can provide a default addressing scheme, so you can expand images/marine.jpg relative to the

RE: better regular expression?

2004-12-06 Thread Robert Brewer
Vivek wrote: I am trying to construct a regular expression using the re module that matches for 1. my hostname 2. absolute from the root URLs including just / 3. relative URLs. Basically I want the attern to not match for URLs that are not on my host. Far easier would be grabbing the

  1   2   >