Re: Best way to emulate ordered dictionary (like in PHP)?

2006-04-12 Thread Georg Brandl
pyGuy wrote: > I am dealing with user profiles, which are simply a set of field-value > pairs. I've tried to many things to list, but for one, I tried creating > a wrapper class which inherits the dictionary and overrides the > iterator. Unfortunately I don't understand iterators enough to get this

Tkinter vs PyGTK

2006-04-12 Thread JyotiC
I want to make a stand alone gui. Whose work is to get the diff options from user and run a shell script based on them. I wanna know which one is better to use Tkinter or PyGTK, in terms of efficiency and functionality. I hv read about Tkinter, but it takes too much time to load, is there a way

Re: list.clear() missing?!?

2006-04-12 Thread Serge Orlov
Martin v. Löwis wrote: > Felipe Almeida Lessa wrote: > > I love benchmarks, so as I was testing the options, I saw something very > > strange: > > > > $ python2.4 -mtimeit 'x = range(10); ' > > 100 loops, best of 3: 6.7 msec per loop > > $ python2.4 -mtimeit 'x = range(10); del x[:]' > > 1

Re: Tkinter vs PyGTK

2006-04-12 Thread Ravi Teja
JyotiC wrote: > I want to make a stand alone gui. Whose work is to get the diff options > from user and run a shell script based on them. > > I wanna know which one is better to use Tkinter or PyGTK, in terms of > efficiency and functionality. > > I hv read about Tkinter, but it takes too much ti

Re: executing perl script within python

2006-04-12 Thread Ravi Teja
This may help http://search.cpan.org/~gaas/pyperl-1.0/perlmodule.pod You can always use pipes (os.popen) to keep things simple. -- http://mail.python.org/mailman/listinfo/python-list

Re: list.clear() missing?!?

2006-04-12 Thread Serge Orlov
Felipe Almeida Lessa wrote: > Em Qua, 2006-04-12 às 11:36 +1000, Steven D'Aprano escreveu: > > On Tue, 11 Apr 2006 19:15:18 +0200, Martin v. Löwis wrote: > > > > > Felipe Almeida Lessa wrote: > > >> I love benchmarks, so as I was testing the options, I saw something very > > >> strange: > > >> > >

RE: Help needed on COM issue

2006-04-12 Thread Tim Golden
[Mike Howard] | Should read ... | I'm doing some conversion of vb code to python code and I have a | problem with a COM object | | Specifically in VB I can do | Set oR = oA.Action | debug.print oR.Item(1,2) | [returns say "1"] | oR.Item(1,2)="4" | debug.print oR | [returns "4"] | oR.Update | [

Re: Best way to emulate ordered dictionary (like in PHP)?

2006-04-12 Thread pyGuy
Great, that recipe is exactly what I needed, and much cleaner than my clumsy attempts. Thank you for your help. -- http://mail.python.org/mailman/listinfo/python-list

A bug of httplib?

2006-04-12 Thread gcn
Hello, The HTTPSConnection class in httplib overload the connect method of HTTPConnection, but it can only deals with IPv4: def connect(self): "Connect to a host on a given (SSL) port." sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host,

Beginner question. Exceptions

2006-04-12 Thread Jose Carlos Balderas Alberico
Hello. I'm having my way with exceptions in a little program I've done, and I'm wondering... What is a decent way of dealing with them? By a decent way I mean, what should I do when I see that an exception has occurred? I've seen that Python's default action is to print a stack trace. As far as I k

Re: turning python-cgi into an html output

2006-04-12 Thread Gerard Flanagan
Kun wrote: > i have a python cgi script that displays tables from a mysql database in > html. > > the problem is, i want to use excel's web query to pull this data and > the web query doesn't read .py files. > > thus i am wondering what is the easiest way to just turn my .py html > output into a .

Re: Tkinter vs PyGTK

2006-04-12 Thread Paul Rubin
"Ravi Teja" <[EMAIL PROTECTED]> writes: > Speed is not the main concern. You won't notice any speed differences > in a small application like that. That's wishful thinking--even a totally trivial tkinter program has noticable startup delay: >>> from Tkinter import * >>> a=Tk() takes seve

Re: A question about the urllib2 ?

2006-04-12 Thread Bo Yang
Fuzzyman 写道: > Bo Yang wrote: > >> Hi , >> Recently I use python's urllib2 write a small script to login our >> university gateway . >> Usually , I must login into the gateway in order to surf the web . So , >> every time I >> start my computer , it is my first thing to do that open a browser to

Web Service SOAP - Unknown element v1

2006-04-12 Thread Jesus . Javier . Masa . Lledo
This is the result of calling: >>>servidor.soapproxy.config.dumpSOAPOut = True >>>servidor.soapproxy.config.dumpSOAPIn = True >>> servidor.setDVD(title="BenHur") *** Outgoing SOAP **   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/en

Re: Tkinter vs PyGTK

2006-04-12 Thread Ravi Teja
Not from here. A highly unscientific measurement, using execution time from SciTe on my 3.5 yr old box. Python startup - 0.272 sec With your snippet for Tk - 0.402 sec 0.13 sec is trivial in my book. -- http://mail.python.org/mailman/listinfo/python-list

UDP max datagram size

2006-04-12 Thread Iain King
Hi. I've been looking everywhere for this and can't find it, apologies if I'm being obtuse: How do I set the max datagram packet size? I'm using the socket module. It seem like it's hardcoded at 255, but I need it to be larger. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Ben C wrote: > On 2006-04-11, Michele Simionato <[EMAIL PROTECTED]> wrote: > >>Roy Smith wrote: >> >> >>>That being said, you can indeed have private data in Python. Just prefix >>>your variable names with two underscores (i.e. __foo), and they effectively >>>become private. Yes, you can bypass

Re: A question about the urllib2 ?

2006-04-12 Thread Serge Orlov
Bo Yang wrote: > Hi , > Recently I use python's urllib2 write a small script to login our > university gateway . > Usually , I must login into the gateway in order to surf the web . So , > every time I > start my computer , it is my first thing to do that open a browser to > login the gateway ! >

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Casey Hawthorne wrote: >>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >>or any other aspect you may be familiar with from Java or C++. The >>primary concept behind OOP is not buzzwords such as abstraction, >>encapsulation, polymorphism, etc etc, but the fact that your pro

Re: Tkinter vs PyGTK

2006-04-12 Thread Paul Rubin
"Ravi Teja" <[EMAIL PROTECTED]> writes: > A highly unscientific measurement, using execution time from SciTe on > my 3.5 yr old box. > > Python startup - 0.272 sec > With your snippet for Tk - 0.402 sec What OS? Try rebooting the box (to clear cache) and measuring again? -- http://mail.python.o

Re: UDP max datagram size

2006-04-12 Thread Heiko Wundram
Am Mittwoch 12 April 2006 10:26 schrieb Iain King: > Hi. I've been looking everywhere for this and can't find it, apologies > if I'm being obtuse: How do I set the max datagram packet size? I'm > using the socket module. It seem like it's hardcoded at 255, but I > need it to be larger. The min

Re: UDP max datagram size

2006-04-12 Thread Iain King
Heiko Wundram wrote: > Am Mittwoch 12 April 2006 10:26 schrieb Iain King: > > Hi. I've been looking everywhere for this and can't find it, apologies > > if I'm being obtuse: How do I set the max datagram packet size? I'm > > using the socket module. It seem like it's hardcoded at 255, but I >

Problem with spawning an external process

2006-04-12 Thread Nico Kruger
I want to execute a command (in this case, and it seems to be significant, a Java program) in a thread in Python. When I execute the java binary in the main python thread, everything runs correctly. But when I try and execute java in a thread, java segfaults. I am using Python 2.3.3 and trying to

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Apologies, this is on a Fedora Core 2 system. On Wed, 2006-04-12 at 11:27, Nico Kruger wrote: > I want to execute a command (in this case, and it seems to be > significant, a Java program) in a thread in Python. When I execute the > java binary in the main python thread, everything runs correctly.

Re: Problem with spawning an external process

2006-04-12 Thread Daniel Nogradi
> > I want to execute a command (in this case, and it seems to be > > significant, a Java program) in a thread in Python. When I execute the > > java binary in the main python thread, everything runs correctly. But > > when I try and execute java in a thread, java segfaults. I am using > > Python 2

Re: Problem with spawning an external process

2006-04-12 Thread Daniel Nogradi
> > > I want to execute a command (in this case, and it seems to be > > > significant, a Java program) in a thread in Python. When I execute the > > > java binary in the main python thread, everything runs correctly. But > > > when I try and execute java in a thread, java segfaults. I am using > >

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Daniel, thanks for your input. What version of the JDK/JRE and Python are you using? On Wed, 2006-04-12 at 11:53, Daniel Nogradi wrote: > > > I want to execute a command (in this case, and it seems to be > > > significant, a Java program) in a thread in Python. When I execute the > > > java binary

Re: About classes and OOP in Python

2006-04-12 Thread Magnus Lycka
Michele Simionato wrote: > Roy Smith wrote: > >> That being said, you can indeed have private data in Python. Just prefix >> your variable names with two underscores (i.e. __foo), and they effectively >> become private. Yes, you can bypass this if you really want to, but then >> again, you can b

Re: Decorators, Identity functions and execution...

2006-04-12 Thread Peter Hansen
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Ben Sizer" <[EMAIL PROTECTED]> wrote: >>Every day I come across people or programs that use tab stops every 2 >>or 8 columns. I am another fan of tabs every 4 columns, but >>unfortunately this isn't standard, so spaces in Python it is

Re: I meet problems while using the py2exe,Please help me!

2006-04-12 Thread Fulvio
Alle 10:17, mercoledì 12 aprile 2006, boyeestudio ha scritto: > What is wrong with this problem makes sense talking about the path on where cairo reside? F -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie wxPython questions.

2006-04-12 Thread bieliza
And why don´t you use Pythoncard, it takes the headache out of messing with wxPyhthon -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with spawning an external process

2006-04-12 Thread Daniel Nogradi
> Daniel, thanks for your input. What version of the JDK/JRE and Python > are you using? So the previous test was on python 2.4, java 1.4.2, suse 9.3 but now I ran it on python 2.3.5, java 1.4.2, gentoo 1.4.16 and your code still does what it supposed to do. I'm not sure if that is good new for yo

Re: Unicode, command-line and idle

2006-04-12 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hello again, I've investigated a little bit and this is what I found: > > If I run IDLE and type > import sys sys.stdin.encoding > > I get > > 'cp1252' > > But if I have a whatever.py file (it can even be a blank file), I edit > it with IDLE, I press F5 (Ru

Re: the mysql for python cann't be install from the source! Help!!

2006-04-12 Thread Fulvio
Alle 22:24, martedì 11 aprile 2006, boyeestudio ha scritto: > I search the mysql directory but gain none of it! In the version MySQL-python-1.2.0 there isn't such file. Better you re-read README file inside the tarball or zip file. F -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Daniel, you are correct, it is not that good news for me :) But anyway, thanks to your responses, I installed Python 2.4.3 and it is working on my machine now as well. We were overdue for an upgrade to our Python environment anyways, so I think this is the final incentive to upgrade. Although, I

Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread Jose Carlos Balderas Alberico
Up till now I've been setting up my server and client in the same machine, using the "localhost" address for everything. Once I've made it work, I need to move my client application to the computer where it'll be run from, and for some reason, I get a socket.error: (111, 'connection refused').   Th

Re: list.clear() missing?!?

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 00:33:29 -0700, Serge Orlov wrote: > > Felipe Almeida Lessa wrote: >> Em Qua, 2006-04-12 às 11:36 +1000, Steven D'Aprano escreveu: >> > On Tue, 11 Apr 2006 19:15:18 +0200, Martin v. Löwis wrote: >> > >> > > Felipe Almeida Lessa wrote: >> > >> I love benchmarks, so as I was tes

datetime: the date of the day one month ago...how?

2006-04-12 Thread gabor
hi, i'm trying to get the date of the day one month ago. for example: today = 12.apr.2006 one-month-ago = 12.mar.2006 so: one-month-ago(12.apr.2006) = 12.mar.2006 of course sometimes it gets more complicated, like: one-month-ago(31.mar.2006) or one-month-ago(1.jan.2006) the dateti

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Gregor Horvath wrote: > Steven D'Aprano schrieb: > > >>I don't know of many other OO languages that didn't/don't have >>inheritance, > > > VB4 - VB6 > VB6 has a kind of inheritance via interface/delegation. The interface part is for subtyping, the delegation part (which has to be done manuall

Re: datetime: the date of the day one month ago...how?

2006-04-12 Thread Max M
gabor wrote: > hi, > > i'm trying to get the date of the day one month ago. > > for example: > > today = 12.apr.2006 > one-month-ago = 12.mar.2006 > > so: > > one-month-ago(12.apr.2006) = 12.mar.2006 > > of course sometimes it gets more complicated, like: > > one-month-ago(31.mar.2006) >

Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread Jose Carlos Balderas Alberico
Thank you for the quick reply John... Is there a way to sort this out? Should I specify another address here:   server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000), )   instead of "localhost" ?   I'm kind of new to client/server programming, so I'm at a loss here. Thank you very

a project to standardize script writing in my environment

2006-04-12 Thread s99999999s2003
hi in my environment, besides shell scripts written for sys admin tasks, there are shell scripts that call java programs which in turn will do various processing like connecting to databases and doing manipulation of data. My programmers all know only Java and so this is how the java programs come

Re: list.clear() missing?!?

2006-04-12 Thread Duncan Booth
Steven D'Aprano wrote: > But that is precisely the same for the other timeit tests too. > > for _i in _it: > x = range(10) Allocate list. Allocate ob_item array to hold pointers to 1 objects Allocate 99900 integer objects setup list > del x[:] Calls list_clear which: decrements

Re: UDP max datagram size

2006-04-12 Thread malv
I seem to recall from UDP datagram tests between linux and XP I ran a few years ago that XP maximum datagram sizes are indeed smaller than linux. -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime: the date of the day one month ago...how?

2006-04-12 Thread Kent Johnson
gabor wrote: > hi, > > i'm trying to get the date of the day one month ago. > > for example: > > today = 12.apr.2006 > one-month-ago = 12.mar.2006 dateutil has one implementation of this: http://labix.org/python-dateutil Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime: the date of the day one month ago...how?

2006-04-12 Thread gabor
Max M wrote: > gabor wrote: >> hi, >> >> i'm trying to get the date of the day one month ago. >> >> for example: >> >> today = 12.apr.2006 >> one-month-ago = 12.mar.2006 >> >> so: >> >> one-month-ago(12.apr.2006) = 12.mar.2006 >> >> of course sometimes it gets more complicated, like: >> >> one-

Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread Jose Carlos Balderas Alberico
Okay, I changed this:   server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000), ) for this:   server = SimpleXMLRPCServer.SimpleXMLRPCServer(('', 8000), )   Replacing "localhost" with two simple quotes ' makes it work. Anyone knows the reason for this?   Thank so much.   Jose Ca

Python2CPP ?

2006-04-12 Thread Michael Yanowitz
Hello: One topic that has always interested me are the Language translators. Are there any that convert between Python and C++ or Python and Java? I remember seeing one that converts from Python to or from Perl but couldn't find it on a quick google search. I did find a Python2C http://sourcefo

Re: Python2CPP ?

2006-04-12 Thread Szabolcs Berecz
First of all: why do you want to translate pythont to C++? Anyway, this has a C back-end: http://www.pypy.org Szabi On 4/12/06, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > Hello: > >One topic that has always interested me are the Language translators. > Are there any that convert between P

Re: Newbie wxPython questions.

2006-04-12 Thread dfh
[EMAIL PROTECTED] wrote: > I am running through the wxPython guide and docs and extrapolating > enough to get confused. There is mailing list for wxPython users - [EMAIL PROTECTED] It is pretty active and its members, including Robin Dunn the main wxPython developer, are always very helpful. If

Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread John Abel
Your server is only listening on 127.0.0.1. Jose Carlos Balderas Alberico wrote: > Up till now I've been setting up my server and client in the same > machine, using the "localhost" address for everything. > Once I've made it work, I need to move my client application to the > computer where it'

RE: Python2CPP ?

2006-04-12 Thread Michael Yanowitz
> First of all: why do you want to translate pythont to C++? > > Anyway, this has a C back-end: > http://www.pypy.org > > Szabi Thanks. I want to translate from Python to C++ for a few reasons: 1) Curiosity. I would like to see how well the translation goes. 2) Efficiency. It is alot quicker to

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Not working with Python 2.3.5 here on Fedora Core 2 :(. Oh well, at least it's working on 2.4. Must be specific to something in the combination of Fedora Core 2 and Python 2.3.x, that is all I can think of. On Wed, 2006-04-12 at 12:55, Nico Kruger wrote: > Daniel, you are correct, it is not that

Re: symbolic links, aliases, cls clear

2006-04-12 Thread af . dingo
If I may recommend an alternative, print "\033[H\033[J" the ansi sequence to clear the screen. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't connect to SimpleXMLRPCServer. Help needed.

2006-04-12 Thread John Abel
Using the '' makes it listen on all interfaces. Jose Carlos Balderas Alberico wrote: > Okay, I changed this: > server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000), > ) > for this: > server = SimpleXMLRPCServer.SimpleXMLRPCServer(('', 8000), ) > > Replacing "localhost"

Re: Python2CPP ?

2006-04-12 Thread Szabolcs Berecz
On 4/12/06, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > 2) Efficiency. It is alot quicker to code something in Python. If I can >write it in Python and auto-convert it to C++. I would save time coding. I don't think you will get a more efficient code. The reason is the extremely dynamic natu

RE: Python2CPP ?

2006-04-12 Thread Diez B. Roggisch
> 1) Curiosity. I would like to see how well the translation goes. If there is something that works, it will look awful to the eye. Code-generators are generally not very idiomatic - they mapping is to localized to e.g. factorize out a more complex loop to something a generator might to much bette

example of logging w/ user-defined keywords?

2006-04-12 Thread Chris Curvey
Several things that I've read lead me to think this is possible, but I can't figure out how to do it. I have some information (a "job number") that I would like logged on every log message, just like the time or the severity. I saw some mail threads that suggested that there was an easy way to d

Re: example of logging w/ user-defined keywords?

2006-04-12 Thread Peter Hansen
Chris Curvey wrote: > Several things that I've read lead me to think this is possible, but I > can't figure out how to do it. I have some information (a "job > number") that I would like logged on every log message, just like the > time or the severity. > > I saw some mail threads that suggested

Re: Python2CPP ?

2006-04-12 Thread Jay Parlar
On Apr 12, 2006, at 5:13 AM, Michael Yanowitz wrote: >> > > Thanks. I want to translate from Python to C++ for a few reasons: > 1) Curiosity. I would like to see how well the translation goes. > 2) Efficiency. It is alot quicker to code something in Python. If I can >write it in Python and a

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Floyd L. Davidson
[EMAIL PROTECTED] wrote: >If I may recommend an alternative, > >print "\033[H\033[J" > >the ansi sequence to clear the screen. Or so you would hope (however, that is *not* what you have listed!). Unfortunately, it is poor practice to hard code such sequences. Instead the proper sequence should be

Re: Regular expression intricacies: why do REs skip some matches?

2006-04-12 Thread Chris Lasher
Diez, John, Tim, and Ben, thank you all so much. I now "get it". It makes logical sense now that the difficulty was actually in the implementation of findall, which does non-overlapping matches. It also makes sense, now, that one can get around this by using a lookahead assertion. Thanks a bunch, g

Re: Python2CPP ?

2006-04-12 Thread Ben C
On 2006-04-12, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > Hello: > >One topic that has always interested me are the Language translators. > Are there any that convert between Python and C++ or Python and Java? > I remember seeing one that converts from Python to or from Perl but couldn't > f

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Floyd L. Davidson
"mp" <[EMAIL PROTECTED]> wrote: >i have a python program which attempts to call 'cls' but fails: > >sh: line 1: cls: command not found Hm... (I don't program in Python, so precisely what is happening isn't something I'm sure about). But, note how that line starts with "sh:"! That indicates

Re: Tkinter vs PyGTK

2006-04-12 Thread JyotiC
Thanx for the help. Does all gui's take time to load. is there a way to dec this time. -- http://mail.python.org/mailman/listinfo/python-list

random.sample with long int items

2006-04-12 Thread jordi
I need the random.sample functionality where the population grows up to long int items. Do you know how could I get this same functionality in another way? thanks in advance. Jordi -- http://mail.python.org/mailman/listinfo/python-list

Re: random.sample with long int items

2006-04-12 Thread Paul Rubin
"jordi" <[EMAIL PROTECTED]> writes: > I need the random.sample functionality where the population grows up to > long int items. Do you know how could I get this same functionality in > another way? thanks in advance. Nothing stops you: >>> from random import sample >>> a = [n**25 for n in

REMINDER: BayPIGgies: April 13, 7:30pm (IronPort)

2006-04-12 Thread Aahz
The next meeting of BayPIGgies will be Thurs, April 13 at 7:30pm at IronPort. This meeting features JJ reviewing "Professional Software Development" with discussion and newbie questions afterward. BayPIGgies meetings alternate between IronPort (San Bruno, California) and Google (Mountain View, C

Re: Decorators, Identity functions and execution...

2006-04-12 Thread Dave Hansen
On Wed, 12 Apr 2006 17:19:25 +1200 in comp.lang.python, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, > "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >>"Sybren Stuvel" <[EMAIL PROTECTED]> wrote in >> > I don't care about how people see my tabs. I use one tab for ever

Re: Compleated Begginers Guide. Now What?

2006-04-12 Thread Christos Georgiou
On Tue, 11 Apr 2006 07:37:23 -0400, rumours say that Steve Holden <[EMAIL PROTECTED]> might have written: >James Stroud wrote: >> Mirco Wahab wrote: >>>Jay wrote: >>>Malchick, you cracked your veshchs to classes, which is >>>not that gloopy. So rabbit on them and add class methods >>>that sloo

converting lists to strings to lists

2006-04-12 Thread robin
hi, i'm doing some udp stuff and receive strings of the form '0.87 0.25 0.79;\n' what i'd need though is a list of the form [0.87 0.25 0.79] i got to the [0:-3] part to obtain a string '0.87 0.25 0.79' but i can't find a way to convert this into a list. i tried

Re: random.sample with long int items

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 06:29:01 -0700, jordi wrote: > I need the random.sample functionality where the population grows up to > long int items. Do you know how could I get this same functionality in > another way? thanks in advance. I'm thinking you might need to find another way to do whatever it i

Re: random.sample with long int items

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 06:44:29 -0700, Paul Rubin wrote: > "jordi" <[EMAIL PROTECTED]> writes: >> I need the random.sample functionality where the population grows up to >> long int items. Do you know how could I get this same functionality in >> another way? thanks in advance. > > Nothing stops you

Re: converting lists to strings to lists

2006-04-12 Thread Eric Deveaud
robin wrote: > hi, > > i'm doing some udp stuff and receive strings of the form '0.87 > 0.25 0.79;\n' > what i'd need though is a list of the form [0.87 0.25 0.79] > i got to the [0:-3] part to obtain a string '0.87 0.25 > 0.79' but i can't find a way to c

Re: random.sample with long int items

2006-04-12 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > e.g. you would do this: random.sample(xrange(10**10), 60) > except it raises an exception. For a population that large and a sample that small (less than sqrt(population size), the chance of collision is fairly small, so you can just discard duplicates

Re: converting lists to strings to lists

2006-04-12 Thread gry
Read about string split and join. E.g.: l = '0.87 0.25 0.79' floatlist = [float(s) for s in l.split()] In the other direction: floatlist = [0.87, 0.25, 0.79004] outstring = ' '.join(floatlist) If you need to control the precision(i.e. suppress the 4), read about the s

Re: converting lists to strings to lists

2006-04-12 Thread robin
thanks for your answer. split gives me a list of strings, but i found a way to do what i want: input='0.1, 0.2, 0.3;\n' input = list(eval(input[0:-2])) print input > [0.10001, 0.20001, 0.2] this does fine... but now, how do i convert this list to a string?

Re: converting lists to strings to lists

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 06:53:23 -0700, robin wrote: > hi, > > i'm doing some udp stuff and receive strings of the form '0.87 > 0.25 0.79;\n' > what i'd need though is a list of the form [0.87 0.25 0.79] > i got to the [0:-3] part to obtain a string '0.87 0.25 > 0.7900

Re: list.clear() missing?!?

2006-04-12 Thread John Salerno
Steven D'Aprano wrote: > But name.clear() meaning "mutate the object referenced by name to the > empty state" is a very natural candidate for a method, and I don't > understand why lists shouldn't have it. Funny this even comes up, because I was just trying to 'clear' a list the other day. But i

Re: random.sample with long int items

2006-04-12 Thread jordi
That is just what I need. I did't mind on 'divide and conquer' :( Thanks a lot! -- Jordi -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter vs PyGTK

2006-04-12 Thread gregarican
JyotiC wrote: > Thanx for the help. > > Does all gui's take time to load. > is there a way to dec this time. Have you tried loading a Java GUI app through launching the Java Virtual Machine? That's pretty slow too. And that's a bytecode compiled medium. Unfortunately most interpreted programming

Re: redirecting web page

2006-04-12 Thread Thomas Guettler
Am Tue, 11 Apr 2006 10:38:13 -0700 schrieb dai: > Hi, I am a newbie about python. Now I am modifying the tinyHTTPProxy to > redirect a client's request to our company's webpage. > I don't know how can I do this. What I want to do now is to modify the > headers, but i still didn't figure out how to

Re: converting lists to strings to lists

2006-04-12 Thread Peter Hansen
robin wrote: > i'm doing some udp stuff and receive strings of the form '0.87 > 0.25 0.79;\n' > what i'd need though is a list of the form [0.87 0.25 0.79] > i got to the [0:-3] part to obtain a string '0.87 0.25 Actually, that's already a bug. You want [0:-2] if y

Re: UDP max datagram size

2006-04-12 Thread Grant Edwards
On 2006-04-12, Iain King <[EMAIL PROTECTED]> wrote: > Hi. I've been looking everywhere for this and can't find it, apologies > if I'm being obtuse: How do I set the max datagram packet size? What do you mean "datgram packet size"? > I'm using the socket module. It seem like it's hardcoded at

Re: converting lists to strings to lists

2006-04-12 Thread robin
yo! thank you everone! here's how i finally did it: converting the string into a list: input = net.receiveUDPData() input = list(eval(input[0:-2])) converting the list into a string: sendout = "%.6f %.6f %.6f;\n" % tuple(winningvector) maybe i'll even find a way to gene

just one more question about the python challenge

2006-04-12 Thread John Salerno
Sorry to post here about this again, but the hint forums are dead, and the hints that are already there are absolutely no help (mostly it's just people saying they are stuck, then responding to themselves saying the figured it out! not to mention that most of the hints require getting past a ce

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > thanks for your answer. split gives me a list of strings, Of course, why should it be otherwise ?-) More seriously : Python doesn't do much automagical conversions. Once you've got your list of strings, you have to convert'em to floats. > but i found a > way to do what i want: >

Re: Unicode, command-line and idle

2006-04-12 Thread Egon Frerich
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What do you have in the IDLE options - General - Default source encoding? Egon Kent Johnson schrieb am 12.04.2006 12:40: > [EMAIL PROTECTED] wrote: >> Hello again, I've investigated a little bit and this is what I found: >> >> If I run IDLE and type

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > yo! > > thank you everone! here's how i finally did it: > converting the string into a list: > > input = net.receiveUDPData() > input = list(eval(input[0:-2])) You'll run into trouble with this. > converting the list into a string: > > sendout = "%.6f %.6f %.6f

Re: list.clear() missing?!?

2006-04-12 Thread Steven Bethard
Steven D'Aprano wrote: > On Tue, 11 Apr 2006 14:49:04 -0700, Ville Vainio wrote: > >> John Salerno wrote: >> >>> Thanks guys, your explanations are really helpful. I think what had me >>> confused at first was my understanding of what L[:] does on either side >>> of the assignment operator. On the

Re: just one more question about the python challenge

2006-04-12 Thread Georg Brandl
John Salerno wrote: > Sorry to post here about this again, but the hint forums are dead, and > the hints that are already there are absolutely no help (mostly it's > just people saying they are stuck, then responding to themselves saying > the figured it out! not to mention that most of the hint

Re: converting lists to strings to lists

2006-04-12 Thread Eric Deveaud
robin wrote: > yo! > > thank you everone! here's how i finally did it: > converting the string into a list: > > input = net.receiveUDPData() > input = list(eval(input[0:-2])) no pun intented but as you did not know how to use split and join, please please DON'T USE eval

Re: just one more question about the python challenge

2006-04-12 Thread John Salerno
Georg Brandl wrote: > Have you found the file? You'll have to distribute that file bytewise > in 5 "piles". No, I haven't figured out anything for this puzzle. It seems I might have to change the filename of the image to something else, but I don't know what. But even after I find the image, I

Re: list.clear() missing?!?

2006-04-12 Thread John Salerno
Steven Bethard wrote: > I think these are all good reasons for adding a clear method, but being > that it has been so hotly contended in the past, I don't think it will > get added without a PEP. Anyone out there willing to take out the best > examples from this thread and turn it into a PEP?

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Michael Paoli
Floyd L. Davidson wrote: > [EMAIL PROTECTED] wrote: > >If I may recommend an alternative, > >print "\033[H\033[J" > Unfortunately, it is poor practice to hard code such sequences. > Instead the proper sequence should be obtained from the > appropriate database (TERMINFO or TERMCAP), and the easy wa

Re: just one more question about the python challenge

2006-04-12 Thread Georg Brandl
John Salerno wrote: > Georg Brandl wrote: > >> Have you found the file? You'll have to distribute that file bytewise >> in 5 "piles". > > No, I haven't figured out anything for this puzzle. It seems I might > have to change the filename of the image to something else, but I don't > know what. B

ftp connection and commands (directroy size, etc)

2006-04-12 Thread Arne
Hello everybody! I am working on Windows XP and I want to do the following: 1. Connecting to a server using ftp 2. Getting the directory structure and the size of each directory in the root 3. Getting the owner of a file All these steps I want to do with python. What I already have is: 1. Conn

Re: just one more question about the python challenge

2006-04-12 Thread Just
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > Georg Brandl wrote: > > > Have you found the file? You'll have to distribute that file bytewise > > in 5 "piles". > > No, I haven't figured out anything for this puzzle. It seems I might > have to change the filename of

Re: ftp connection and commands (directroy size, etc)

2006-04-12 Thread maxou
Hello Arne > 1. Connecting to ftp is OK > 2. Getting the directory structure and the size of each directory in the > root -If you want to get the structure of your directory you can simply do this: print ftp.dir(path_of_your_directory) or by creating a list do this a=ftp.dir(path_of_your_direct

Re: just one more question about the python challenge

2006-04-12 Thread John Salerno
Georg Brandl wrote: > John Salerno wrote: >> Georg Brandl wrote: >> >>> Have you found the file? You'll have to distribute that file bytewise >>> in 5 "piles". >> No, I haven't figured out anything for this puzzle. It seems I might >> have to change the filename of the image to something else, but

  1   2   3   >