Re: how to append to a list twice?

2006-04-21 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > > But of course that only does it once, and I don't want to have to copy > > > and paste the append line. Perhaps there's a better way than this. > > > > def makeseries(N): > > series = [N] > > append = series.append > >

Re: Powerful Command line parsers

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >To meet your specifications, the module would need to incorporate a >mini-language: > >if a and (b or c): nasty("blah 1") >if not (a or b or c or d): nasty("blah 2") >if a and c and not d: nasty("blah 3") Prolog-style predi

Re: lambda

2006-04-21 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I need your help understanding lambda (and doing it a better way > without). > > f = lambda x : x*x There is no reason to ever write name=lambda... def f(x): return x*x is better because it attaches the name to the funct

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-21 Thread Cavingdeep
With new-style classes you can find out a class' subclasses and then you can instantiate the subclass you want. Suppose you have two classes A and B, B is a subclass of A, A is a new-style class. Now you have an A's instance called "a", to instance B you can do the following: b = a.__class__.__sub

Re: R Paul Johnson is out of the office.

2006-04-21 Thread Terry Reedy
"RK" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ok, who's been playing with mailman? I am sure the problem is a mis-configured auto-responder robot. Nothing like telling the world that you are not around to watch your home or office, Reminds me of when newspapers used to

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Ravi Teja
> Well, Java does have this great feature called "market-hype"... I ... concede. -- http://mail.python.org/mailman/listinfo/python-list

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Anthony Liu
OK, I actually just want to "manually" create Hidden Markov Models by randomly generating the initial state probabilities PI, the transition probabilities A and the emission probabilities B, instead of learning such statistics from a corpus. They have to be subject the constraint that sum(PI) =

Re: Updated PEP 359: The make statement

2006-04-21 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The make statement was mostly syntactic sugar for:: > >class : >__metaclass__ = > > > So was technically unnecessary from the beginning. ;) Here's the one > post where he presented a few reasons

Re: python equivalent of VB code sample

2006-04-21 Thread mirandacascade
Thank you for pointing me in the direction of XMLHTTP. I'm still thinking about this in terms of creating a python script that is functionally equivalent to the VB code in the original post. The information I reviewed about XMLHTTP makes me think that it may be possible to use the win32com.client

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Felipe Almeida Lessa
Em Sáb, 2006-04-22 às 03:16 +, Edward Elliott escreveu: > If that level of accuracy > matters, you might consider generating your rands as integers and then > fp-dividing by the sum (or just store them as integers/fractions). Or using decimal module: http://docs.python.org/lib/module-decimal

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Carl Banks <[EMAIL PROTECTED]> wrote: >Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, >> Carl Banks <[EMAIL PROTECTED]> wrote: >>>Wildemar Wildenburger wrote: Are there any concepts that python has not borrowed, concepts that were not even ins

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Edward Elliott
Anthony Liu wrote: > But, I want the random numbers just generated sum up > to 1 . This seems like an odd request. Might I ask what it's for? Generating random numbers in [0,1) that are both uniform and sum to 1 looks like an unsatisfiable task. Each number you generate restricts the possib

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Carl Banks
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > >Wildemar Wildenburger wrote: > >> Are there any concepts that python has not borrowed, concepts that were > >> not even inspired by other languages? I'm just interested if it is > >> "merely" a best-of

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Mel Wilson
Anthony Liu wrote: > I am at my wit's end. > > I want to generate a certain number of random numbers. > This is easy, I can repeatedly do uniform(0, 1) for > example. > > But, I want the random numbers just generated sum up > to 1 . > > I am not sure how to do this. Any idea? Thanks. number

Re: proposed Python logo

2006-04-21 Thread Grant Edwards
On 2006-04-21, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: > >>Sincy Python wasn't named after the snake, why the insistence >>on using a snake in the logo? > ... >>I think something Monty Python related would be bette

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Michael Spencer
Anthony Liu wrote: > I am at my wit's end. > > I want to generate a certain number of random numbers. > This is easy, I can repeatedly do uniform(0, 1) for > example. > > But, I want the random numbers just generated sum up > to 1 . > > I am not sure how to do this. Any idea? Thanks. > > __

Generate a sequence of random numbers that sum up to 1?

2006-04-21 Thread Anthony Liu
I am at my wit's end. I want to generate a certain number of random numbers. This is easy, I can repeatedly do uniform(0, 1) for example. But, I want the random numbers just generated sum up to 1 . I am not sure how to do this. Any idea? Thanks. _

Re: String To Dict Problem

2006-04-21 Thread Felipe Almeida Lessa
Em Sex, 2006-04-21 às 18:40 -0700, Clodoaldo Pinto escreveu: > Only a small problem when I try to evaluate this: > > safe_eval('True') Change def visitName(self,node, **kw): raise Unsafe_Source_Error("Strings must be quoted", node.name, node) To

Re: String To Dict Problem

2006-04-21 Thread Michael Spencer
Clodoaldo Pinto wrote: > Michael Spencer wrote: > >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 > > Very nice work. It will be very useful. Thanks. > > Only a small problem when I try to evaluate this: > > safe_eval('True') > > I get: > > Traceback (most recent call last):

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Carl Banks <[EMAIL PROTECTED]> wrote: >Wildemar Wildenburger wrote: >> Are there any concepts that python has not borrowed, concepts that were >> not even inspired by other languages? I'm just interested if it is >> "merely" a best-of collection of language features

Re: String To Dict Problem

2006-04-21 Thread Clodoaldo Pinto
Michael Spencer wrote: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 Very nice work. It will be very useful. Thanks. Only a small problem when I try to evaluate this: safe_eval('True') I get: Traceback (most recent call last): File "safe_eval.py", line 63, in ? safe_e

Re: perspective on ruby

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >XML? Conceptually (and more elegantly) covered >as LISP s-expressions. "...Lisp is still #1 for key algorithmic techniques such as recursion and condescension." -- Verity Stob

Re: Finding Module Dependancies

2006-04-21 Thread mwt
Wow! Just ran pychecker on a couple of modules. I'm blown away by how much information I'm getting. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Module Dependancies

2006-04-21 Thread mwt
Wow! Just ran pychecker on a couple of modules. I'm blown away by how much information I'm getting. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a dictionary from a string?

2006-04-21 Thread Michael Spencer
Clodoaldo Pinto wrote: > Is there a simple way to build a dictionary from a string without using > eval()? > s = '{"a":1}' d = eval(s) d > {'a': 1} > > Regards, Clodoaldo Pinto > Here is a discussion about one way to do it: http://tinyurl.com/o8mmm HTH Michael -- http://mail.p

Re: Finding Module Dependancies

2006-04-21 Thread mwt
John Machin wrote: > > This is called "testing". Yes, it could take a long time. Thanks for the clarification. ;) Actually, I've done hellish amounts of testing on these code pieces, which is why I don't want to have to do it all over again just to check the imports. > > Consider pychecker an

Re: Raising a specific OSError

2006-04-21 Thread Kelvie Wong
Looking at the Python docs.. I found this: http://docs.python.org/ext/errors.html """ Another useful function is PyErr_SetFromErrno(), which only takes an exception argument and constructs the associated value by inspection of the global variable errno. The most general function is PyErr_SetObject

Re: Pythonesque interface.

2006-04-21 Thread Gaz
:) Right now im trying to dl Jython (SF.net server down?), if it's language sintaxis is just like Python and allows to use numpy and PIL, im in! (i think :) ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Raising a specific OSError

2006-04-21 Thread Kelvie Wong
I do not see the point in doing so (why not just copy+paste that string?), but the errno (specifically ENOENT) corresponds to the POSIX.1 error number, and the string "No such file or directory" is done in C via strerror(ENOENT); (check errno(3) and strerror(3)). I doubt there is something that do

How to create a dictionary from a string?

2006-04-21 Thread Clodoaldo Pinto
Is there a simple way to build a dictionary from a string without using eval()? >>> s = '{"a":1}' >>> d = eval(s) >>> d {'a': 1} Regards, Clodoaldo Pinto -- http://mail.python.org/mailman/listinfo/python-list

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Tim Chase
> Actually, I can't think off the top of my head, any > feature in the Java language (and I am making no > assertions about the implementation of specific > instances) that was truly innovative. Let's see...it has bytecode compliation. Oh...not original. Okay, howsabout cross-platform neutra

Re: Finding Module Dependancies

2006-04-21 Thread John Machin
On 22/04/2006 8:18 AM, mwt wrote: > When I'm rewriting code (cutting and pasting pieces from earlier > modules) Instead of propagating multiple copies of source code, consider refactoring those modules so that top-level functions and classes can be used in other modules. > is there a quick way

Re: Finding Module Dependancies

2006-04-21 Thread Larry Bates
mwt wrote: > When I'm rewriting code (cutting and pasting pieces from earlier > modules), is there a quick way to determine if I have imported all the > necessary modules? I am used to working in Java, where the compiler > will tell you if you haven't imported everything, and also Eclipse, > which

Re: Jython: exec a string

2006-04-21 Thread Fabio Zadrozny
On 4/21/06, Edward Elliott <[EMAIL PROTECTED]> wrote: iirc java doesn't like multiple classes in a single file (not countinganonymous or inner classes).  sounds like jython may have the samerestriction...Actually, that's not completely true. The restriction is that you can have only 1 public class

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Ravi Teja
>>"like the hashtable in java" People don't give a reference to a language feature only because it added/invented it but also because it is a popular one that many are familiar with. Java did not invent HashTables. They existed long before and were available to most languages before Java. Neither

Re: Finding Module Dependancies

2006-04-21 Thread Fabio Zadrozny
Actually, if you use the pydev extensions plugin for Eclipse (http://www.fabioz.com/pydev), it would make that analysis for you (and is actually quite fast).Cheers, FabioOn 21 Apr 2006 15:18:05 -0700, mwt <[EMAIL PROTECTED]> wrote: When I'm rewriting code (cutting and pasting pieces from earliermod

converting xmllib to xml.sax

2006-04-21 Thread Sakcee
Hi I am trying to convert an override of xmllib.XMLparser , in the handle_doctype method we are catching the entities using load_dtd(sysid).gen_ents how can I do the same with xml.sax, does xml.sax has anything to catch the entties thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Powerful Command line parsers

2006-04-21 Thread John Machin
On 22/04/2006 4:15 AM, PyPK wrote: > Is there a Command line parser in python that can: > 1. resolve conflicts > 2. specify something like requires > 3. and smart "... that can ... and smart" does not compute. > > for ex: > python test.py --a --b --c --d I'm used to seeing --fubar and -f; what

Re: Pythonesque interface.

2006-04-21 Thread alisonken1
OP = Original Poster -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda

2006-04-21 Thread Ben C
On 2006-04-21, Alexis Roda <[EMAIL PROTECTED]> wrote: > Ben C escribió: >> On 2006-04-21, Ben C <[EMAIL PROTECTED]> wrote: >> Having said that, I attempted to confirm this using def rather than >> lambda, and encountered something I cannot explain at all-- it appears >> that the functions are getti

Re: Pythonesque interface.

2006-04-21 Thread Gaz
OP? -- http://mail.python.org/mailman/listinfo/python-list

Re: proposed Python logo

2006-04-21 Thread Carl J. Van Arsdall
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: > > >> Sincy Python wasn't named after the snake, why the insistence >> on using a snake in the logo? >> > ... > >> I think something Monty Python related would be better. How >> abo

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Sandra-24" <[EMAIL PROTECTED]> wrote: >Can you create an instance of a subclass using an existing instance of >the base class? I think you're taking Python's OO-ness too seriously. One of the strengths of Python is that it can _look_ like an OO language without

Re: proposed Python logo

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Michael Tobis" <[EMAIL PROTECTED]> wrote: >I think the colon as snake-eyes thing is a big win I liked that bit too. Whatever changes are made, that should be kept. -- http://mail.python.org/mailman/listinfo/python-list

Re: Updated PEP 359: The make statement

2006-04-21 Thread Steven Bethard
Tim Roberts wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Steven Bethard wrote: >>> I've updated PEP 359 with a bunch of the recent suggestions. ... >> Guido has pronounced on this PEP: >>http://mail.python.org/pipermail/python-3000/2006-April/000936.html >> Consider it dead. =) > >

Re: proposed Python logo

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: >Sincy Python wasn't named after the snake, why the insistence >on using a snake in the logo? ... >I think something Monty Python related would be better. How >about a nice can of spam? Six words: copyright violation ... t

Re: proposed Python logo

2006-04-21 Thread Grant Edwards
On 2006-04-21, Michael Tobis <[EMAIL PROTECTED]> wrote: > This http://www.informatik.uni-trier.de/~roth/bilder/mpfc/GUMBY3.JPG > chap? > > I'm not sure that conveys the intended gravitas to the > corporate community, though. Monty Python never was very big on "corporate community gravitas", so th

Re: PyLint results?

2006-04-21 Thread Felipe Almeida Lessa
Em Sex, 2006-04-21 às 13:49 -0400, Michael Yanowitz escreveu: >I ran the new pylint and my code and I had a few questions on why those > are warnings or what I can do to fix them: You can ignore the warnings you don't like with the --disable-msg option. Also, you can add a header to the file t

Re: Raising a specific OSError

2006-04-21 Thread David Hirschfield
I wasn't clear enough in my original post. I know how to raise a basic OSError or IOError, but what if I want to raise specifically an "OSError: [Errno 2] No such file or directory"? Somehow it must be possible to raise the error with the correct information to bring up the standard message, b

Re: proposed Python logo

2006-04-21 Thread Michael Tobis
A more Monty sort of Python logo would be fine with me. A flying sheep perhaps? An exploding penguin? A giant hedgehog? A dog license with the word "dog" crossed out and "cat" written in crayon? A great big book on how to put your budgie down? This http://www.informatik.uni-trier.de/~roth/bilder/m

Re: Raising a specific OSError

2006-04-21 Thread alisonken1
To raise a specific error, just find the error that you want to raise, then give the error a text string to print: ex. raise IOError("This raises an IO error") On the stderr output, when the routine hits this line, you will get: >>> raise IOError("This raises an IOError") Traceback (most recent

Re: proposed Python logo

2006-04-21 Thread Tim Parkin
BartlebyScrivener wrote: >>>(and it's an older version of the logo) because >>>you can get T-Shirts from cafepress.com/pydotorg and any profits go to >>>the psf. > > > I just ordered some stuff from cafe press, are you saying I'm getting > an old version of the logo? > An alternate 'collectors'

Raising a specific OSError

2006-04-21 Thread David Hirschfield
I know this should be obvious, but how does one raise a specific type of OSError? When I attempt to perform a file operation on a non-existent file, I get an OSError: [Errno 2], but what if I want to raise one of those myself? Thanks in advance, -Dave -- Presenting: mediocre nebula. -- http:

Finding Module Dependancies

2006-04-21 Thread mwt
When I'm rewriting code (cutting and pasting pieces from earlier modules), is there a quick way to determine if I have imported all the necessary modules? I am used to working in Java, where the compiler will tell you if you haven't imported everything, and also Eclipse, which has the handy "organi

Re: how to append to a list twice?

2006-04-21 Thread Peter Otten
John Salerno wrote: > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > (where each item is repeated twice after the first one), how might I do > that most efficiently? series = [100]*21 series[1::2] = series[2::2] = range(99, 89, -1) :-) Peter -- http://mail.python.org

Re: Pythonesque interface.

2006-04-21 Thread bearophileHUGS
Michael Tobis>Yes but he obviously wants this to be delivered to the browser.< I think Jython can be used to create applets that run with the JavaVM. Can't it be used to solve the OP problem (even without PIL)? Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter hiding/showing widgets

2006-04-21 Thread Philippe Martin
Maybe like this ? http://www.faqts.com/knowledge_base/view.phtml/aid/21215/fid/264 I noticed with wxWidget, which uses the same packing principle (xlib inheritance ?) that hidding a widget can have a strange effect on the layout of the "other guys" still visible ... so I just disable them now in

Re: Announce: RPyC's wiki!

2006-04-21 Thread gangesmaster
[for people who missed my previous posts] """RPyC is a transparent, symmetrical python library for distributed-computing. Pronounced "are-pie-see", it began as an RPC library (hence the name), but grew into something much more comprehensive with many use cases. It basically works by giving you ful

Announce: RPyC's wiki!

2006-04-21 Thread gangesmaster
the RPyC's project page has moved to http://rpyc.wikispaces.com the old site (http://rpyc.sourceforge.net) redirects there now. because it's the official site, i chose to limit changes to members only. it's so much easier to maintain the wiki that the crappy htmls at sourceforge :) anyway, the ne

Re: lambda

2006-04-21 Thread Alexis Roda
Ben C escribió: > On 2006-04-21, Ben C <[EMAIL PROTECTED]> wrote: > Having said that, I attempted to confirm this using def rather than > lambda, and encountered something I cannot explain at all-- it appears > that the functions are getting redefined whenever they are called, to > effect a kind of

Re: Read and extract text from pdf

2006-04-21 Thread Jim
There is a pdftotext executable, at least on Linux. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended IDE for creating GUI?

2006-04-21 Thread Edward Elliott
can anyone here comment on boa constructor? http://boa-constructor.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Jython: exec a string

2006-04-21 Thread Edward Elliott
iirc java doesn't like multiple classes in a single file (not counting anonymous or inner classes). sounds like jython may have the same restriction... abcd wrote: > the error i get when i run the exec is, "java.lang.ClassFormatError"... > > thanks > -- http://mail.python.org/mailman/listinf

Re: proposed Python logo

2006-04-21 Thread BartlebyScrivener
>> (and it's an older version of the logo) because >> you can get T-Shirts from cafepress.com/pydotorg and any profits go to >> the psf. I just ordered some stuff from cafe press, are you saying I'm getting an old version of the logo? rick -- http://mail.python.org/mailman/listinfo/python-list

Re: PyLint results?

2006-04-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Michael Yanowitz wrote: > 2) C: 0: Missing required attribute "__revision__" >What is this? Is that for CVS? I don't use CVS (we use SVN). I have not >seen any sample code which includes this tag yet. But if I include >__revision 1.0 somewhere in the code it w

Re: Looking for a programming resource for newbees

2006-04-21 Thread Evgeny
maybe How to Think Like a Computer Scientist: http://www.ibiblio.org/obp/thinkCSpy/ will help -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended IDE for creating GUI?

2006-04-21 Thread petrov
http://wxglade.sourceforge.net/ - WxGlade is one option. It is quite helpful although somewhat unstable. http://wingware.com/ - is an IDE i dont remember if it has a UI builder. Probably worth checking anyway. -- http://mail.python.org/mailman/listinfo/python-list

Tkinter hiding/showing widgets

2006-04-21 Thread Anony
Is it possible to hide and show widgets while the window is open? -- http://mail.python.org/mailman/listinfo/python-list

www.python.org problems

2006-04-21 Thread Aahz
Before people start sending a flood of e-mail to webmaster, we already know that www.python.org is having problems. Please be patient. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Argue for your limitations, and sure enough they're yours." --Richard Bach -- ht

Re: Jython: exec a string

2006-04-21 Thread abcd
the error i get when i run the exec is, "java.lang.ClassFormatError"... thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Thanks from the Java Developer

2006-04-21 Thread John Salerno
Kent Johnson wrote: >> At least in the Bay Area, the jobmarket for Python programmers is wild, >> right now -- firms such as Google, Pixar, BitTorrent, IronPort, etc, >> etc, all hungry for Pythonistas -- BayPIGgies mailing list bitching over >> too many job-offer posts, and the nuisance of all th

Re: BIOCHIP --->>> NO GOOD !!

2006-04-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Petr Prikryl wrote: > rainbow.cougar wrote in message >> okay wrote: >> > To Archbishop Christodoulos Paraskevaides of the Greek Orthodox Church >> > in Athens and Greece Archbishop, >> > I talked with a Greek Orthodox believer in Australia and he told me two >> >> I'm thin

Re: threading, how to?

2006-04-21 Thread akrapus
Thanks a lot to all of you guys. I think it'll take some time before I grasp it properly... -- http://mail.python.org/mailman/listinfo/python-list

Re: win32com.client.constants - AttributeError

2006-04-21 Thread kbperry
Wow..I didn't even realize that this existed. Thanks for your help! -- http://mail.python.org/mailman/listinfo/python-list

Jython: exec a string

2006-04-21 Thread abcd
I have a single jython file, foo.py which contains multiple classes. I read that into a string and try to exec itbut I get errors saying something like unable to load class. It seems to work fine if foo.py only contains a single class, any ideas? -- http://mail.python.org/mailman/listinfo/p

Re: lambda

2006-04-21 Thread rubbishemail
Hello Alexis, thank you for the fast help! I am not against lambdas, but, sometimes they are a bit confusing to me, especially as you don't see many examples used. Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda

2006-04-21 Thread Ben C
On 2006-04-21, Ben C <[EMAIL PROTECTED]> wrote: > On 2006-04-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I need your help understanding lambda (and doing it a better way >> without). >> >> f = lambda x : x*x >> [...] >> # the idea is now to give the definition of the multiplic

Re: Strategy Design Pattern

2006-04-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Daniel Santa Cruz wrote: > In the specific case of the Strategy pattern, I think the goal is to > abstract out of the class an algorithm that can then be reused by some > of the inherited classes. This way we don't repeat ourselves. Maybe I > got this all wrong... IMHO

Re: win32com.client.constants - AttributeError

2006-04-21 Thread Roger Upole
There are a couple of different ways to run makepy. Start Pythonwin, and from the menu select Tools->Com Makepy Utility. You should see a list of registered typelibs. Select "Microsoft Word x.y Object Library" and hit Ok. This can also be done programatically by initiating Word with win32com.clie

Re: how to append to a list twice?

2006-04-21 Thread Gerard Flanagan
John Salerno wrote: > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > (where each item is repeated twice after the first one), how might I do > that most efficiently? > > Right now I have this: > > series = [100] > for x in range(10): # just for testing > series.app

Can you create an instance of a subclass with an existing instance of the base class?

2006-04-21 Thread Sandra-24
Can you create an instance of a subclass using an existing instance of the base class? Such things would be impossible in some languages or very difficult in others. I wonder if this can be done in python, without copying the base class instance, which in my case is a very expensive object. Any i

Re: how to append to a list twice?

2006-04-21 Thread Dave Hansen
On 21 Apr 2006 12:50:38 -0700 in comp.lang.python, [EMAIL PROTECTED] wrote: >I don't get it (the Elliot solution)... How is it that the first value >is repeated once times, and the remaining values are repeated twice >times? Integer division truncates. 200/2 -> 100, 199/2 -> 99, 198/2 -> 99, etc

Re: proposed Python logo

2006-04-21 Thread Tim Parkin
Michael Tobis wrote: > > That said, and conceding that the first impression is positive, I don't > see how it represents Python. More to the point, the longer I look at > it the less I like it, and I would NOT wear it on a T-shirt. > over 25 people disagree with you so far and thats without any

Re: Thanks from the Java Developer

2006-04-21 Thread Ant
> So switch jobs -- it's a good time. If it were that easy I would.. However, I have family commitments keeping me in Yorkshire (UK) (as well as the fact that I really like the area!), and the jobs in the area are all Java, .NET (predominantly C#) and C++. Always on the lookout for Python work th

Re: Recommended IDE for creating GUI?

2006-04-21 Thread Anony
Marty Christion wrote: > What are some good free or inexpensive (<$50) IDE's for learning how to > program and create GUI's for Python? I'm pretty good with the simple > programming aspect of the language, but I'm a little mystified by the world > of GUI's, and the options available in python. I

Re: how to append to a list twice?

2006-04-21 Thread John Salerno
John Salerno wrote: > [EMAIL PROTECTED] wrote: >> I don't get it (the Elliot solution)... How is it that the first value >> is repeated once times, and the remaining values are repeated twice >> times? >> > > Because of the way division works. The first number in the range is 200, > and 200/2 is

Re: lambda

2006-04-21 Thread Mel Wilson
[EMAIL PROTECTED] wrote: > Hello, > > I need your help understanding lambda (and doing it a better way > without). > > f = lambda x : x*x [ ... ] > # the idea is now to give the definition of the multiplication of > functions and integers > # (f * c)(xx) := f(x)*c > [lambda xx: f(xx)*y for y in

Re: win32com.client.constants - AttributeError

2006-04-21 Thread kbperry
Please help! Anyone else know? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to append to a list twice?

2006-04-21 Thread John Salerno
[EMAIL PROTECTED] wrote: > I don't get it (the Elliot solution)... How is it that the first value > is repeated once times, and the remaining values are repeated twice > times? > Because of the way division works. The first number in the range is 200, and 200/2 is 100. The next number is 199, an

Re: lambda

2006-04-21 Thread Ben C
On 2006-04-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I need your help understanding lambda (and doing it a better way > without). > > f = lambda x : x*x > [...] > # the idea is now to give the definition of the multiplication of > functions and integers > # (f * c)(xx) := f(x)*

Re: how to append to a list twice?

2006-04-21 Thread callmebill
I don't get it (the Elliot solution)... How is it that the first value is repeated once times, and the remaining values are repeated twice times? -- http://mail.python.org/mailman/listinfo/python-list

Re: send cookie on request with urllib2

2006-04-21 Thread John J. Lee
"itay_k" <[EMAIL PROTECTED]> writes: > ok. > i will explain what exactly i wanna do. > > i want to simulate the following client-side script with python: > > > > > document.cookie="name=tom"; > document.images["Pic"].src="temp2.html" > Ah! In which case what you're trying t

Recommended IDE for creating GUI?

2006-04-21 Thread Marty Christion
What are some good free or inexpensive (<$50) IDE's for learning how to program and create GUI's for Python? I'm pretty good with the simple programming aspect of the language, but I'm a little mystified by the world of GUI's, and the options available in python. -- http://mail.python.org/m

Re: how to append to a list twice?

2006-04-21 Thread Edward Elliott
Nick Craig-Wood wrote: > That should be > > series = [x//2 for x in range(200, 1, -1)] > > to be "from __future__ import division" safe from __present__ import gratitude -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda

2006-04-21 Thread Alexis Roda
[EMAIL PROTECTED] escribió: > Hello, > > # the idea is now to give the definition of the multiplication of > functions and integers > # (f * c)(xx) := f(x)*c > [lambda xx: f(xx)*y for y in range(1,5)][0](1) > # returns 4 here lambda uses a variable defined outside of the lambda (y). Any change m

Re: python-mysql on Windows -- How to?

2006-04-21 Thread BartlebyScrivener
Oh, good. Do report back. It comes up often, and I've used only mxODBC. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: how to append to a list twice?

2006-04-21 Thread Nick Craig-Wood
Edward Elliott <[EMAIL PROTECTED]> wrote: > John Salerno wrote: > > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > > (where each item is repeated twice after the first one), how might I do > > that most efficiently? > > Why not just this: > > series = [x/2 for x i

Re: PyLint results?

2006-04-21 Thread André Malo
* Michael Yanowitz wrote: >I ran the new pylint and my code and I had a few questions on why those > are warnings or what I can do to fix them: > > 1) W: 0: Too many lines in module (1587) > Why is 1587 considered too many lines? Would there be necessarily be > an >advantage to

Re: Pythonesque interface.

2006-04-21 Thread Gaz
Yeah, probably i'll be ending doing the front end in Flash and the back end in Python. -- http://mail.python.org/mailman/listinfo/python-list

Can my python script return a value to the c program executing it?

2006-04-21 Thread vduber6er
I have a C program that calls my python script by exec_pycode(code); code = "import CheckFasta\nCheckFasta.CheckFasta (\"sampledata.txt\", %d)\n", PyNum); CheckFasta.py is my python script with a def CheckFasta in it that returns a string. Is there a way for my C code to get the return value f

  1   2   3   >