Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
Rocco Moretti wrote: > Paul McGuire wrote: > > "Claire McLister" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > We've been working with Google Maps, and have created a web service to > > map origins of emails to a group. As

Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
Robert Kern wrote: > [EMAIL PROTECTED] wrote: > > > North of that bubble is a second massive list also labeled Mountain > > View > > 94043. I found my name on that list and I live in the Chicago area. > > Moutain View is, perhaps, where aol.com is located? The

Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
Alan Kennedy wrote: > [Robert Kern] > >>Most of AOL's offices are in Dulles, VA. Google's headquarters are in > >>Mountain View, CA. > > [EMAIL PROTECTED] > > Aha, I post to the usenet through Google. Makes the map application > > all the more stu

Re: Using Which Version of Linux

2005-11-07 Thread [EMAIL PROTECTED]
Magnus Lycka wrote: > [EMAIL PROTECTED] wrote: > > ok, i m going to use Linux for my Python Programs, mainly because i > > need to see what will these fork() and exec() do. So, can anyone tell > > me which flavour of linux i should use, some say that Debian is more > &

Re: So, Which Version is Suitable for Beginners

2005-11-07 Thread [EMAIL PROTECTED]
I have found my novice Linux users take to SUSE (either Gnome or KDE) readily. Probably because the devfs interfaces to the windows interface readily. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem generating rows in table

2005-11-07 Thread [EMAIL PROTECTED]
len(toprint) -1 seems to be 0 so it seems that the loops are skipped ? why not just : for x in toprint: for y in x: print "%s" % y these suffix things are very prone to error. [EMAIL PROTECTED] wrote: > hi > i wish to generate a table using cgi > toprint = [(

Re: Distributed Cache Server?

2005-11-08 Thread [EMAIL PROTECTED]
this I've already coded, but not targetted towards large scale (100's machines etc)... So am thinking what I'd need to consider to increase this to a larger scale. Roger Binns wrote: > <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Does anyone k

Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
Isn't there an easier way than lst[len(lst) - 1] = ... ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
Or alternatively: Is there a way to make reference to the last element of a list, to use as a shorthand: ref := &lst[len(lst) - 1] # I know syntax is wrong, but you get the idea and then using the last element of the list by (assuming the element is a dict): ref["foo"] = 42 ref["bar"] = "Ni!"

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
I knew there was an easy way :) Just to satisfy my curiousity: Is there a way to do something like the reference solution I suggest above? -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
what do you mean by alias ? a = b now both a and b refers to the same object. [EMAIL PROTECTED] wrote: > So there is no way in Python to make an alias for an object? > > /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
I just want an alias. Ideally, I don't want to deal with pointers or special reference "types" etc. After all, this is not C++ :) I just want to be able to make a reference to any old thing in Python. A list, an integer variable, a function etc. so that I, in complicated cases, can make a shorthan

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
But if lst[42]["pos"] happens to hold an integer value, then a = lst[42]["pos"] will _copy_ that integer value into 'a', right? Changing 'a' will not change the value at lst[42]["pos"] -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
If you want to do what you want(though I don't know why without a concrete example), just store a mutable object at lst[42]["pos"], like this : lst[42]["pos"] = [1] a = lst[42]["pos"] a[0] = 2 assert(lst[42]["pos"][0] == 2) [EMAIL PROTECTED] wrot

Re: Sorting Documentation

2005-11-08 Thread [EMAIL PROTECTED]
For example, where can I find the official documentation on the list.sort() method? -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread [EMAIL PROTECTED]
So there is no way in Python to make an alias for an object? /David -- http://mail.python.org/mailman/listinfo/python-list

Sorting Documentation

2005-11-08 Thread [EMAIL PROTECTED]
I want to read a little bit about sorting in Python (sorted() and method sort()). But I can't seem to find anything in the documentation at the homepage? /David -- http://mail.python.org/mailman/listinfo/python-list

Re: socket receive file does not match sent file

2005-11-08 Thread [EMAIL PROTECTED]
Thanks Fredrik Lundh, This is great! I've rewrote the code and it works! Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

which feature of python do you like most?

2005-11-08 Thread [EMAIL PROTECTED]
which feature of python do you like most? I've heard from people that python is very useful. Many people switch from perl to python because they like it more. I am quite familiar with perl, I've don't lots of code in perl. Now, I was curious and interested in the python people. They certainly mad

Re: XML GUI

2005-11-08 Thread [EMAIL PROTECTED]
I had to do something like this for a project I was working on a while ago, it was a program based on alota plugins that would use a config file that looked sorta like an Xorg configuration, it seemed kinda hard at the time but it's acctually pretty fun and easy, the hard part is functionality you

Re: which feature of python do you like most?

2005-11-08 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > which feature of python do you like most? > > I've heard from people that python is very useful. > Many people switch from perl to python because they like it more. > > I am quite familiar with perl, I've don't lots of code in perl. &g

Re: Newb ??

2005-11-08 Thread [EMAIL PROTECTED]
Chad Everett wrote: > Hi all, I am new to the group. Trying to learn Python programming on my > own. I am working through Michael Dawson's Book Python Programming for the > absolute beginner. > > I am tring to write a program that is a number guessing game. I want to be > able to give the user

Re: Newb ??

2005-11-08 Thread [EMAIL PROTECTED]
I would rather to do the loop as : max_try = 5 for x in xrange(max_try): g = int(raw_input(["Take a guess","Take another guess"][x != 0])) if g == number: print "bingo, hit it in %i tries" % x + 1 break elif g < number: print "try higher" else: print "try lower" else: print "sorry

Re: append to non-existing list

2005-11-09 Thread [EMAIL PROTECTED]
I am afraid you have to either go back to php or whatever programming language that fits your style or change your style to fit python. There is a lot I don't like about python but if you have to use it, you have to cope with it. Yves Glodt wrote: > My question is: Is there no way to append to a

Re: append to non-existing list

2005-11-09 Thread [EMAIL PROTECTED]
If PHP is heavily influenced by Perl(as I read some where), the variable name determine it I believe. @myvar is an array ? [EMAIL PROTECTED] wrote: > I don't know php, but would also have to wonder how it knows to create a > list instead of an integer (for example). >

Re: append to non-existing list

2005-11-09 Thread [EMAIL PROTECTED]
Juho Schultz wrote: > Yves Glodt wrote: > > Hello, > > > > if I do this: > > > > for row in sqlsth: > > pkcolumns.append(row[0].strip()) > > etc > > > You mean you want to type "pkcolumns" only once to keep your code short? > Would something like this be useful? > > pkcolumns = [ro

Re: append to non-existing list

2005-11-09 Thread [EMAIL PROTECTED]
Thomas Bellman wrote: > The next time you go shopping at your local super-market, do > *not* get a shopping-cart (or shopping-basket, or any similar > container). As you pick up the things you want to buy, try > to put them into the non-existing cart. Perhaps you will then > become enlightened.

Re: append to non-existing list

2005-11-09 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > x = "10" + 20 # should this be 30 or 1020 or "1020" or ...? > I think Perl handles this case pretty well and sane. In fact, this strict but dynamic type checking is quite painful to work with, especially the new decimal class. I can do a : decimal + int but not deci

Re: Python obfuscation

2005-11-09 Thread [EMAIL PROTECTED]
How effective can it be when python is designed to make writing this kind of code hard(hopefully impossible) ? The most effective would be renaming function and may be variables but if the functions are kept short, they would at most looks like haskell ;-) Fredrik Lundh wrote: > hmm. is google do

Re: Make an exe file as a Windows Service

2005-11-09 Thread [EMAIL PROTECTED]
py2exe has an option to create a MS Windows service (see http://www.py2exe.org) from a Python script -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-09 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > Step one: globally replace all names in all python module withb names > that are composed of long strings of l, 1, 0 and 0. Fixing > cross-module references should be fun. Don't just make them random - > make them all start with the same sequence, and end with the same > sequenc

Re: overloading *something

2005-11-09 Thread [EMAIL PROTECTED]
Robert Kern wrote: > James Stroud wrote: > > > Does anyone else find the following annoying: > > > > py> from UserDict import UserDict > > py> aud = UserDict({"a":1, "b":2}) > > py> def doit(**kwargs): > > ... print kwargs > > UserDict only exists for backwards compatibility with old code that us

[ x for x in xrange(10) when p(x) ]

2005-11-09 Thread [EMAIL PROTECTED]
Hi, I am wondering if there is such a thing, as python is moving away from FP functions like dropwhile/takewhile etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > This becomes a valid list comprehension by writing 'if' instead of > 'when'. valid, yes. efficient, I am not sure. [ x for x in xrange(1000) if p(x) ] means I need to go through the whole range even if p = lambda x: x < 2. -- http://mail.python.org/mailman/listinfo/p

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread [EMAIL PROTECTED]
I thought I read some where there these are intended to be dropped(or at least moved out of built-in) ? George Sakkis wrote: > What about the future of itertools in python 3K ? IIRC, several > functions and methods that currently return lists are going to return > iterators. Could this imply that

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread [EMAIL PROTECTED]
I just try to use list/generator expression when possible and found I need dropwhile/takewhile from time to time and see if there will be a construct like this. As I sort of think that the language in general encouraging this style(like the talk about dropping map/filter/reduce). Alex Martelli wr

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread [EMAIL PROTECTED]
George Sakkis wrote: > >>> list(takewhile(p, xrange(1000))) > [0, 1] thanks. that is what I am doing now, in a more generic form : takewhile(p, (x for x in xrange(1))) -- http://mail.python.org/mailman/listinfo/python-list

Re: getting results into one variable

2005-11-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > a = db.execute(stmt) and then expand variable 'a' > > instead of doing > (a,b) = db.execute(stmt) for return of 2 > (a,b,c) = for return of 3 > (a,b,c,d) for return of 4 What do you intend to do with a, b, c,d ? a = f(x) always work. Y

Re: append to non-existing list

2005-11-10 Thread [EMAIL PROTECTED]
Yves Glodt wrote: > Which raises another question... :-) > > Is there a possibility to bring together apache and python in a way that > I can embed python into html? What do you mean ? > > Or even, write a smallish webserver in python (using twisted maybe) > whose only purpose is to serve pages an

Re: append to non-existing list

2005-11-10 Thread [EMAIL PROTECTED]
Yves Glodt wrote: > I need this (invalid example-html follows): > > > title of page > > > import time > > print "Hello, today is: %s" % (time.ctime()) > > ?> > > Cheetah template ? But I like Kid better as I don't want python in HTML, Kid IMO strikes the balance between python feature and XHTM

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > > George Sakkis wrote: > > > >>>>>list(takewhile(p, xrange(1000))) > >> > >>[0, 1] > > > > thanks. that is what I am doing now, in a more generic form : > > > > ta

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > How does a useless generator expression make it more generic? > > > > xrange is only picked as an example. I may be newbie on python but not > > that dumb if all I want i

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
I use "list" in the name in "english"/general sense(say a list in haskell is lazily evaluated), it could be a list or it could be a lazily evaluated iterable. The original post is really just about "when" or may be "until" syntax that makes it a bit shorter to read and hopefuly easier to understan

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > (I say "readable or somehow better" since you stated in another post "I > just try to use list/generator expression when possible" but you didn't > explain your reason for doing so. I assume you have some reason other > than arbitrary whim.) The reason is simple: I found it

Python as a HTTP Client

2005-11-10 Thread [EMAIL PROTECTED]
I am writing a program that has to do some lightweight HTTP communication with a webserver on the internet. I haven't checked, but I'm sure I could do something lowlevel like opening a socket myself and then send/receive everything myself on this (how do I do that?), but I'd bet that Python have so

Python as a HTTP Client

2005-11-10 Thread [EMAIL PROTECTED]
I am writing a program that has to do some lightweight HTTP communication with a webserver on the internet. I haven't checked, but I'm sure I could do something lowlevel like opening a socket myself and then send/receive everything myself on this (how do I do that?), but I'd bet that Python have so

wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread [EMAIL PROTECTED]
I've made the switch from tKinter to wxPython. I'm slowly trying to learn it, but I had a question - what is the appropriate object to subclass to create a "mega widget" ie A listbox with it's add/delete buttons already built in? wxPanel seems a possibility - any thoughts? A side question - why

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > This is the first time on this thread in which I'm glimpsing that you > mean 'when' not as in SQL (where it has just the same meaning as the > 'if' in Python's genexps/listcomps), but rather with the meaning that > any Pythonista would instinctively spell 'while'. Since AFA

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > So use takewhile(condition, some_generator) > > which is LESS to type. When your predicate is a function, there's no > need to wrap a lambda around it, just like there's no need to wrap an > '[x for x in' or '(x for x in' around a list/iterator. No. my predicate sometimes i

Re: Addressing the last element of a list

2005-11-10 Thread [EMAIL PROTECTED]
This mutable/immutable object and name/variable is confusing. Daniel Crespo wrote: > Well, I hope that newcomers to Python don't confuse himselves :) > > Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread [EMAIL PROTECTED]
Christoph Haas wrote: > But Vim scripting looked even evil for me... and > I've been working with Perl for a decade. :) Vim scripting is nasty, but thankfully you don't really need to use it any more. You can write all your code in python with just a one-line hook to map it to a key. On the topic

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > 2. Failing that, look in a help dictionary; I generated mine from the > info version of the Python docs, using a simple Python script. Which is as follows (run on all the python-lib*info* files and it'll generate a file called "output"; rename tha

Re: help make it faster please

2005-11-10 Thread [EMAIL PROTECTED]
why reload wordlist and sort it after each word processing ? seems that it can be done after the for loop. [EMAIL PROTECTED] wrote: > I wrote this function which does the following: > after readling lines from file.It splits and finds the word occurences > through a hash table...for so

Re: help make it faster please

2005-11-10 Thread [EMAIL PROTECTED]
;t see the need for sorting. seems like wasting cycles to me. [EMAIL PROTECTED] wrote: > Actually I create a seperate wordlist for each so called line.Here line > I mean would be a paragraph in future...so I will have to recreate the > wordlist for each loop -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-10 Thread [EMAIL PROTECTED]
t; to "I want to change an alias" issue involves using a mutable object. > > -- > Mike Meyer <[EMAIL PROTECTED]> > http://www.mired.org/home/mwm/ > Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > If you want to terminate a generator expression after the first sequence of > elements > satisfying a condition, and you don't want to use takewhile, I don't know of > a gotcha > to prevent you from just raising StopIteration, using an expression that will > do that, e.g.

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
oops, stand corrected. I was under the impression that an exception would break out of the current expression and forgot that the "for" would contain it(that StopIteration is a condition to it expects to stop it). thanks, this is the functionality I am looking for. Alex Martelli wrote: > Can you

how can i get system time?

2005-11-10 Thread [EMAIL PROTECTED]
Hi, Can I get a system date time? I want to get current time, like the target string should looks like: the output of : `date +"%Y%m%d %H:%M:%S"` how can i do this? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > IOW, your "when condition(x)" (IIUIC) can be spelled "if condition(x) or > stop()" neat trick. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a built-in method for transforming (1, None, "Hello!") to 1, None, "Hello!"?

2005-11-11 Thread [EMAIL PROTECTED]
do you mean this ? otherwise, don't know what you want. a, b, c = (1, None, "Hello!") Daniel Crespo wrote: > Is there a built-in method for transforming (1,None,"Hello!") to > 1,None,"Hello!"? > > Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > > > I've created Windows binaries for Python 2.3 and 2.4. It should be > > compatible with PentiumPro or later processors. > > Thanks! I hope to package up a release early next week, and to include > these.

Re: list of lambda

2005-11-11 Thread [EMAIL PROTECTED]
Leif K-Brooks wrote: > jena wrote: > > hello, > > when i create list of lambdas: > > l=[lambda:x.upper() for x in ['a','b','c']] > > then l[0]() returns 'C', i think, it should be 'A' > > Fredrik Lundh provided the general solution, but in this specific case, > the simplest solution is: > > l = [x

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > Well, it seems you do have to put them in the scopes of different generators, > not just for-clauses, depending on the semantics you want e.g., > > >>> def stop(): raise StopIteration > ... > >>> list( ((x,y) for x in xrange(20) if x<5 or stop() for y in xrange(20) if >

Re: [ x for x in xrange(10) when p(x) ]

2005-11-12 Thread [EMAIL PROTECTED]
Peter Otten wrote: > [EMAIL PROTECTED] wrote: > > > However, I found something interesting which I don't quite understand : > > > > list((x for x in [1,2,3] if x<2 or stop())) works > > > > but > > > > a = [ x for x in [1,2,3] if x <2 o

Re: directory listing

2005-11-12 Thread [EMAIL PROTECTED]
Shi Mu: Before all you were doing was defining a function with: import os def buildList( directory='c:\TEMP' ): dirs = [ ] listing = os.listdir(directory) for x in listing: x = os.path.join(directory, x) print x if os.path.isdir(x): dirs.append(x)

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-12 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > What processor are you running? Drat, didn't see this before I left work. I'm fairly certain it was a Pentium 4, definitely 1.7GHz, Win2000 and Python 2.3. So I thought I would run the test again on my home computers, a Pentium 4 1.5 GHz WinXP Python 2.3

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-12 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > What processor are you running? > > Drat, didn't see this before I left work. I'm fairly certain it was a > Pentium 4, definitely 1.7GHz, Win2000 and Python 2.3. > > So I thought I would run the test again o

want some python ide

2005-11-13 Thread [EMAIL PROTECTED]
i want some python ide use pygtk eric3 is good for me ,but i like gtk,so i want some pygtk ide look like eric3 wing is a good python ide,but i can not download it some other python ide(must use pygtk) thx -- http://mail.python.org/mailman/listinfo/python-list

Re: something wrong in wx

2005-11-13 Thread [EMAIL PROTECTED]
Don't know if this will help or not because it seems like a strange error if this is the problem. I've always had to run my wxPython apps with pythonw, otherwise it will give you an error saying it needs the GUI interpreter or something like that. However, this could be an operating system specif

Re: Clone an object

2005-11-14 Thread [EMAIL PROTECTED]
http://docs.python.org/lib/module-copy.html I would assume you want deep/shallow copy. Yves Glodt wrote: > Hello, > > how can I clone a class instance? > I have trouble finding that in the documentation... > > thanks and best regards, > Yves -- http://mail.python.org/mailman/listinfo/python-li

Re: problem with from win32com.client import Dispatch

2005-11-14 Thread [EMAIL PROTECTED]
Hello, If you want some goood examples of reading Web pages and automating this process I have a class that wraps all these functions. http://pamie.sourceforge.net But for your problem: You are trying to read the page before it is completely loaded either add a wait function or a simple sleep (

Re: Addressing the last element of a list

2005-11-14 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > You may be interested in reviewing > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/f96b496b6ef14e2/32d3539e928986b3 > > before continuing this topic ;-) Interesting indeed, I mean the argument of why python does it this way. I see the equiva

Re: compare list

2005-11-15 Thread [EMAIL PROTECTED]
Simon Brunning wrote: > On 15/11/05, Ben Bush <[EMAIL PROTECTED]> wrote: > > I found I named the following python file as sets.py, which brought the > > problem (is that right?). i changed it to other name and it works. > > But the logic output is wrong. > > fro

Re: Need advice on subclassing code

2005-11-15 Thread [EMAIL PROTECTED]
Would the approach of using a switch to decide to instatite which class good for you, like: py> class C: py. name = 'C' py. py> class D: py. name = 'D' py. py> switch = { (1, 1): C, (1,2): D } py> x = 1 py> y = 2 py> c = switch[(x,y)]() py> print c.name D py> -- http://mail.python.org/ma

Re: AJAX => APAX? Or: is there support for python in browsers?

2005-11-15 Thread [EMAIL PROTECTED]
Crackajax uses py2js to convert python code to client-side Javascript (so you develop in python). I've not used it, but am interested in hearing from anyone who has. http://www.aminus.org/blogs/index.php/phunt/2005/10/06/subway_s_new_ajax_framework http://www.aminus.org/blogs/index.php/phunt/2005

Re: Default method arguments

2005-11-16 Thread [EMAIL PROTECTED]
What you want is essentially : if parm_x is not supplied, use self.val_x So why not just express it clearly at the very beginning of the function : def f(self, parm_x=NotSupplied, parm_y=NotSupplied ,,,) if parm_x is NotSupplied: parm_x = self.val_x if parm_y is NotSupplied: parm_y = self.va

JMS yet again

2005-11-16 Thread [EMAIL PROTECTED]
I've seen various posts over the years asking if python can be used to communicate with JMS queues (whether MQ series, Jboss queues etc etc). I've seen solutions such as pymqi (good for MQ, but not for jboss I believe), and JPype. This must seem an obvious question, but has anyone actually tried

path module / class

2005-11-16 Thread [EMAIL PROTECTED]
Hi there, I haven't seen this topic pop up in a while, so I thought I'd raise it again... What is the status of the path module/class PEP? Did somebody start writing one, or did it die? I would really like to see something like Jason Orendorff's path class make its way into the python standard

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-16 Thread [EMAIL PROTECTED]
Neal Norwitz wrote: > Here's a really screwy thought that I think should be portable to all > Unixes which have dynamic linking. LD_PRELOAD. > > You can create your own version of malloc (and friends) and free. You > intercept each call to malloc and free (by making use of LD_PRELOAD), > keep tr

readline vi mode in python interactive shell

2005-11-16 Thread [EMAIL PROTECTED]
Hi comp.lang.python: New to the group and new to python, so don't tear me up too much ... I installed the GNU readline support in python2.4, and it is working, but there is one annoying behaviour that I am hoping to squash ... Namely, when I hit to go to edit mode, then hit 'k' to go up in the co

Re: readline vi mode in python interactive shell

2005-11-16 Thread [EMAIL PROTECTED]
Well, I subsequently found this: http://groups.google.com/group/gnu.bash.bug/browse_thread/thread/ab3d3d5ff3e1ea89/f50f81b86161b271?lnk=st&q=readline+vi+mode&rnum=25#f50f81b86161b271 to explain it. Bummer ... -- http://mail.python.org/mailman/listinfo/python-list

Re: running functions

2005-11-16 Thread [EMAIL PROTECTED]
Gorlon the Impossible wrote: > Hello > I'm not sure how to phrase this question. I have a Python function > that sends MIDI messages to a synth. When I run it, I of course have > to wait until it is finished before I can do anything else with > Python. Is it possible to run this function and still

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-16 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > > Considering that the main purpose is adding regression tests to confirm > that a hopefully-fixed memory leak does not recur, I'm not sure why > shared memory should be a problem. What scenarios would "leak shared > memory"? Apache leaks SHM segments in some scenarios. Sy

Re: Simulating call-by-reference

2005-11-17 Thread [EMAIL PROTECTED]
Rikard Bosnjakovic wrote: > I'm tidying up some code. Basically, the code runs a bunch of > regexp-searches (> 10) on a text and stores the match in a different variable. > > Like this: > > re1 = r' ..(.*).. ' > re2 = r' ' > re3 = r' .(.*).. ' > ... > m = re.search(re

Re: Python Library Reference - question

2005-11-17 Thread [EMAIL PROTECTED]
See this nice tool for Firefox. It's like a chm form live updated. :) http://projects.edgewall.com/python-sidebar []'s Luciano Pacheco -- http://mail.python.org/mailman/listinfo/python-list

Re: how to organize a module that requires a data file

2005-11-17 Thread [EMAIL PROTECTED]
I have tried several ways, this is the way I like best (I develop in Windows, but this technique should work in *NIX for your application) :: \whereever\whereever\ (the directory your module is in, obviously somewhere where PYTHONPATH can

Re: newb ?

2005-11-17 Thread [EMAIL PROTECTED]
Chad Everett wrote: > Hey guys, > > I am back. Trying to expand on a program that was given in the book I am > studying. > > No I am not a high school or college student. Doing this on my own. and > having way to much trouble > > I am trying to add a hint section to a word jumble program. > >

Re: Zope vs Php

2005-11-17 Thread [EMAIL PROTECTED]
I believe Cheetah can do this kind of thing, Kid too. Personally, I like Kid more. And you can take a look at TurboGears which is a bag of tools (web server - cherrypy, template - Kid, ORM - SQLObject) glued together in a pretty nice way. Steve wrote: > We are building a web app and the our backen

Re: Zope vs Php

2005-11-17 Thread [EMAIL PROTECTED]
Jorge Godoy wrote: > Kid is for XML output. It won't work with non-HTML output... > I believe someone patches it to output plain text, thus it is possible to do "makefile" like things. I don't have such a need so don't know the detail. It can output XML as well as HTML which I believe you already

Yield in a wrapper function

2005-11-18 Thread [EMAIL PROTECTED]
This works exactly as you would expect:: from time import sleep def foo(on='ABC'): for e in list(on): sleep(1) yield e When I run this on the command line It takes about 3 seconds to complete and the first letter is shown after 1 second. But, how do I wrap the function somew

Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
There is problaly a really simple answer to this, but why does this function print the correct result but return "None": def add(x, y): if x == 0: print y return y else: x -= 1 y += 1 add(x, y) print add(2, 4) result: 6 None Martin -- http://mai

Re: Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
any change you want to have : "return add(x,y)" in the else ? [EMAIL PROTECTED] wrote: > There is problaly a really simple answer to this, but why does this > function print the correct result but return "None": > > def add(x, y): > if x == 0: >

Re: Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
I still don't get it. I tried to test with x = 0 and found that to work. How come since the value of y is right and it is printed right it "turns into" None when returned by the return statement ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on linux

2005-11-18 Thread [EMAIL PROTECTED]
Partitioning a hard disk on linux can be done with parted, see http://www.gnu.org/software/parted/parted.html - I don't know how good the python-pated interface is, and what it's capable of -- http://mail.python.org/mailman/listinfo/python-list

Re: path module / class

2005-11-18 Thread [EMAIL PROTECTED]
Hi Neil, Neil Hodgson wrote: [snip] > There is no PEP yet but there is a wiki page. > http://wiki.python.org/moin/PathClass > Guido was unenthusiastic so a good step would be to produce some > compelling examples. I guess it depends on what is "compelling" :) I've been trying to come up

Re: Reading a file in same directory as code with relative path

2005-11-18 Thread [EMAIL PROTECTED]
Answer to a similar question: http://groups.google.com/group/comp.lang.python/msg/c01f292d7926f393?hl=en&; If you want a way that will work regardless if your module is run interactively, imported, or just run by itself, this is a solution that will always work: :: \wherever\wherever\ (the d

Re: Adding through recursion

2005-11-18 Thread [EMAIL PROTECTED]
Ben Finney wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > def add(x, y): > > if x == 0: > > print y > > return y > > else: > > x -= 1 > > y += 1 > > add(x, y) > > To add t

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread [EMAIL PROTECTED]
The cleanest(IMO) is this : a = (predicate and [if_true_expr] or [if_false_expr])[0] This would give you the necessary "short circuit" behaviour no matter what. a = predicate and if_true_expr or if_false_expr works most of the time but should if_true_expr turns out to be 0 or something like tha

Re: How to do "new_variable = (variable) ? True : False; " (php) on python?

2005-11-18 Thread [EMAIL PROTECTED]
Peter Otten wrote: > Daniel Crespo wrote: > > > How can I do > > > > new_variable = (variable) ? True : False; > > > > in Python in one line? > > new_variable = variable > > :-) I would assume the OP is just lazy and don't want to type : new_variable = (variable_is_true_value) ? some_expression_

Re: Underscores in Python numbers

2005-11-18 Thread [EMAIL PROTECTED]
Personally, I would rather see the int() and float() function be smarter to take what is used for this, i.e. : a = int("1,234,567") Of course, also support the locale variant where the meaning of "," and "." is swapped in most European countries. Gustav HÃ¥llberg wrote: > I tried finding a discus

<    1   2   3   4   5   6   7   8   9   10   >