The del statement

2008-05-07 Thread George Sakkis
One of the few Python constructs that feels less elegant than necessary to me is the del statement. For one thing, it is overloaded to mean three different things: (1) del x: Remove x from the current namespace (2) del x[i]: Equivalent to x.__delitem__(i) (3) del x.a: Equivalent to x.__delattr__('a

Re: The Importance of Terminology's Quality

2008-05-07 Thread J�rgen Exner
George Neuner wrote: >On Wed, 7 May 2008 16:13:36 -0700 (PDT), "[EMAIL PROTECTED]" ><[EMAIL PROTECTED]> wrote: +---+ .:\:\:/:/:. | PLEASE DO NOT |:.:\:\:/:/:.: | FEED THE TROLLS | :=.' - - '.=: |

Re: anagram finder / dict mapping question

2008-05-07 Thread dave
This is what i've came up with. My problem is that I can't get them to properly evaluate.. when comparewords() runs it finds itself... Should I have the keys of mapdict iterate over itself? Is that possible? def annafind(): fin = open('text.txt') # file has one word per li

Re: pickle problem

2008-05-07 Thread castironpi
On May 7, 11:02 pm, [EMAIL PROTECTED] wrote: > I'm wondering if anyone can help with a workaround for a problem I > currently have.  I'm trying to set up a prefork tcp server. > Specifically, I'm setting up a server that forks children and has them > listen on pipes created with os.pipe().  The par

Re: class definition

2008-05-07 Thread Terry Reedy
"Miles" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Wed, May 7, 2008 at 7:40 PM, Yves Dorfsman <[EMAIL PROTECTED]> wrote: | > Does it make a difference if you put subclass object or not ? | Old-style | classes will go away in Python 3 (I think), Have gone ;-) | and all cla

Re: slicing lists

2008-05-07 Thread George Sakkis
On May 7, 11:34 pm, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > So would it be a worthy addition to python, to add it right in the core of > the language, and hopefully in an efficient manner ? Given that it's a straightforward generalization of the existing slicing syntax, it sure does make sense

Re: The Importance of Terminology's Quality

2008-05-07 Thread George Neuner
On Wed, 7 May 2008 16:13:36 -0700 (PDT), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >I'd like to introduce a blog post by Stephen Wolfram, on the design >process of Mathematica. In particular, he touches on the importance of >naming of functions. > >• Ten Thousand Hours of Design Reviews (200

Re: explain this function to me, lambda confusion

2008-05-07 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On May 8, 7:38 am, globalrev <[EMAIL PROTECTED]> wrote: | I would describe a lambda as a parameterised function template. If you | dig, the docs call lambdas anonymous functions not bound to a name. A lambda expression is an abbrevia

pickle problem

2008-05-07 Thread krustymonkey
I'm wondering if anyone can help with a workaround for a problem I currently have. I'm trying to set up a prefork tcp server. Specifically, I'm setting up a server that forks children and has them listen on pipes created with os.pipe(). The parent process for the group starts an inet:tcp server o

Re: slicing lists

2008-05-07 Thread Yves Dorfsman
Miles wrote: On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov > > Is there a way to do: > > x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > x[0,2:6] > > > > That would return: > > [0, 3, 4, 5, 6] Arg... Yes, this is a typo, I meant: [1, 3, 4, 5, 6] I think Yves meant to return [1, 3, 4, 5

Re: web client in Python Q

2008-05-07 Thread Jive Dadson
Thanks, Jerry! That's so cool. I actually managed to blunder through with sockets and so forth, but this is much cleaner. I wonder why it does not work with http://stockcharts.com/webcgi/wb.exe?Data.web+SLW I get a connection reset by peer error. -- http://mail.python.org/mailman/listinfo/p

Re: how to use subprocess.Popen execute "find" in windows

2008-05-07 Thread clyfish
On 5月7日, 下午2时41分, alito <[EMAIL PROTECTED]> wrote: > On May 6, 7:19 pm, [EMAIL PROTECTED] wrote: > > > In cmd, I can use find like this. > > > C:\>netstat -an | find "445" > > TCP0.0.0.0:4450.0.0.0:0 LISTENING > > UDP0.0.0.0:445*:* > > > C:\> > > > A

Re: class definition

2008-05-07 Thread Yves Dorfsman
Miles wrote: In Python 2.2, classes and types were unified. If a class inherits from object (or any other built-in), it is considered a "new-style" class; otherwise, it is an old-style (or classic) class. There are some differences in their behavior; most notably, descriptors (computer propert

Re: how to use subprocess.Popen execute "find" in windows

2008-05-07 Thread clyfish
On 5月7日, 上午9时45分, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > On May 6, 5:19 pm, [EMAIL PROTECTED] wrote: > > > > > In cmd, I can use find like this. > > > C:\>netstat -an | find "445" > > TCP0.0.0.0:4450.0.0.0:0 LISTENING > > UDP0.0.0.0:445*:* > >

Re: The Importance of Terminology's Quality

2008-05-07 Thread Kyle McGivney
> • Module, Block, in Mathematica is in lisp's various “let*”. The > lisp's keywords “let”, is based on the English word “let”. That word > is one of the English word with multitudes of meanings. If you look up > its definition in a dictionary, you'll see that it means many > disparat

DISLIN setup: can not open file map0.dat and all the others

2008-05-07 Thread adolfo
I tried reinstalling the program and the DISLIN/PYTHON SETUP window showed up with the OK button almost covered by the cancel button. The window is too small so I extend the edges but the superimposed cancel button still on top. Using the edge of the OK button I press the arrow there and two windo

Re: slicing lists

2008-05-07 Thread [EMAIL PROTECTED]
On May 7, 6:13 pm, Miles <[EMAIL PROTECTED]> wrote: (snipped) > I think Yves meant to return [1, 3, 4, 5, 6], as in Perl's list slicing: > > my @x = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); > return @x[0, 2..6]; // returns (1, 3, 4, 5, 6) > > This isn't incredibly efficient, but it does what you want

Re: anagram finder / dict mapping question

2008-05-07 Thread Kam-Hung Soh
On Thu, 08 May 2008 11:02:12 +1000, dave <[EMAIL PROTECTED]> wrote: Hi All, I wrote a program that takes a string sequence and finds all the words inside a text file (one word per line) and prints them: def anagfind(letters): #find anagrams of these letters fin = open('text.txt')

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Thu, 08 May 2008 01:15:43 +, Ivan Illarionov wrote: > On Wed, 07 May 2008 21:13:27 -0400, Miles wrote: > >> On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov >> <[EMAIL PROTECTED]> wrote: >> > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: >> > >> > > Is there a way to do: >>

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 21:13:27 -0400, Miles wrote: > On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov > <[EMAIL PROTECTED]> wrote: > > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > > > > > Is there a way to do: > > > x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > > x[0,2:6] > > > >

Re: web client in Python Q

2008-05-07 Thread Jerry Hill
On Wed, May 7, 2008 at 8:22 PM, Jive Dadson <[EMAIL PROTECTED]> wrote: > Hey folks. I know approximately zero about web clients. There's a simple > task I want to do. (I think it's probably simple.) And I figure a Python > script ought to be just the ticket. > > Various web services for daily st

Re: slicing lists

2008-05-07 Thread Miles
On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > > > Is there a way to do: > > x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > x[0,2:6] > > > > That would return: > > [0, 3, 4, 5, 6] > > IMHO this notat

anagram finder / dict mapping question

2008-05-07 Thread dave
Hi All, I wrote a program that takes a string sequence and finds all the words inside a text file (one word per line) and prints them: def anagfind(letters): #find anagrams of these letters fin = open('text.txt') #one word per line file wordbox = [] #this is where

DISLIN 9.3 stuck

2008-05-07 Thread adolfo
On May 7, 2:03 am, Weinhandl Herbert <[EMAIL PROTECTED]> wrote: > adolfo wrote: > > I built the following little program: > > > from numpy import * > > fromdislinimport * > > > def main(): > > x = arange (100, typecode=Float32) > > plot (x, sin (x/5)) > > disfin () > > > main() > > > **

Re: class definition

2008-05-07 Thread Miles
On Wed, May 7, 2008 at 7:40 PM, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > Does it make a difference if you put subclass object or not ? > > What is the difference between c1 and c2 here: > > class c1: > pass > > class c2(object): > pass >>> type(c1) >>> type(c1()) >>> type(c2) >>> type(

Re: explain this function to me, lambda confusion

2008-05-07 Thread andrej . panjkov
On May 8, 10:34 am, [EMAIL PROTECTED] wrote: > > >>> HeightDistrib = (170, 20) > That should be > >>> HeightDistrib = Gaussian(170, 20) -- http://mail.python.org/mailman/listinfo/python-list

Re: unified command line args, environment variables, .conf file settings.

2008-05-07 Thread andrej . panjkov
On May 3, 12:16 pm, smitty1e <[EMAIL PROTECTED]> wrote: > Just a fun exercise to unify some of the major input methods for a > script into a single dictionary. > Here is the output, given a gr.conf file in the same directory with > the contents stated below: > How about extending this to include

Re: saving a webpage's links to the hard disk

2008-05-07 Thread castironpi
On May 7, 8:36 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Jetus wrote: > > On May 4, 7:22 am, [EMAIL PROTECTED] wrote: > >> On May 4, 12:33 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > >> wrote: > > >> > En Sun, 04 May 2008 01:33:45 -0300, Jetus <[EMAIL PROTECTED]> > >> > escribió: > > >>

Re: explain this function to me, lambda confusion

2008-05-07 Thread andrej . panjkov
On May 8, 7:38 am, globalrev <[EMAIL PROTECTED]> wrote: > i have a rough understanding of lambda but so far only have found use > for it once(in tkinter when passing lambda as an argument i could > circumvent some tricky stuff). > what is the point of the following function? > > def addn(n): >

Re: Why don't generators execute until first yield?

2008-05-07 Thread castironpi
On May 7, 4:51 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > Martin Sand Christensen wrote: > > Why don't > > generators follow the usual eager evaluation semantics of Python and > > immediately execute up until right before the first yield instead? > > A great example of why this behavior would

Re: slicing lists

2008-05-07 Thread castironpi
On May 7, 6:58 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Wed, 07 May 2008 23:46:33 +, Ivan Illarionov wrote: > > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > > >> Is there a way to do: > >> x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > >> x[0,2:6] > > >> That would return: > >>

web client in Python Q

2008-05-07 Thread Jive Dadson
Hey folks. I know approximately zero about web clients. There's a simple task I want to do. (I think it's probably simple.) And I figure a Python script ought to be just the ticket. Various web services for daily stock ticker info. For example, http://finance.google.com/finance/historical?q

Re: letter frequency counter / your thoughts..

2008-05-07 Thread castironpi
On May 7, 5:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 7 mai, 23:51, "[EMAIL PROTECTED]"<[EMAIL PROTECTED]> wrote: > > (snip) > > Small improvement thanks to Paul Rubin: > > from collections import defaultdict > from operator import itemgetter > > def get_letters_frequency(source):

Re: howto print binary number

2008-05-07 Thread castironpi
On May 7, 4:03 pm, Joel Bender <[EMAIL PROTECTED]> wrote: > > Python 3.0 has such a formatting operation, but Python 2.x does not.   > > However it's not hard to write. > > Indeed.  Refraining from using named lambdas: > >      >>> def bin(x): >      ...     return ''.join(x & (1 << i) and '1' or '

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 23:46:33 +, Ivan Illarionov wrote: > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > >> Is there a way to do: >> x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >> x[0,2:6] >> >> That would return: >> [0, 3, 4, 5, 6] > > IMHO this notation is confusing. > > What's wrong

Re: comparing dictionaries

2008-05-07 Thread Miki
Hello, > I want to compare two dicts that should have identical info just in a > different data structure. The first dict's contents look like this. It > is authoritative... I know for sure it has the correct key value pairs: > > {'001' : '01'} > > The second dict's contents are like this with a t

Re: The Importance of Terminology's Quality

2008-05-07 Thread Bruce C. Baker
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [...] (for example, Perl's naming heavily relies on unix culture (grep, pipe, hash...), ... "hash" + "pipe"? Ah, /no wonder/ Perl is the syntactic mishmash it is! ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > Is there a way to do: > x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > x[0,2:6] > > That would return: > [0, 3, 4, 5, 6] IMHO this notation is confusing. What's wrong with: [0]+x[2:6] > I am surprised this notation is not supported, it seems

class definition

2008-05-07 Thread Yves Dorfsman
Does it make a difference if you put subclass object or not ? What is the difference between c1 and c2 here: class c1: pass class c2(object): pass Thanks, Yves. http://www.SollerS.ca -- http://mail.python.org/mailman/listinfo/python-list

slicing lists

2008-05-07 Thread Yves Dorfsman
Is there a way to do: x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] x[0,2:6] That would return: [0, 3, 4, 5, 6] I am surprised this notation is not supported, it seems intuitive. A concrete example of the sort of thing I want to do: p = file('/etc/passwd').readlines() q = [ e.strip().split(':')[0,2:] for

The Importance of Terminology's Quality

2008-05-07 Thread [EMAIL PROTECTED]
I'd like to introduce a blog post by Stephen Wolfram, on the design process of Mathematica. In particular, he touches on the importance of naming of functions. • Ten Thousand Hours of Design Reviews (2008 Jan 10) by Stephen Wolfram http://blog.wolfram.com/2008/01/10/ten-thousand-hours-of-design

Re: License selection for free software

2008-05-07 Thread Paul Boddie
On 7 Mai, 19:57, Carl Banks <[EMAIL PROTECTED]> wrote: > > That IBM and other companies are involved with Linux is an example of > companies that are willing to get involved with GPL; it says nothing > about whether those companies would be more, less, or un- willing to > also get involved with mor

Re: License selection for free software

2008-05-07 Thread Paul Boddie
On 7 Mai, 19:48, [EMAIL PROTECTED] (Ville M. Vainio) wrote: > Paul Boddie <[EMAIL PROTECTED]> writes: > > original licence as well. Now, I did leave a fair amount of > > information about the heritage of the code, so that anyone who is > > scared of the LGPL could just go and get the original work,

Re: explain this function to me, lambda confusion

2008-05-07 Thread Gabriel Genellina
En Wed, 07 May 2008 18:38:15 -0300, globalrev <[EMAIL PROTECTED]> escribió: i have a rough understanding of lambda but so far only have found use for it once(in tkinter when passing lambda as an argument i could circumvent some tricky stuff). what is the point of the following function? def a

Re: Idea for P3K

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 23:20, John Roth <[EMAIL PROTECTED]> wrote: > On May 7, 3:03 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > On 7 mai, 21:41, Gary Herron <[EMAIL PROTECTED]> wrote: > > > > Méta-MCI (MVP) wrote: > > > > Hi! > > > > >> I don't often feel like using this word > > > > > Look

Re: explain this function to me, lambda confusion

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 23:38, globalrev <[EMAIL PROTECTED]> wrote: > i have a rough understanding of lambda but so far only have found use > for it once(in tkinter when passing lambda as an argument i could > circumvent some tricky stuff). > what is the point of the following function? > > def addn(n): >

Re: letter frequency counter / your thoughts..

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 23:51, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: (snip) Small improvement thanks to Paul Rubin: from collections import defaultdict from operator import itemgetter def get_letters_frequency(source): letters_count = defaultdict(int) for letter in source: letters_cou

Re: letter frequency counter / your thoughts..

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 23:50, Paul Rubin wrote: (snip) > Someone else suggested the heapq module, which is a good approach > though it might be considered a little bit high-tech. If you > want to use sorting (conceptually simpler), you could use the > sorted function instead of the i

Re: Am I missing something with Python not having interfaces?

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 21:19, Daniel Marcel Eichler <[EMAIL PROTECTED]> wrote: > Am Dienstag 06 Mai 2008 16:07:01 schrieb Mike Driscoll: > > > If so, then it looks like an Interface is a generic class with method > > stubs. You can do that with Python just as easily by creating empty > > methods with just the "

Re: letter frequency counter / your thoughts..

2008-05-07 Thread John Machin
On May 8, 6:00 am, [EMAIL PROTECTED] wrote: > That's a great suggestion Arnaud. I'll keep that in mind next time I > post code. Thanks ;) > It's a suggestion for YOUR benefit, not ours. Consider keeping it in mind next time you WRITE code, whether you intend publishing it or not. -- http://mail.

Re: letter frequency counter / your thoughts..

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 18:39, [EMAIL PROTECTED] wrote: > Hello, > > Here is my code for a letter frequency counter. It seems bloated to > me and any suggestions of what would be a better way (keep in my mind > I'm a beginner) would be greatly appreciated.. > > def valsort(x): > res = [] > for k

Re: letter frequency counter / your thoughts..

2008-05-07 Thread Paul Rubin
[EMAIL PROTECTED] writes: > def valsort(x): > res = [] > for key, value in x.items(): > res.append((value, key)) > return res Note: all code below is untested and may have errors ;-) I think the above is misnamed because it doesn't actually sort. Anyway, you could

Re: Why don't generators execute until first yield?

2008-05-07 Thread Michael Torrie
Martin Sand Christensen wrote: > Why don't > generators follow the usual eager evaluation semantics of Python and > immediately execute up until right before the first yield instead? A great example of why this behavior would defeat some of the purpose of generators can be found in this amazing PD

Re: explain this function to me, lambda confusion

2008-05-07 Thread globalrev
On 7 Maj, 23:47, globalrev <[EMAIL PROTECTED]> wrote: > and what si the diffrence here: > > g = lambda x=5:x*x > g = lambda x:x*x > > the first was a mistake to write but it worked > and the x=5 seems to be completely ignored. why? it has no effect at > all? ah wait now i see it has a default kind

Re: explain this function to me, lambda confusion

2008-05-07 Thread globalrev
and what si the diffrence here: g = lambda x=5:x*x g = lambda x:x*x the first was a mistake to write but it worked and the x=5 seems to be completely ignored. why? it has no effect at all? -- http://mail.python.org/mailman/listinfo/python-list

Re: howto print binary number

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 13:13:40 -0700, dmitrey wrote: > hi all, > could you inform how to print binary number? I.e. something like > > print '%b' % my_number > > it would be nice would it print exactly 8 binary digits (0-1, with > possible start from 0) > > Thank you in advance, D Here it is: de

explain this function to me, lambda confusion

2008-05-07 Thread globalrev
i have a rough understanding of lambda but so far only have found use for it once(in tkinter when passing lambda as an argument i could circumvent some tricky stuff). what is the point of the following function? def addn(n): return lambda x,inc=n: x+inc if i do addn(5) it returns

Re: howto print binary number

2008-05-07 Thread Joel Bender
Python 3.0 has such a formatting operation, but Python 2.x does not. However it's not hard to write. Indeed. Refraining from using named lambdas: >>> def bin(x): ... return ''.join(x & (1 << i) and '1' or '0' for i in ... range(7,-1,-1)) ... >>> bin(12) '00

Re: subprocess wait() waits forever, but os.system returns

2008-05-07 Thread Christian Heimes
grayaii schrieb: > Awesome! That worked! > And your comment just led me down another exploration path on why the > following doesn't work: > - > while(returncode is None): > returncode = run.poll() > time.sleep(1) > > out = run.stdout.readlines() > err = run.stderr.

Re: letter frequency counter / your thoughts..

2008-05-07 Thread Paul Hankin
On May 7, 5:39 pm, [EMAIL PROTECTED] wrote: > Here is my code for a letter frequency counter.  It seems bloated to > me and any suggestions of what would be a better way (keep in my mind > I'm a beginner) would be greatly appreciated.. Yours is a little more efficient than this, but here's a compa

Re: Idea for P3K

2008-05-07 Thread John Roth
On May 7, 3:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 7 mai, 21:41, Gary Herron <[EMAIL PROTECTED]> wrote: > > > Méta-MCI (MVP) wrote: > > > Hi! > > > >> I don't often feel like using this word > > > > Look at languages like OCAML or F # > > > > @-salutations > > > Well of course,

Re: python vs. grep

2008-05-07 Thread Anton Slesarev
On May 7, 7:22 pm, Pop User <[EMAIL PROTECTED]> wrote: > Anton Slesarev wrote: > > > But I have some problem with writing performance grep analog. > > I don't think you can ever catch grep. Searching is its only purpose in > life and its very good at it. You may be able to come closer, this > thr

Re: subprocess wait() waits forever, but os.system returns

2008-05-07 Thread grayaii
Awesome! That worked! And your comment just led me down another exploration path on why the following doesn't work: - while(returncode is None): returncode = run.poll() time.sleep(1) out = run.stdout.readlines() err = run.stderr.readlines() -

Re: Idea for P3K

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 21:41, Gary Herron <[EMAIL PROTECTED]> wrote: > Méta-MCI (MVP) wrote: > > Hi! > > >> I don't often feel like using this word > > > Look at languages like OCAML or F # > > > @-salutations > > Well of course, we're all well aware of other languages that allow > variables to be bound in the

Re: Looking for Fredrik Lundh; documentation and code examples for elementtree

2008-05-07 Thread Guilherme Polo
2008/5/7 dj <[EMAIL PROTECTED]>: > Hello All, > > I am trying to get in touch with Mr. Lundh. I am looking for exmaple > code regarding the use of elementtree. I have read through most of the > examples on http://effbot.org and I am hoping he can suggest some > others. Additionally, I am hoping he

Re: Looking for Fredrik Lundh; documentation and code examples for elementtree

2008-05-07 Thread adolfo
On May 7, 4:43 pm, dj <[EMAIL PROTECTED]> wrote: > Hello All, > > I am trying to get in touch with Mr. Lundh. I am looking for exmaple > code regarding the use of elementtree. I have read through most of the > examples onhttp://effbot.organd I am hoping he can suggest some > others. Additionally, I

Re: Idea for P3K

2008-05-07 Thread Daniel Fetchinson
> > I don't often feel like using this word > > Look at languages like OCAML or F # > I looked at OCAML and F#. Now what? Cheers, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess wait() waits forever, but os.system returns

2008-05-07 Thread Christian Heimes
grayaii schrieb: > There are so many threads on this subject, but I ran across a > situation on Windows that I can't figure out. > > I'm trying to run this little command-line exe and when I launch like > this, it hangs: > import subprocess command = r'c:\mydir\foo.exe' run = subpr

Re: Looking for Fredrik Lundh; documentation and code examples for elementtree

2008-05-07 Thread dj
Hello All, I am trying to get in touch with Mr. Lundh. I am looking for exmaple code regarding the use of elementtree. I have read through most of the examples on http://effbot.org and I am hoping he can suggest some others. Additionally, I am hoping he can give me an example use of the comment me

Re: howto print binary number

2008-05-07 Thread castironpi
On May 7, 3:31 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On May 7, 3:13 pm, dmitrey <[EMAIL PROTECTED]> wrote: > > > hi all, > > could you inform how to print binary number? > > I.e. something like > > > print '%b' % my_number > > > it would be nice would it print exactly 8 binary digits (0-1, wi

Re: howto print binary number

2008-05-07 Thread Gary Herron
dmitrey wrote: hi all, could you inform how to print binary number? I.e. something like print '%b' % my_number it would be nice would it print exactly 8 binary digits (0-1, with possible start from 0) Thank you in advance, D -- http://mail.python.org/mailman/listinfo/python-list Python 3.0

Re: Am I missing something with Python not having interfaces?

2008-05-07 Thread Luis Zarrabeitia
On Wednesday 07 May 2008 03:19:30 pm Daniel Marcel Eichler wrote: > Am Dienstag 06 Mai 2008 16:07:01 schrieb Mike Driscoll: > > Well, no. It's a litte different. Interfaces force to implement methods. > Simple inheritance with method-stubs can't garantee that a specific > method is reimplementat in

Re: howto print binary number

2008-05-07 Thread Mensanator
On May 7, 3:13 pm, dmitrey <[EMAIL PROTECTED]> wrote: > hi all, > could you inform how to print binary number? > I.e. something like > > print '%b' % my_number > > it would be nice would it print exactly 8 binary digits (0-1, with > possible start from 0) > > Thank you in advance, D The gmpy works

subprocess wait() waits forever, but os.system returns

2008-05-07 Thread grayaii
There are so many threads on this subject, but I ran across a situation on Windows that I can't figure out. I'm trying to run this little command-line exe and when I launch like this, it hangs: >>> import subprocess >>> command = r'c:\mydir\foo.exe' >>> run = subprocess.Popen(command, shell=True,

howto print binary number

2008-05-07 Thread dmitrey
hi all, could you inform how to print binary number? I.e. something like print '%b' % my_number it would be nice would it print exactly 8 binary digits (0-1, with possible start from 0) Thank you in advance, D -- http://mail.python.org/mailman/listinfo/python-list

Re: Idea for P3K

2008-05-07 Thread Arnaud Delobelle
"Méta-MCI (MVP)" <[EMAIL PROTECTED]> writes: > Hi! > >> I don't often feel like using this word > > Look at languages like OCAML or F # While I like Objective Caml, it is definitively not Python! -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: letter frequency counter / your thoughts..

2008-05-07 Thread umpsumps
That's a great suggestion Arnaud. I'll keep that in mind next time I post code. Thanks ;) On May 7, 12:27 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > Hello, > > > Here is my code for a letter frequency counter. It seems bloated to > > me and any suggestions o

REMINDER: Python Sprint Weekend This Weekend!

2008-05-07 Thread Trent Nelson
Just a friendly reminder that this weekend is the Python sprint weekend! Look forward to seeing everyone on #python-dev irc.freenode.net over the course of the weekend! Trent. On 16 Apr, 18:52, Trent Nelson wrote: > >Following on from the success of previous sprint/bugfix weekends

[Fwd: Re: Am I missing something with Python not having interfaces?]

2008-05-07 Thread J. Cliff Dyer
-- Oook, J. Cliff Dyer Carolina Digital Library and Archives UNC Chapel Hill --- Begin Message --- On Wed, 2008-05-07 at 21:19 +0200, Daniel Marcel Eichler wrote: > Am Dienstag 06 Mai 2008 16:07:01 schrieb Mike Driscoll: > > > If so, then it looks like an Interface is a generic class with method

Re: Idea for P3K

2008-05-07 Thread Gary Herron
Méta-MCI (MVP) wrote: Hi! I don't often feel like using this word Look at languages like OCAML or F # @-salutations Well of course, we're all well aware of other languages that allow variables to be bound in the middle of an expression. It's just that Python was purposely created without

Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 16:17, pistacchio <[EMAIL PROTECTED]> wrote: > George Sakkis ha scritto: (snip) > > What does it matter if it's a single file or a dozen under a package ? > > "Installation" for pure Python packages can be as simple as copying > > the package under any directory in your PYTHONPATH. > > we

Re: Am I missing something with Python not having interfaces?

2008-05-07 Thread Daniel Marcel Eichler
Am Dienstag 06 Mai 2008 16:07:01 schrieb Mike Driscoll: > If so, then it looks like an Interface is a generic class with method > stubs. You can do that with Python just as easily by creating empty > methods with just the "pass" keyword. Well, no. It's a litte different. Interfaces force to impl

Re: Learning question...

2008-05-07 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Any idea why the following program does not work? I was learning IO on | Python and the following generates a TypeError: range() integer end | argument expected, got str. | I am a beginner. | | | # prin

Re: Idea for P3K

2008-05-07 Thread M�ta-MCI (MVP)
Hi! I don't often feel like using this word Look at languages like OCAML or F # @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I missing something with Python not having interfaces?

2008-05-07 Thread [EMAIL PROTECTED]
On 7 mai, 18:05, Bjoern Schliessmann wrote: > jmDesktop wrote: > > Studying OOP and noticed that Python does not have Interfaces. > > By "OOP", you mean "Java", right? 8) > > > Is that correct? Is my schooling for nought on these OOP concepts > > if I use Python. Am I losing something if I don't

Re: PHP + TinyButStrong Python replacement

2008-05-07 Thread Terry Reedy
"pistacchio" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | well, it doesn't matter if it's a single file or a package, but it | _does_ matter if you have to put them under the path where python is | installed because, in a typical shared web hosting environment (such the | one th

Re: letter frequency counter / your thoughts..

2008-05-07 Thread castironpi
On May 7, 1:31 pm, "Ian Kelly" <[EMAIL PROTECTED]> wrote: > On Wed, May 7, 2008 at 11:30 AM, Paul Melis <[EMAIL PROTECTED]> wrote: > >     dic = {} > >     for letter in strng: > >         if letter not in dic: > >             dic[letter] = 0 > >         dic[letter] += 1 > > As a further refinement

Re: Bad form to access a *private variable* like _foo?

2008-05-07 Thread [EMAIL PROTECTED]
On May 6, 3:27 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > There are other ways. For example, > > sqlobject.sqlhub.threadingLocal.connection > > if your system is using multiple threads correctly. Generally speaking, > sqlhub could/should be used. That's actually quite involved. You must

Re: Generate labels for a multi-level outline (THANK-YOU!)

2008-05-07 Thread python
Castironpi and Dennis, WOW! Thank you very much for your examples!!! I wasn't trolling for free development, just whether such a library existed and/or design ideas (basic object or generator). I had started to develop my own solution which was much more complicated (re: ugly) than your 2 very e

Re: letter frequency counter / your thoughts..

2008-05-07 Thread Ian Kelly
On Wed, May 7, 2008 at 11:30 AM, Paul Melis <[EMAIL PROTECTED]> wrote: > dic = {} > for letter in strng: > if letter not in dic: > dic[letter] = 0 > dic[letter] += 1 As a further refinement, you could use the defaultdict class from the collections module: di

Re: letter frequency counter / your thoughts..

2008-05-07 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > Hello, > > Here is my code for a letter frequency counter. It seems bloated to > me and any suggestions of what would be a better way (keep in my mind > I'm a beginner) would be greatly appreciated.. > > def valsort(x): > res = [] > for key, value in x.item

Re: Idea for P3K

2008-05-07 Thread Arnaud Delobelle
"Méta-MCI (MVP)" <[EMAIL PROTECTED]> writes: > Hi! > > print become a function ; OK > > I thought: and why the affection (=) would not become, also, a function? > Examples: >a = 123return 123 >b,c = 543.21, "LOL"return (543.21, "LOL") Do you m

Re: comparing dictionaries

2008-05-07 Thread Arnaud Delobelle
brad <[EMAIL PROTECTED]> writes: > I want to compare two dicts that should have identical info just in a > different data structure. The first dict's contents look like this. It > is authoritative... I know for sure it has the correct key value > pairs: > > {'001' : '01'} -> refdict > > The seco

Re: Generate labels for a multi-level outline

2008-05-07 Thread castironpi
On May 7, 9:07 am, [EMAIL PROTECTED] wrote: > ''' > On May 6, 4:43 pm, [EMAIL PROTECTED] honoring: > > >>> a.next( ) > ( "I", ) > >>> a.throw( up ) > ( "I", "A" ) > >>> a.next( ) > ( "I", "B" ) > >>> a.next( ) > ( "I", "C" ) > >>> a.throw( down ) > > ( "II", ) > ''' > > #funny declaration > class u

Re: letter frequency counter / your thoughts..

2008-05-07 Thread castironpi
On May 7, 12:30 pm, Paul Melis <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Here is my code for a letter frequency counter.  It seems bloated to > > me and any suggestions of what would be a better way (keep in my mind > > I'm a beginner) would be greatly appreciated.. > > Not bad for

Re: License selection for free software

2008-05-07 Thread Carl Banks
On May 7, 6:56 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 6 Mai, 19:22, [EMAIL PROTECTED] (Ville M. Vainio) wrote: > > I don't think BSD/MIT like license really annoys anyone. Think python > > here ;-) > > As some have pointed out, it can discourage people from contributing. > I've said many t

Re: License selection for free software

2008-05-07 Thread Ville M. Vainio
Paul Boddie <[EMAIL PROTECTED]> writes: > original licence as well. Now, I did leave a fair amount of > information about the heritage of the code, so that anyone who is > scared of the LGPL could just go and get the original work, but that I doubt anyone is really afraid of LGPL. The only probl

Re: letter frequency counter / your thoughts..

2008-05-07 Thread Paul Melis
[EMAIL PROTECTED] wrote: Here is my code for a letter frequency counter. It seems bloated to me and any suggestions of what would be a better way (keep in my mind I'm a beginner) would be greatly appreciated.. Not bad for a beginner I think :) def valsort(x): res = [] for key

Re: License selection for free software

2008-05-07 Thread Carl Banks
On May 7, 3:51 am, Paul Rubin wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > Nonsense. They could be more than willing to contribute their > > patches, but aren't willing to accept the GPL's limitation to being > > used only in open source packages. > > Oh, I see wh

letter frequency counter / your thoughts..

2008-05-07 Thread umpsumps
Hello, Here is my code for a letter frequency counter. It seems bloated to me and any suggestions of what would be a better way (keep in my mind I'm a beginner) would be greatly appreciated.. def valsort(x): res = [] for key, value in x.items(): res.append((value,

  1   2   >