proxy for xmlrpc calls

2006-08-12 Thread Xavier
I'm attempting to write a proxy for xmlrpc calls. I'm starting from this code; class MagicObject: def __call__(self,*args,**kwargs): return MagicObject.__dict__['_stop'](self,self.n,*args,**kwargs) def __getattr__(self,name): if name in ('__str__','__repr__'): return

Serial I/O problem with pywin32 ?

2008-09-03 Thread Xavier
Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly losts chunks of ~100byt

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Xavier
I tried under Linux... same problem. So... it may comes from my little lines of code... or from my GPS. -- http://mail.python.org/mailman/listinfo/python-list

Re: Serial I/O problem with pywin32 ?

2008-09-15 Thread Xavier
Hi I have resolved my problem by checking paquets. It seems that it is a problem of the GPS (it's a very cheap GPS Datalogger). > Could be hardware flow control. See this sometimes on the bluetooth > connections that are using Serial Port Protocol and the hardware flow > control hasn't been physi

multiprocessing.connection with ssl

2009-11-30 Thread Xavier
Hello I've hacked multiprocessing.connection (in a basic way) to allow ssl encryption using ssl.wrap_socket. Anybody knows how i can contribute this to main developers? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a simple CGI Script

2012-08-02 Thread Xavier Combelle
In server.py you made a mistake in the declaration of the cgi directory it should be handler.cgi_directories = ["/"] Le 02/08/2012 20:20, Smaran Harihar a écrit : Hi, I am trying to create a simple CGI Script and following this tutorials

Re: Batching HTTP requests with httplib (Python 2.7)

2012-09-17 Thread Xavier Combelle
instead of Le 14/09/2012 12:56, Dwight Hutto a écrit : service_num_list = [num for num in range(0,5)] for service_num in service_num_list: eval("web_service_call%i(%i)" % (service_num,service_num)) service_num_list = [num for num in range(0,5)] for service_num in service_num_list:

Re: Help with Python/ArcPy

2012-12-12 Thread Xavier Ho
You can always try http://stackoverflow.com/search?q=ArcPY, or post your question there. Cheers, Xav On 13 December 2012 08:07, Michelle Couden wrote: > Does anyone know of a website or forum where there is help for ArcPY > (Python) programmers? ESRI’s (GIS) resource center Forums are very b

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-26 Thread Xavier Combelle
You probably want to write of = open("DUMP.tbz", "wb") and gf =open("DUMP.tbz", "rb") -- http://mail.python.org/mailman/listinfo/python-list

Python 2 multiprocessing examples in docs.python.org

2013-01-31 Thread Xavier Ho
Hey all, I ran the example code on multiprocessing. On the "Pool example", an assertion failed with "testing garbage collection". Traceback (most recent call last): File "test.py", line 314, in test() File "test.py", line 295, in test assert not worker.is_alive() AssertionError The

Re: Upgrading from 2.7 to 3.x

2012-04-25 Thread Xavier Ho
What operating system are you running? Cheers, Xav On 26 April 2012 13:08, deuteros wrote: > I'm fairly new to Python I have version 2.7 installed on my computer. > However > my professor wants us all to use the latest version of Python. How do I go > about upgrading? Do I just install the ne

Re: Fun python 3.2 one-liner

2011-03-29 Thread Xavier Ho
http://www.ideone.com/infch ^ Result of the below code On 29 March 2011 19:50, Raymond Hettinger wrote: > from collections import Counter > from itertools import product > > print('\n'.join('*'*(c//2000) for _,c in sorted(Counter(map(sum, > product(range(6), repeat=8))).items( > > > almost-n

Re: how to put form and display its result(data from database) on the same window?

2005-12-07 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Hi Guys, > > I have designed a web application. In its one window I put a form. User > can click submit button of this form to run a pathon script to get data > from database. Then User get a new window which display the result. Now > I want to put the form and display d

Re: How to find the type ...

2005-12-09 Thread Xavier Morel
Lad wrote: > Hello > How can I find out in Python whether the operand is integer or a > character and change from char to int ? > Regards, > L. > You may want to try the "type" command. And there is no character type in cPython (unless you're using ctypes that is) There is not much point though

Re: How to detect the presence of a html file

2005-12-09 Thread Xavier Morel
Phoe6 wrote: > Operating System: Windows > Python version: 2.4 > > I have bookmarks.html and wumpus.c under my c: > > When I tried to check the presence of the bookmarks.html, I fail. > os.path.isfile('c:\bookmarks.html') > False os.path.isfile('c:\wumpus.c') > True > os.path.exi

Re: Proposal: Inline Import

2005-12-09 Thread Xavier Morel
Shane Hathaway wrote: > Thoughts? >>> import re; name_expr = re.compile('[a-zA-Z]+') >>> name_expr <_sre.SRE_Pattern object at 0x00F9D338> >>> the import statement can be called anywhere in the code, why would you add strange syntactic sugar that doesn't actually bring anything? -- http://ma

Re: Another newbie question

2005-12-10 Thread Xavier Morel
Mike Meyer wrote: > And you've once again missed the point. The reason you don't > manipulate the attributes directly is because it violates > encapsulation, and tightens the coupling between your class and the > classes it uses. It means you see the implementation details of the > classes you are

Two questions on lambda:

2005-06-24 Thread Xavier Décoret
Hi, I cannot find the way to do generic lambda functions using the lambda syntax in python. I am probably missing a point. For example, the code # f = lambda : print "hello" # f() does not compile, although: # def f(): # print "hello" # f() does compile. Is there a particular syntax fo

VIAGRRÁ-Good for your life

2005-08-19 Thread Xavier Burger
Hello,   Welto PharmcyByMail ST0RE - Save huge 70% on all the 0rders with us.come    We are there whi only stoch gives this great deal to you!   VlALLlS VALy other drugplAGRRA ClUUM and mans in our sho   r NEW PRlCESCheck out ou   Have a nice day. -- http://mail.python.org/mailman/listinfo/pyth

How to Mock a mongodb

2015-02-07 Thread Xavier Pegenaute
Dear, I am trying to mock the use of a mongo db and I am having some trouble. Appears that I am not able to return a desired value from mongo.find().count(). I made a proof of concept to try to reduce complexity of the real problem. You can find the code which is going to be tested in [1], a

How to Mock a mongodb

2015-02-07 Thread Xavier Pegenaute
Dear, I am trying to mock the use of a mongo db and I am having some trouble. Appears that I am not able to return a desired value from mongo.find().count(). I made a proof of concept to try to reduce complexity of the real problem. You can find the code which is going to be tested in [1], a

Re: [OT] Awesome bug of the week

2014-08-13 Thread Xavier Ho
Haha! On 14 August 2014 14:54, Steven D'Aprano wrote: > Nothing to do with Python, but awesome: "OpenOffice won't print on > Tuesdays". > > https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/255161/comments/28 > > > > -- > Steven > -- > https://mail.python.org/mailman/listinfo/python-list >

Re: Execute a command on remote machine in python

2011-11-15 Thread Xavier Ho
It sounds like Fabric is what you're after. We use it at work and it's the best thing since ssh. ;] http://docs.fabfile.org/en/1.3.2/index.html (Actually, it uses ssh internally and allows you to do remote shell-like programming in a pythonic fashion.) Cheers, Xav On 15 November 2011 22:04, R

Comparing None and ints

2012-01-16 Thread Xavier Ho
Hello, I discovered this strange property by accident: Python 2.7.2 (default, Nov 21 2011, 17:25:27) [GCC 4.6.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> None < 0 True >>> None == 0 False >>> None > 0 False >>> int(None) Traceback (most recent call last

Re: Comparing None and ints

2012-01-16 Thread Xavier Ho
Good to see Python3 got rid of that confusion :] Cheers, Xav On 17 January 2012 16:50, Chris Angelico wrote: > On Tue, Jan 17, 2012 at 5:47 PM, Xavier Ho wrote: > > What was the rationale behind this design? Specifically, (None < 0) == > True > > and

Fwd: Recording live video stream from IP camera issue

2013-02-06 Thread Xavier Ho
On 6 February 2013 23:12, Sam Berry wrote: > I have no vast knowledge of python, but i came across this code to capture > video from my IP camera > > This code works, however when i try to playback the .avi file in VLC > player... I've been working with several IP cameras with Python and OpenCV

Re: Recording live video stream from IP camera issue

2013-02-06 Thread Xavier Ho
On 7 February 2013 00:12, Sam Berry wrote: > Hi, > > This is for a university project. > > My issue is that i have built an App using pythons Kivy module, and i need > to be able to stream and record from an IP camera upon request. > > I have just used the VLC.exe to stream the video feed. But it

Re: Recording live video stream from IP camera issue

2013-02-17 Thread Xavier Ho
Hi Sam, Did you compile your OpenCV with gstreamer? That's where I'd look first. Cheers, Xav On 18 February 2013 01:15, Sam Berry wrote: > Hi Xav, > > Iv been looking into OpenCV, i can easily stream my laptops webcam using > this code. > > import cv2 > > cv2.namedWindow("preview") > > vc =

Re: How to quickly set up a multithreaded server that can handle http file post.

2013-03-11 Thread Xavier L.
On 13-03-11 10:42 AM, Shiyao Ma wrote: Today I come across a problem. Basically, my need is that I want to launch a http server that can not only support get but also support post (including post file). My first idea is to use -m http.sever. However, it only supports get. Later I find some one ex

Re: how do you make a loop run in reverse?

2013-03-26 Thread Xavier Ho
There is a built-in function that reverses an iterable. Have a look at the documentation. xav On 27 March 2013 10:59, wrote: > So i have a set of for loops that create this : > > *** > *** *** *** *** *** *** *** > *** *** *** *** ***

Re: Functional vs. Object oriented API

2013-04-10 Thread Xavier Ho
Hi Max, In Python, we prefer readability over anything else. The simpler you can write it, the better it can be understood. That said, I've never considered using (i, j, k) as a vector component before. I've always done something akin to: >>> vector = Vector(2, 4, 6) >>> print (vector.normaliz

Re: double underscore attributes?

2005-12-10 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Could someone explain the use of __add__ (and similar double underscore > attributes) and what their use is. > > Bob > Methods with double leading and trailing underscores are basically "magic methods" with specific meanings for the Python interpreter. You're not supp

Re: Great books on Python?

2005-12-11 Thread Xavier Morel
Tolga wrote: > I am not unfamiliar to programming but a newbie in Python. Could you > recommend me (a) great book(s) to start with? Free online books or > solid books are welcome. > > Thanx in advance. > I'd call Dive Into Python a reference, it's an extremely clear yet pythonic book, and it's a

Re: OO in Python? ^^

2005-12-11 Thread Xavier Morel
Matthias Kaeppler wrote: > Why would I want to use an attribute in Python, where I would use > getters and setters in Java? I know that encapsulation is actually just > a hack in Python (common, "hiding" an implementation detail by prefixing > it with the classname so you can't access it by its

Re: Displaying error message in a try except?

2005-12-11 Thread Xavier Morel
Fredrik Lundh wrote: > assuming that "true" means "the message you would get if you hadn't > used a try/except", the traceback module is what you want: > > you can also inspect the exception status via the sys.exc_info() call. > e.g. > There is also the third way of catching an exception exp

Re: Python is incredible!

2005-12-12 Thread Xavier Morel
Luis M. Gonzalez wrote: > You are not the first lisper who fell inlove with Python... > Check this out: > http://www.paulgraham.com/articles.html > Paul Graham is not in love with Python though, he's still very much in love with Lisp. He merely admits being unfaithful to Lisp from time to time (

Re: IsString

2005-12-13 Thread Xavier Morel
Tom Anderson wrote: > In what sense are the names-bound-to-references-to-objects not variables? > In the sense that a variable has various meta-informations (at least a type) while a Python name has no information. A Python name would be equivalent to a C void pointer, it can mean *any*thing an

Re: "0 in [True,False]" returns True

2005-12-13 Thread Xavier Morel
Mike Meyer wrote: > But this isn't necessarilly true: is perfectly legal. > > http://mail.python.org/mailman/listinfo/python-list

Re: Horribly noobful string question

2005-12-13 Thread Xavier Morel
Fredrik Lundh wrote: > "SeNTry" wrote: > >> My first post here as I just begin to learn programming in general and >> python in particular. I have all the noobie confused questions, but as I >> work thru the tutorials I'm sure I'll find most my answers. >> >> This one is eluding me tho... I am wo

Re: how can i change the default python?

2005-12-13 Thread Xavier Morel
Koray Bostancı wrote: > Hi all, > > When i type python in terminal it runs the python2.3 interpreter, but i > want to use 2.4 and Python2.4 package is already installed. > > How can i change the default python in my system? I searched google for > a little but couldn't find. > > Using Debian GNU

Re: IsString

2005-12-13 Thread Xavier Morel
Steven D'Aprano wrote: > name = "spam spam spam spam" > > the value of the variable "name" is a pointer, and not a string. Riiight. > Yes, it's a reference to an object of type string holding the value > def increment(n): > """Add one to the argument changing it in place.""" > # In Pas

Re: How can I load python script into Html ??

2005-12-13 Thread Xavier Morel
Shouldn't have hit the "send" button so fast... Addendum: the script element doesn't have any language attribute, the attribute you're supposed to use is "type" and it takes the MIME type of your script as a value. s/language="javascript"/type="text/javascript"/ -- http://mail.python.org/mailm

Re: How can I load python script into Html ??

2005-12-13 Thread Xavier Morel
PatPoul wrote: > I want to do the same thing as > > > but with a python script : > > > == > if xxx.py : > def mytest(): > alert("test") > window.document.write('test') > == > and test.html : > > > > > mytest() > >

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Xavier Morel
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: >> (Part of) Python's credo (which you can read in context by typing >> >> import this >> >> at an interactive command prompt) is "There should be one (and >> preferably only one) way to do it". > > Actua

Re: Tuples

2005-12-15 Thread Xavier Morel
Tuvas wrote: > Let's say I make a program something like follows: > > x=[] > x.append([1,2,3]) > x.append([4,5,6]) > print x > print x[0] > print x[0][1] > x[0][1]=5 > > Okay, everything works here as expected except the last line. Why won't > this work? Thanks for the help! > Works for me, do y

Re: RoR like (was : SPE 0.8.1.b Python IDE...)

2005-12-15 Thread Xavier Morel
Adrian Holovaty wrote: > bruno at modulix wrote: >> RoR is not an IDE, it's a web framework. The closest things in Python >> are TurboGears (good Ajax/js support via Mochikit), Subway (never >> tested), and Django (no Ajax support AFAIK). > > Note that "no Ajax support" is misleading. Of course yo

Re: urllib.urlopen

2005-12-17 Thread Xavier Morel
JabaPyth wrote: > Hello, > I'm trying to use the urllib module, but when i try urllib.urlopen, it > gives me a socket error: > > >>import urllib > >>print urllib.urlopen('http://www.google.com/').read() > Traceback (most recent call last): > File "", line 1, in ? > File "C:

Re: Can you pass functions as arguments?

2005-12-19 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > I want to calculate f(0) + f(1) + ...+ f(100) over some function f > which I can change. So I would like to create a function taking f as > argument giving back the sum. How do you do that in Python? > Python functions (and classes, and modules) are first-class objects,

Re: When Python *Eggs* better than Python *distutils*?? What's Eggs?

2005-12-20 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > So basically Python Eggs precompiles and compresses > binaries for you so you just have to load it to run > your app? > Nah, Eggs is a packaging system, what you don't have to do is compile/configure, because the packaging does that for you. It also handles things lik

Re: Try Python update

2006-01-06 Thread Xavier Morel
Mike Meyer wrote: > After spending time I should have been sleeping working on it, the try > python site is much more functional. It now allows statements, > including multi-line statements and expressions. You can't create code > objects yet, so it's still more a programmable calculator than > any

Re: [OT] - Requesting Comments for Process Definition and Presentation

2006-01-06 Thread Xavier Morel
Ilias Lazaridis wrote: > b) to retrieve feedback subjecting the Process Definition itself > (content of diagramms, clarity, terminology etc.) > This is a lie, and you know it. You are merely some kind of strange troll. You've built something that you consider the only "object model" worth using

Re: Python or Java or maybe PHP?

2006-01-06 Thread Xavier Morel
Mike Meyer wrote: > That doesn't sounds like "hates" to me. More like "doesn't like the > baggage." > > >> # Current behavior >>> def foo(*args, **kwargs): pass >>> print foo >>> # Extended behavior >>> # returns a reference to the function >>> def foo(*args, **kwarg

Re: One-step multiples list generation?

2006-01-06 Thread Xavier Morel
Damien Wyart wrote: > Thanks for these important and useful additions, they are very welcome ! > > In writing my answer I had immutables in mind, but mutables are a bit > more dangerous, here... > Not *that* much though. The first construct can't be used, but he can use >>> [copy.copy(Foo) fo

Re: Translate this to python?

2006-01-06 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > For some reason, ocassionally when I see xrange, I think "But wasn't > that deprecated since range is now a . . oh wait that's xreadlines". > xrange is a cool thing the few times where you really need it. > > john > >> Not sure what i is really for, but j seems to be

Re: Inheritance problem?

2006-01-06 Thread Xavier Morel
Pierre Barbier de Reuille wrote: > Well, I would even add : don't use super ! > Just call the superclass method : > > MyClass.__init__(self) > > > > Simon Percivall a écrit : >> Don't use self.__class__, use the name of the class. >> Bad idea if you're using new-style classes with a complex inh

Re: inline function call

2006-01-06 Thread Xavier Morel
Peter Hansen wrote: > Riko, any chance you could post the final code and a bit more detail on > exactly how much Psyco contributed to the speedup? The former would be > educational for all of us, while I'm personally very curious about the > latter because my limited attempts to use Psyco in th

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-06 Thread Xavier Morel
Ilias Lazaridis wrote: > I estimate that there is a "unfreeze" operation, too - which would lead > to flexibity. > There is none, you have to make a copy of the object via the "dup" (duplicate) method to get an unfrozen copy (note: clone yields an exact copy, which means that it's still frozen)

Re: Spelling mistakes!

2006-01-06 Thread Xavier Morel
KraftDiner wrote: > I've spent hours trying to find a bug that was a simple spelling > mistake. > > in an init method I declare a variable self.someLongName > > later in a different method of the class I use > self.sumLongName > Now I really meant self.someLongName. > In fact I don't want a vari

Re: Translate this to python?

2006-01-06 Thread Xavier Morel
Heiko Wundram wrote: > Xavier Morel wrote: >> I think that xrange is also soon-to-be deprecated (xrange eats a little >> less memory and is slightly faster to _create_, but much slower to >> _iterate over_ than range) > > It might be slower to iterate using xrange, b

Re: Python or Java or maybe PHP?

2006-01-06 Thread Xavier Morel
Alex Martelli wrote: > Xavier Morel <[EMAIL PROTECTED]> wrote: >... >> Wouldn't it be possible to change the `def` statement to return a >> reference to the function, and allow omitting the function name thereby >> bypassing the default binding (curr

Re: Inheritance problem?

2006-01-06 Thread Xavier Morel
Pierre Barbier de Reuille wrote: > Xavier Morel a écrit : >> Pierre Barbier de Reuille wrote: >> >>> Well, I would even add : don't use super ! >>> Just call the superclass method : >>> >>> MyClass.__init__(self) >>> >>> &g

Re: python speed

2006-01-07 Thread Xavier Morel
r than the equivalent Python code, if not faster. What's dog slow in Java is primarily the VM startup, and then the memory bloating, but as far as execution speed goes, pure Java code is much faster than pure Python much more often than the opposite (now that may change with Pypy, but Pypy is not

Stackless Python

2006-01-07 Thread Xavier Morel
Some time ago, I finally decided to check what Stackless was (exactly) and which were the theorical concepts behind it (continuations and all). I managed to find some documentations and papers, but most if not all of them are related to pre-2.0 Stackless. The issue is, I just can't seem to reac

Re: Stackless Python

2006-01-07 Thread Xavier Morel
Christian Tismer wrote: > Xavier Morel wrote: > >> Would anyone have more informations about that? It doesn't seem to be an >> issue on my side (since I tried to access the Stackless site from two >> different connections and 3 computers) but I can't rule it

Re: Spelling mistakes!

2006-01-09 Thread Xavier Morel
Antoon Pardon wrote: > I don't think unit tests are that helpful in this case. > Unit tests help you in finding out there is a bug, they > don't help that much in tracking down a bug. > > I for some reason a person is reading over the difference > between sumLongName and someLongName and doesn't n

Re: Problema con le RE....

2006-01-09 Thread Xavier Morel
Alessandro wrote: > Problema con le RE > Ho questa stringa "3 HOURS, 22 MINUTES, and 28 SECONDS" e la devo > 'dividere' nelle sue tre parti "3 HOURS", "22 MINUTES", "28 SECONDS". > La cosa mi viene molto con le RE...(inutile la premessa che sono molto > alle prime armi con RE e Python) > Qesi

Re: how to improve this simple block of code

2006-01-11 Thread Xavier Morel
Mel Wilson wrote: > py wrote: >> Say I have... >> x = "132.00" >> >> but I'd like to display it to be "132" ...dropping the trailing >> zeros... > > print '%g' % (float(x),) > > might work. > > Mel. > The input is a string, %g expects a float, TypeError exception. -- http://mail.python.o

Re: how to improve this simple block of code

2006-01-11 Thread Xavier Morel
Forget about the previous mail, i just saw you were converting the string to float beforehand, in which case he would more than likely run into the good ol' float imprecision issue sooner than later. Not to mention that %g formats to scientific notation (e.g. exponential format with the exponen

Re: Freezing

2006-01-12 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > The first line of that example has to be: > > s = |set([1, 3, 5])| > > But I don't know/remember why set() can't accept many values like > max/min: > > max([1,2,5]) > max((1,2,5)) > max(1,2,3) > > Bye, > bearophile > How about just providing a freeze method on `obje

Re: Converting a string to an array?

2006-01-12 Thread Xavier Morel
Tim Chase wrote: > The closest hack I could come up with was > > import random > s = "abcdefg" > a = [] > a.extend(s) > random.shuffle(a) > s = "".join(a) > > This lacks the beauty of most python code, and clearly feels like > there's somethign I'm missing. I

Re: More than you ever wanted to know about objects [was: Is everything a refrence or isn't it]

2006-01-15 Thread Xavier Morel
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: >... >>> 3. If two objects are equal with "==", does that >>> mean their values are the same? >> Almost universally, yes, although if you know enough about how the >> interpreter works "under the hood" you can define the response

Re: instance attributes not inherited?

2006-01-16 Thread Xavier Morel
John M. Gabriele wrote: > I'm having a hard time finding the documentation to the super() function. > I checked the language reference ( http://docs.python.org/ref/ref.html ) > but didn't find it. Can someone please point me to the relevant docs on > super? > > help( super ) doesn't give much info

Re: Arithmetic sequences in Python

2006-01-16 Thread Xavier Morel
Paul Rubin wrote: > There's something to be said for that. Should ['a'..'z'] be a list or > a string? To me, the most obvious result would be either a range object as a result, or always a list/generator of objects (to stay perfectly consistent). If a range of numbers translate into a list of nu

Re: OT: excellent book on information theory

2006-01-16 Thread Xavier Morel
Tim Peters wrote: > Non-English translations have real challenges, and because this series > is more popular than the Python Reference Manual these days, there's a > lot of fascinating info to be found. For example, I think the > Japanese translator deserves a Major Award for their heroic attempt

Re: Arithmetic sequences in Python

2006-01-16 Thread Xavier Morel
Steven D'Aprano wrote: > On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote: > >> For those who'd need the (0..n-1) behavior, Ruby features something that >> I find quite elegant (if not perfectly obvious at first), (first..last) >> provides a range from

Re: Arithmetic sequences in Python

2006-01-16 Thread Xavier Morel
Steven D'Aprano wrote: > On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote: > >> For those who'd need the (0..n-1) behavior, Ruby features something that >> I find quite elegant (if not perfectly obvious at first), (first..last) >> provides a range from

Re: forced spaces when inserting a variable between strings

2006-01-17 Thread Xavier Morel
mjteigen wrote: > I'm very new at Python, but have been trying it in conjunction with > CGI. I've encountered a problem that I'm pretty sure is a trivial one, > but I don't know enough Python to work it out. Here's an example. > Imagine that I have a file named "5.jpg" in the same directory as this

Re: Arithmetic sequences in Python

2006-01-17 Thread Xavier Morel
Paul Rubin wrote: > I don't think this is a valid objection. Python is already full of > syntactic sugar like indentation-based block structure, infix > operators, statements with keyword-dependent syntax, etc. It's that > very sugar that attracts programmers to Python away from comparatively > s

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Xavier Morel
Steve Holden wrote: > Debashis Dey wrote: >> Hello, >> >> I have a python CGI program. I would like to show a graph within a HTML >> plage. I would like to dynamically generate the graph using the python >> CGI script on the web server side and send it to the browser. >> >> My question is how

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Xavier Morel
Steve Holden wrote: > Luiz Geron wrote: >> I don't have experience on this, but I think that you can make the >> script return the image "contents" directly to the img tag, without >> passing it to a img file, so you can use something like this: >> >> >> >> wich saves some processing and I/O. >> >

IDLE Problem in Windows XP

2006-09-15 Thread ELATTAOUI Xavier
the menu "Highlighting" on right part, choose "IDLE Classic" and apply - close all and try to launch now the IDLE   This is what I have done and now it works (don't ask me why !!).   Hope this help, Xavier -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting date to milliseconds since 1-1-70

2006-01-26 Thread Xavier Morel
NateM wrote: > Thank you! If I am reading in dates as strings from a text file, like > "5/11/1998", how do I convert that to a format I can pass into mktime? > Thanks again. > Check time.strptime() -- http://mail.python.org/mailman/listinfo/python-list

Re: Decoupling the version of the file from the name of the module.

2006-01-28 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > I'm a newbie experimenting with Python. I want to incrementally develop > a module called 'circle'. The problem is now that the file name is used > for two purposes. To keep track of the version number and as the name > for the module. So when I develop the first version

Re: Decoupling the version of the file from the name of the module.

2006-01-29 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Now suppose I have make a new version with __version__ = 1.1. What > shall I call this file and (I don't want to overwrite the old file if I > need to go back to it) how do I import it from the shell. Your advice > sounds nice, but I would appreciate if you could give me

Re: Question about idioms for clearing a list

2006-01-31 Thread Xavier Morel
Steven Watanabe wrote: > I know that the standard idioms for clearing a list are: > > (1) mylist[:] = [] > (2) del mylist[:] > > I guess I'm not in the "slicing frame of mind", as someone put it, but > can someone explain what the difference is between these and: > > (3) mylist = [] > >

Re: classmethod and instance method

2006-02-02 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to write a method that needs to know both the class name and > the instance details > > Any suggestions? > What's the point of using a classmethod and an explicit cls argument when you can get the class object from the instance itself? >>> class

Re: Python on Windows

2006-02-03 Thread Xavier Morel
Simon Faulkner wrote: > I've just written my first (simple) WxPython program - yy! > > What would folks suggest is the easiest way to package it to run on > other windows PCs? > > I would love a single .exe file that would run without ANY OTHER FILES > even if it was 50 Mb! > > TIA > > >

Re: classmethod and instance method

2006-02-03 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Yes that's better. Didn't know about the __class__ attribute. I > thought there must be a way to access this but couldn't find it in the > docs. > > Thanks, > > Andy > dir(), help() and the interactive interpreter (IDLE or CLI) are your best friends. Any time you w

Re: Python on Windows

2006-02-04 Thread Xavier Morel
Grant Edwards wrote: > Definitely. Nobody does single .exe file windows programs > anymore. A single-file installer is almost as easy. > uTorrent, Process Explorer or Media Player Classic are single .exe windows programs. Granted, most of them are under-150kb-works-of-arts, but MPC isn't (well

Re: re.search slashes

2006-02-04 Thread Xavier Morel
Scott David Daniels wrote: > pyluke wrote: >> I'm parsing LaTeX document and want to find lines with equations blocked >> by "\[" and "\]", but not other instances of "\[" like "a & b & c \\[5pt]" >> so, in short, I was to match "\[" but not "\\]" I've tried: >> check_eq = re.compile('(?!\%\

Re: Importing a class, please help...

2006-02-05 Thread Xavier Morel
anon wrote: > Would somebody please drop me a hint, please? > Yeah, the definition of "JAR" is Java ARchive, why the hell would a Python script be able to read a JAR in the first place (truth is it is, a JAR file is nothing but a renamed ZIP, therefore the zipfile module allows you to read it's

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > x = input(raw_input("Please enter your name: ")) > if x==myself: print 'OK' > > It kinda works - I can get to the please enter your name bit but then > it simply reprints your input as output. Someone please HELP! > --> C:\>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.13

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > p.s. Xavier Morel, you seem to be using Windows, not Linux > I don't see how this may even remotely be relevant, Python is cross platform and (mostly) works the same regardless of the OS > I got > the idea of stacking input on a raw_input from the official P

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > http://docs.python.org/tut/node6.html#SECTION00610 > --> >>> x = int(raw_input("Please enter an integer: ")) <-- Unless my eyes fail me, it's written "int", not "input", the goal of this line is to convert the return value of raw_input (a string) into an integer.

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > Assumption. Im also new to programing, so could do something stupid > like think a Windows path is a command/input/etc. (really, ive done > things like that before.) > Don't assume anything when you have no reason to, and especially don't assume that a cross-platform programming lan

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: >> parse the expression, extract the operands and the operation, apply the > operation to the operands > > How? Give me some example code, but please keep it simple. > >> are you trying to code a calculator? > > Not intending to, just trying to learn Python. Suppose what i'm trying >

Re: Importing a class, please help...

2006-02-05 Thread Xavier Morel
Jorgen Grahn wrote: > You are rude to an obvious newbie here ... please keep in mind that today's > stupid newbies are tomorrow's Python professionals. > I didn't mean to be rude and apologize if that's the way it came out. > Maybe he /is/ running Jython and failed to explain that properly? >

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > I asked to keep it simple! Anyway, ill try Dive into Python, thanks > It is simple, merely explicit and with some details. -- http://mail.python.org/mailman/listinfo/python-list

Re: translating PHP to Python

2006-02-05 Thread Xavier Morel
Dave wrote: > Anyone familiar with PHP? I'm trying to make a translation. In PHP you > can get the current object's name by going like this: > > get_class(item) == 'ClassName' > > I've tried type(item), but since I can't be sure if I'll be in __main__ > or as a child object, I can't guarantee wha

Re: Dual Core outlook

2006-02-07 Thread Xavier Morel
malv wrote: > Of course, multiprocessing has been used for many years but this always > involved a much higher level of sophistication on the part of the > designers. This point seems to be largely hidden from the public, > ignorant and semi-ignorant, by the chip manufacturers. > Will new languages

  1   2   3   4   >