Re: [OT] Perl 6 [was Re: myths about python 3]

2010-01-28 Thread Neil Hodgson
Looks to me like the problem with Perl 6 was that it was too ambitious, wanting to fix all perceived problems with the language. Python 3 is much more limited in scope: at its core its Python with Unicode fixed and old junk removed. Neil -- http://mail.python.org/mailman/listinfo/python-lis

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Ben Finney
Terry Reedy writes: > And complex numbers, and probably some other things, cannot be sorted > even in Python2. Universal sorting is a broken idea, so Python3 leaves > it to you to say what *you* mean. Okay. I guess I'd better figure out what that is, for this code base, before porting it to Pyth

Re: which one is faster?

2010-01-28 Thread alex23
On Jan 29, 4:29 pm, "Stephen.Wu" <54wut...@gmail.com> wrote: > str.find(targetStr) > str.index(targetStr) with exception > str.count(targetStr) > targetStr in str > > which is the fastest way to check whether targetStr is in str? It's generally a lot quicker to investigate this kind of question yo

Re: Perl 6 [was Re: myths about python 3]

2010-01-28 Thread alex23
geremy condra wrote: > Steven D'Aprano wrote: > > Out of curiosity, and completely off-topic, why has Perl 6 gone so badly? > > Too much like Perl. I was going to suggest that it's probably due to the multitude of ways to it could be done :) -- http://mail.python.org/mailman/listinfo/python-li

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Terry Reedy
On 1/28/2010 8:24 PM, Steven D'Aprano wrote: Um, what ordering do you want? The same ordering I'd get in Python 2; that is, determined by the types of the elements. The ordering has not been consistent across minor versions of Python 2: And complex numbers, and probably some other things,

Re: python 3's adoption

2010-01-28 Thread Alf P. Steinbach
* Steve Holden: While I am fully aware that premature optimization, etc., but I cannot resist an appeal to efficiency if it finally kills off this idea that "they took 'cmp()' away" is a bad thing. Passing a cmp= argument to sort provides the interpreter with a function that will be called eac

Re: Wrap a function

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 9:44 PM, Dennis Lee Bieber wrote: > On Thu, 28 Jan 2010 11:24:28 -0800 (PST), Joan Miller > declaimed the following in > gmane.comp.python.general: > > > On 28 ene, 19:16, Josh Holland wrote: > > > On 2010-01-28, Joan Miller wrote: > > > > > > > I've to call to many func

Re: [OT] Perl 6 [was Re: myths about python 3]

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 9:34 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Thu, 28 Jan 2010 21:21:05 -0800, Tim Roberts wrote: > >> Perl 6, on the other hand, is still fantasyware a decade after its >> announcement. It is, for the most part, THE canonical example of the >

Re: [File Input Module]Replacing string in a file

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 21:36:27 -0800, vanam wrote: > Hi all, > > For replacing string in the file, i have used the module File input for > replacing the string in the file. If you're processing a single file, using fileinput is overkill, and slow as well. Here is a quick-and-dirty way of processi

Re: Wrap a function

2010-01-28 Thread Ben Finney
Dennis Lee Bieber writes: > On Thu, 28 Jan 2010 11:24:28 -0800 (PST), Joan Miller: > > On 28 ene, 19:16, Josh Holland wrote: > > > Check the docs on os.system(). > > No. I've a function that uses subprocess to run commands on the same > > shell and so substitute to bash scrips. But a script full

Re: [OT] Perl 6 [was Re: myths about python 3]

2010-01-28 Thread geremy condra
On Fri, Jan 29, 2010 at 12:34 AM, Steven D'Aprano wrote: > On Thu, 28 Jan 2010 21:21:05 -0800, Tim Roberts wrote: > >> Perl 6, on the other hand, is still fantasyware a decade after its >> announcement.  It is, for the most part, THE canonical example of the >> wrong way to conduct a development e

Re: python 3's adoption

2010-01-28 Thread Terry Reedy
On 1/28/2010 6:47 PM, Paul Boddie wrote: On 27 Jan, 13:26, Xah Lee wrote: So, for practical reasons, i think a “key” parameter is fine. But chopping off “cmp” is damaging. When your data structure is complex, its order is not embedded in some “key”. Taking out “cmp” makes it impossible to sort

[File Input Module]Replacing string in a file

2010-01-28 Thread vanam
Hi all, For replacing string in the file, i have used the module File input for replacing the string in the file. For understanding and execution purpose, i have just included Python as a string in the file and want it to be replaced to PYTHON. Below are my queries and code: (Correct me if my un

Re: python 3's adoption

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 21:26:43 -0500, Roy Smith wrote: > In article <03720b25$0$1309$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: > >> In any case, while such a idiom works in code, it plays havoc with the >> interactive interpreter: >> >> >>> while 1: >> ..."pass" >> ... >> 'pass' >

[OT] Perl 6 [was Re: myths about python 3]

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 21:21:05 -0800, Tim Roberts wrote: > Perl 6, on the other hand, is still fantasyware a decade after its > announcement. It is, for the most part, THE canonical example of the > wrong way to conduct a development effort. Out of curiosity, and completely off-topic, why has Perl

Re: python 3's adoption

2010-01-28 Thread alex23
Roy Smith wrote: > I'm inclined to call it a docs bug that these keywords are not in the HTML > index.  Yes? No. The indices don't list the named parameters for any other built- in, so why would they for print()? -- http://mail.python.org/mailman/listinfo/python-list

Re: myths about python 3

2010-01-28 Thread Tim Roberts
John Nagle wrote: > >Arguably, Python 3 has been rejected by the market. Instead, there's >now Python 2.6, Python 2.7, and Python 2.8. Python 3 has turned into >a debacle like Perl 6, now 10 years old. Although I happen to be one of the folks who are reluctant to switch to Python 3, I have to s

Re: For loop searching takes too long!

2010-01-28 Thread Daniel Stutzbach
On Thu, Jan 28, 2010 at 5:52 PM, elsa wrote: >choice = random.choice(range(1,sum([i[0] for i in myList])+1)) > That's the line causing the problem. It's generating all of the numbers between 1 and your sum, then picking one. Try the following instead, which will pick a number between 1

Re: python 3's adoption

2010-01-28 Thread mdj
On Jan 29, 12:21 pm, Steven D'Aprano wrote: > "Comes to their senses"? > > There's nothing you can do with __cmp__ that you can't do better with > rich comparisons, and plenty that rich comparisons can do that __cmp__ is > utterly incapable of dealing with. __cmp__ is crippled since it can only >

Re: python 3's adoption

2010-01-28 Thread Steve Holden
Steven D'Aprano wrote: > On Thu, 28 Jan 2010 17:38:23 -0800, mdj wrote: > >> On Jan 29, 9:47 am, Paul Boddie wrote: >>> On 27 Jan, 13:26, Xah Lee wrote: >>> >>> >>> So, for practical reasons, i think a “key” parameter is fine. But chopping off “cmp” is damaging. When your data structur

Re: For loop searching takes too long!

2010-01-28 Thread Dave Angel
Steve Holden wrote: Dave Angel wrote: elsa wrote: Hi guys, I've got a problem with my program, in that the code just takes too long to run. Here's what I'm doing. If anyone has any tips, they'd be much appreciated! So, say I have a list of lists that looks something like this (I'm usi

Re: python 3's adoption

2010-01-28 Thread Steve Holden
Roy Smith wrote: > In article <03720b25$0$1309$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: > >> In any case, while such a idiom works in code, it plays havoc with the >> interactive interpreter: >> > while 1: >> ..."pass" >> ... >> 'pass' >> 'pass' >> 'pass' >> 'pass' >> 'pass

Re: For loop searching takes too long!

2010-01-28 Thread Steve Holden
Steve Holden wrote: > Dave Angel wrote: >> elsa wrote: >>> Hi guys, >>> >>> I've got a problem with my program, in that the code just takes too >>> long to run. Here's what I'm doing. If anyone has any tips, they'd be >>> much appreciated! >>> >>> So, say I have a list of lists that looks something

Re: myths about python 3

2010-01-28 Thread alex23
Terry Reedy wrote: > This statement was to counter the 'myth' that US was only targeted at > 2.x when the current situation is quite the opposite. Not so much 'myth' as 'outdated information', they were very clear that 2.x was the initial target. > In particular, several people said that the spe

Re: Wrap a function

2010-01-28 Thread alex23
Joan Miller wrote: > Does anybody knows any library to help me to avoid the use of the main > quotes, and brackets? > I would to use anything as: > $ ls /home => run("ls /home") It's not a library, but IPython[1] provides a lot of what you're after: IPython 0.9.1 -- An enhanced Interactive Pytho

Re: python 3's adoption

2010-01-28 Thread Roy Smith
In article , "Alf P. Steinbach" wrote: > * Roy Smith: > > In article , > > Mitchell L Model wrote: > > > >> I use the sep and end keywords all the time. > > > > What are 'sep' and 'end'? I'm looking in > > http://docs.python.org/3.1/genindex-all.html and don't see those mentioned > > at a

Re: myths about python 3

2010-01-28 Thread Steve Holden
Steven D'Aprano wrote: > On Fri, 29 Jan 2010 08:33:58 +1100, Ben Finney wrote: > >> Antoine Pitrou writes: >> >>> Le Thu, 28 Jan 2010 00:19:24 +, Steven D'Aprano a écrit : 4. Python 3 will make you irresistible to women. FALSE - Python 3 coders are no more likely to get a d

Re: python 3's adoption

2010-01-28 Thread Roy Smith
In article <03720b25$0$1309$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > In any case, while such a idiom works in code, it plays havoc with the > interactive interpreter: > > >>> while 1: > ..."pass" > ... > 'pass' > 'pass' > 'pass' > 'pass' > 'pass' It's not particularly useful

Re: python 3's adoption

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 17:38:23 -0800, mdj wrote: > On Jan 29, 9:47 am, Paul Boddie wrote: >> On 27 Jan, 13:26, Xah Lee wrote: >> >> >> >> > So, for practical reasons, i think a “key” parameter is fine. But >> > chopping off “cmp” is damaging. When your data structure is complex, >> > its order is

Re: For loop searching takes too long!

2010-01-28 Thread Steve Holden
Dave Angel wrote: > elsa wrote: >> Hi guys, >> >> I've got a problem with my program, in that the code just takes too >> long to run. Here's what I'm doing. If anyone has any tips, they'd be >> much appreciated! >> >> So, say I have a list of lists that looks something like this (I'm >> using a lis

Re: python 3's adoption

2010-01-28 Thread mdj
On Jan 29, 9:47 am, Paul Boddie wrote: > On 27 Jan, 13:26, Xah Lee wrote: > > > > > So, for practical reasons, i think a “key” parameter is fine. But > > chopping off “cmp” is damaging. When your data structure is complex, > > its order is not embedded in some “key”. Taking out “cmp” makes it > >

Re: Symbols as parameters?

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 17:01:38 +0100, Roald de Vries wrote: > Question out of general interest in the language: If I would want to > generate such functions in a for-loop, what would I have to do? This > doesn't work: > > class Move(object): >def __call__(self, direction): >

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Steven D'Aprano
On Fri, 29 Jan 2010 12:13:50 +1100, Ben Finney wrote: > Paul Rubin writes: > >> Ben Finney writes: >> > So how should I be sorting a list with entries of “unequal types” >> > such that it will work in Python 3? >> >> Um, what ordering do you want? > > The same ordering I'd get in Python 2; tha

Re: myths about python 3

2010-01-28 Thread Steven D'Aprano
On Fri, 29 Jan 2010 08:33:58 +1100, Ben Finney wrote: > Antoine Pitrou writes: > >> Le Thu, 28 Jan 2010 00:19:24 +, Steven D'Aprano a écrit : >> > 4. Python 3 will make you irresistible to women. >> > >> > FALSE - Python 3 coders are no more likely to get a date than any >> > other

Re: For loop searching takes too long!

2010-01-28 Thread Chris Colbert
if you're open to other libraries, this could be done extremely fast in numpy. On my machine summing that whole array takes 75ms. On Thu, Jan 28, 2010 at 8:00 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Thu, 28 Jan 2010 15:52:14 -0800, elsa wrote: > > > Now, what I ne

Re: For loop searching takes too long!

2010-01-28 Thread Dave Angel
elsa wrote: Hi guys, I've got a problem with my program, in that the code just takes too long to run. Here's what I'm doing. If anyone has any tips, they'd be much appreciated! So, say I have a list of lists that looks something like this (I'm using a list of lists, rather than a list of tuples

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Ben Finney
Paul Rubin writes: > Ben Finney writes: > > So how should I be sorting a list with entries of “unequal types” > > such that it will work in Python 3? > > Um, what ordering do you want? The same ordering I'd get in Python 2; that is, determined by the types of the elements. Peter Otten <__pete

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Steven D'Aprano
On Fri, 29 Jan 2010 11:01:21 +1100, Ben Finney wrote: > So how should I be sorting a list with entries of “unequal types” such > that it will work in Python 3? That depends on how you want the items to be sorted. Python 2.x sorted unequal types in some arbitrary but consistent order. If that's a

Re: For loop searching takes too long!

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 15:52:14 -0800, elsa wrote: > Now, what I need to do is randomly choose one myList[i], however the > distribution of my random choice needs to be proportional to the values > of myList[i][0]. So, for this list above, I'd have a much higher chance > of choosing myList[0] than my

Re: myths about python 3

2010-01-28 Thread Gib Bogle
Ethan Furman wrote: Steven D'Aprano wrote: 4. Python 3 will make you irresistible to women. FALSE What?!? Drat!!! Guess I'll have to learn Lisp... ;) ~Ethan~ Learn to say this fast, you'll impress the hell out of them: Chaps with chapped lips lisp. -- http://mail.python.org/mailman

Re: Sorting a list with entries of unequal types

2010-01-28 Thread MRAB
Paul Rubin wrote: Ben Finney writes: So how should I be sorting a list with entries of “unequal types” such that it will work in Python 3? Um, what ordering do you want? Basically you have to write a custom key function (they removed the option of writing a comparison function). Maybe somet

Re: Sorting a list with entries of unequal types

2010-01-28 Thread MRAB
Ben Finney wrote: Howdy all, Python 2.6 tells me that, in Python 3, sorting a list with entries of incompatible types is not allowed: = $ python2.5 -c "foo = [1, True, 'green', 4, -27, 15.3]; foo.sort(); print foo;" [-27, 1, True, 4, 15.301, 'green'] $ python2.6 -c "foo = [1, T

Re: Sleep timer but still responsive?

2010-01-28 Thread Gabriel Genellina
En Thu, 28 Jan 2010 20:34:22 -0300, JohnnyFive escribió: I need help with something that is probably fairly simple, but i'm having a heck of a time getting it work. Basically, I need my program to sleep for a certain amount of time, but I don't want the console to become unresponsive while s

Re: For loop searching takes too long!

2010-01-28 Thread John Posner
On 1/28/2010 6:52 PM, elsa wrote: Hi guys, I've got a problem with my program, in that the code just takes too long to run. Here's what I'm doing. If anyone has any tips, they'd be much appreciated! So, say I have a list of lists that looks something like this (I'm using a list of lists, rather

Re: For loop searching takes too long!

2010-01-28 Thread Peter Otten
elsa wrote: > Hi guys, > > I've got a problem with my program, in that the code just takes too > long to run. Here's what I'm doing. If anyone has any tips, they'd be > much appreciated! > > So, say I have a list of lists that looks something like this (I'm > using a list of lists, rather than a

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Paul Rubin
Ben Finney writes: > So how should I be sorting a list with entries of “unequal types” such > that it will work in Python 3? Um, what ordering do you want? Basically you have to write a custom key function (they removed the option of writing a comparison function). Maybe something like foo

Re: Sorting a list with entries of unequal types

2010-01-28 Thread Peter Otten
Ben Finney wrote: > Python 2.6 tells me that, in Python 3, sorting a list with entries of > incompatible types is not allowed: > $ python2.6 -3 -c "foo = [1, True, 'green', 4, -27, 15.3]; foo.sort(); > print foo;" -c:1: DeprecationWarning: comparing unequal types not > supported in 3.x > [-27, 1,

Re: python 3's adoption

2010-01-28 Thread Paul Rubin
Steven D'Aprano writes: > If you were designing your own language from scratch, so that backwards > compatibility wasn't an issue, why would you make print a statement? As another real estate analogy, my apartment has some problems with its plumbing, plus an ugly spot on the kitchen wall that co

Re: python 3's adoption

2010-01-28 Thread Steven D'Aprano
On Wed, 27 Jan 2010 23:50:55 -0800, Jonathan Gardner wrote: > I agree on "assert". I don't like running a program in test mode and > then running it in production mode with different code. I would rather > test what I am going to actually run. "assert" should be a function, and > support for remov

Re: py2exe deal with python command line inside a program

2010-01-28 Thread Aahz
In article , wrote: > >I need to create a python subprogress, like this: >myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], > env=env, stdin=subprocess.PIPE, > stdout=subprocess.PIPE) You need to change yo

Sorting a list with entries of unequal types

2010-01-28 Thread Ben Finney
Howdy all, Python 2.6 tells me that, in Python 3, sorting a list with entries of incompatible types is not allowed: = $ python2.5 -c "foo = [1, True, 'green', 4, -27, 15.3]; foo.sort(); print foo;" [-27, 1, True, 4, 15.301, 'green'] $ python2.6 -c "foo = [1, True, 'green', 4, -27

Re: python 3's adoption

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 18:37:56 +0100, Alf P. Steinbach wrote: > * Lie Ryan: >> On 01/28/10 20:12, Alf P. Steinbach wrote: >>> >>> import builtins >>> >>> >>> >>> org_print = print >>> >>> builtins.print = 666 >>> >>> >>> >>> print( "trallala" ) >>> Traceback (most recent call last): >>

For loop searching takes too long!

2010-01-28 Thread elsa
Hi guys, I've got a problem with my program, in that the code just takes too long to run. Here's what I'm doing. If anyone has any tips, they'd be much appreciated! So, say I have a list of lists that looks something like this (I'm using a list of lists, rather than a list of tuples, as I need it

Re: myths about python 3

2010-01-28 Thread Mensanator
On Jan 28, 11:35 am, Ethan Furman wrote: > Steven D'Aprano wrote: > > 4. Python 3 will make you irresistible to women. > > >     FALSE > > What?!?  Drat!!!  Guess I'll have to learn Lisp...  ;) Irresisible? Ha! The chicks will think you have a harelip. > > ~Ethan~ -- http://mail.python.org/mai

Re: python 3's adoption

2010-01-28 Thread Paul Boddie
On 27 Jan, 13:26, Xah Lee wrote: > > So, for practical reasons, i think a “key” parameter is fine. But > chopping off “cmp” is damaging. When your data structure is complex, > its order is not embedded in some “key”. Taking out “cmp” makes it > impossible to sort your data structure. What would a

Re: Wrap a function

2010-01-28 Thread Jonathan Gardner
On Jan 28, 2:16 pm, Joan Miller wrote: > > There would be to make a function for each system command to use so it > would be too inefficient, and follow the problem with the quotes. > > The best is make a parser into a compiled language > Yeah, you could do that. Or you can simply rely on /bin/sh

Sleep timer but still responsive?

2010-01-28 Thread JohnnyFive
I need help with something that is probably fairly simple, but i'm having a heck of a time getting it work. Basically, I need my program to sleep for a certain amount of time, but I don't want the console to become unresponsive while sleeping. As soon as the time is up, I want the main program to

Re: python 3's adoption

2010-01-28 Thread Steven D'Aprano
On Thu, 28 Jan 2010 13:20:02 -0500, Terry Reedy wrote: > On 1/28/2010 3:37 AM, Paul Rubin wrote: >> Jonathan Gardner writes: >>> If you're going to have statements, you're going to need the null >>> statement. That's "pass". >> >> Why? Expressions are statements, so you could just say "pass" (in

Re: Wrap a function

2010-01-28 Thread John Posner
On 1/28/2010 3:45 PM, Joan Miller wrote: On 28 ene, 20:34, Joan Miller wrote: On 28 ene, 20:20, Peter wrote: On Jan 29, 6:58 am, John Posner wrote: On 1/28/2010 2:24 PM, Joan Miller wrote: On 28 ene, 19:16, Josh Hollandwrote: On 2010-01-28, Joan Millerwrote: I've to call t

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 21:40, Jonathan Gardner wrote: > On Jan 28, 10:20 am, Joan Miller wrote: > > > > > I've to call to many functions with the format: > > > >>> run("cmd") > > > were "cmd" is a command with its arguments to pass them to the shell > > and run it, i.e. > > > >>>  run("pwd") > > or > > >>> r

Re: mix statically typed with dynamically typed

2010-01-28 Thread Alf P. Steinbach
* Duncan Booth: "Alf P. Steinbach" wrote: I'm not sure I like your idea of introducing static typing to increase speed, but it could be done without introducing new syntax simply by defining a special meaning to such annotation expressions that are 'type' invocations, say, then like def

Re: get error install MySQLdb on Mac OS X

2010-01-28 Thread Sean DiZazzo
On Jan 28, 12:53 pm, "PS.OHM" wrote: > Hello Guys > > I have get some error when i install MySQLdb on Mac OS X > > after i key command $python setup.py build > > rusult is > : > : > error: command 'gcc-4.0' failed with exit status 1 > > How to config this poblem? Please show a little bit more of

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 1:40 PM, Terry Reedy wrote ... On 1/28/2010 11:03 AM, Mitchell L Model wrote: I have been working with Python 3 for over a year. ... I agree completely. Such sweet words to read! Conversion of old code is greatly facilitied by the 2to3 tool that comes with Pyth

Re: Need help with a program

2010-01-28 Thread Arnaud Delobelle
nn writes: > After posting I was thinking I should have posted a more > straightforward version like the one you wrote. Now there is! It > probably is more efficient too. I just have a tendency to think in > terms of pipes: "pipe this junk in here, then in here, get output". > Probably damage from

Re: mix statically typed with dynamically typed

2010-01-28 Thread Duncan Booth
"Alf P. Steinbach" wrote: > I'm not sure I like your idea of introducing static typing to increase > speed, but it could be done without introducing new syntax simply by > defining a special meaning to such annotation expressions that are > 'type' invocations, say, then like > >def speed( d

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Ben Finney
Big Stu writes: > I'm hoping someone on here can point me to an example of a python > package that is a great example of how to put it all together. I'm > hoping for example code that demonstrates [good adherence to style and > practice conventions] I find the code base for Bazaar to be particu

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 12:00 PM, python-list-requ...@python.org wrote: From: Roy Smith Date: January 28, 2010 11:09:58 AM EST To: python-list@python.org Subject: Re: python 3's adoption In article , Mitchell L Model wrote: I use the sep and end keywords all the time. What are 'sep' and 'en

Re: mix statically typed with dynamically typed

2010-01-28 Thread Alf P. Steinbach
* Yingjie Lan: [snip] def speed(float dist, float time): return dist/time then the compiler would generate code to first check parameter types (or even do some casts if appropriate, say cast an int into float) in the beginning of this function. and the rest of the function would then be com

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Ben Finney
Josh Holland writes: > On 2010-01-28, exar...@twistedmatrix.com wrote: > > Have you actually looked at any of the standard library? > Not recently or in depth, no. I would have thought that it would be of > high quality. I must have been mistaken. Style conventions were introduced relatively la

Re: Wrap a function

2010-01-28 Thread Jonathan Gardner
On Jan 28, 10:20 am, Joan Miller wrote: > I've to call to many functions with the format: > > >>> run("cmd") > > were "cmd" is a command with its arguments to pass them to the shell > and run it, i.e. > > > > >>>  run("pwd") > or > >>> run("ls /home") > > Does anybody knows any library to help me

Re: mix statically typed with dynamically typed

2010-01-28 Thread Steve Holden
Yingjie Lan wrote: > We all know that Python is dynamically typed, and dynamically typed languages > are generally slower than statically typed ones. I wonder if it is possible > at all for Python to mix statically-typed-ness with dynamically-typed-ness to > boost up its speed a little bit, espe

Re: myths about python 3

2010-01-28 Thread Ben Finney
Antoine Pitrou writes: > Le Thu, 28 Jan 2010 00:19:24 +, Steven D'Aprano a écrit : > > 4. Python 3 will make you irresistible to women. > > > > FALSE - Python 3 coders are no more likely to get a date than > > any other programmer. > > They spend less time coding, so they /can/ get m

Re: mix statically typed with dynamically typed

2010-01-28 Thread Diez B. Roggisch
Am 28.01.10 22:12, schrieb Yingjie Lan: We all know that Python is dynamically typed, and dynamically typed languages are generally slower than statically typed ones. I wonder if it is possible at all for Python to mix statically-typed-ness with dynamically-typed-ness to boost up its speed a l

Re: myths about python 3

2010-01-28 Thread Ethan Furman
Steven D'Aprano wrote: 4. Python 3 will make you irresistible to women. FALSE What?!? Drat!!! Guess I'll have to learn Lisp... ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with a program

2010-01-28 Thread nn
Arnaud Delobelle wrote: > nn writes: > > > On Jan 28, 10:50 am, evilweasel wrote: > >> I will make my question a little more clearer. I have close to 60,000 > >> lines of the data similar to the one I posted. There are various > >> numbers next to the sequence (this is basically the number of t

Re: myths about python 3

2010-01-28 Thread Terry Reedy
On 1/28/2010 2:51 PM, Steve Holden wrote: Carl Banks wrote: Regardless of how magnaminous the people of PSF are, the unfortunate reality is that trademark owners are forced by the law to be "particularly petty". PSF's IP lawyer will advise not to allow unsanctioned fork of Python 2.7 to call

mix statically typed with dynamically typed

2010-01-28 Thread Yingjie Lan
We all know that Python is dynamically typed, and dynamically typed languages are generally slower than statically typed ones. I wonder if it is possible at all for Python to mix statically-typed-ness with dynamically-typed-ness to boost up its speed a little bit, especially when speed is needed

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 20:34, Joan Miller wrote: > On 28 ene, 20:20, Peter wrote: > > > On Jan 29, 6:58 am, John Posner wrote: > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > > On 28 ene, 19:16, Josh Holland  wrote: > > > >> On 2010-01-28, Joan Miller  wrote: > > > > >>> I've to call to many functi

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 20:20, Peter wrote: > On Jan 29, 6:58 am, John Posner wrote: > > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > On 28 ene, 19:16, Josh Holland  wrote: > > >> On 2010-01-28, Joan Miller  wrote: > > > >>> I've to call to many functions with the format: > > > >> run("cmd") > >

Re: Why am I getting this Error message

2010-01-28 Thread MRAB
Ray Holt wrote: Why am I getting the following error message. Area has been declared as an attribute of Circle. Thanks, Ray class Circle: def __init__(self): self.radius = 1 def area(self): return self.radius * self.radius * 3.14159 c = Circle() c.radius = 3 print c.area()

Re: Why am I getting this Error message

2010-01-28 Thread Steve Holden
Ray Holt wrote: > Why am I getting the following error message. Area has been declared as > an attribute of Circle. Thanks, Ray > > > class Circle: > def __init__(self): > self.radius = 1 > def area(self): > return self.radius * self.radius * 3.14159 > c = Circle() > c.radius = 3 >

Re: Wrap a function

2010-01-28 Thread Peter
On Jan 29, 6:58 am, John Posner wrote: > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > On 28 ene, 19:16, Josh Holland  wrote: > >> On 2010-01-28, Joan Miller  wrote: > > >>> I've to call to many functions with the format: > > >> run("cmd") > > >> Check the docs on os.system(). > > No. I've a

Re: Wrap a function

2010-01-28 Thread Sean DiZazzo
On Jan 28, 12:13 pm, Joan Miller wrote: > On 28 ene, 19:58, John Posner wrote: > > > > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > > On 28 ene, 19:16, Josh Holland  wrote: > > >> On 2010-01-28, Joan Miller  wrote: > > > >>> I've to call to many functions with the format: > > > >> run("cm

Re: Why am I getting this Error message

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 11:57 AM, Ray Holt wrote: > Why am I getting the following error message. Area has been declared as an > attribute of Circle. Thanks, Ray > > class Circle: >  def __init__(self): > self.radius = 1 >  def area(self): > return self.radius * self.radius * 3.14159 >  

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:58, John Posner wrote: > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > On 28 ene, 19:16, Josh Holland  wrote: > >> On 2010-01-28, Joan Miller  wrote: > > >>> I've to call to many functions with the format: > > >> run("cmd") > > >> Check the docs on os.system(). > > No. I've a fu

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread exarkun
On 07:49 pm, stu.dohe...@gmail.com wrote: Have you actually looked at any of the standard library? Jean-Paul I'm looking at urllib2 right now and it is covering a bunch of the bases I'm looking for. And grepping in the /usr/lib/python2.5/ folder for import statements on various things I'm i

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:54, Steve Holden wrote: > Joan Miller wrote: > > On 28 ene, 19:16, Josh Holland wrote: > >> On 2010-01-28, Joan Miller wrote: > > >>> I've to call to many functions with the format: > >> run("cmd") > >> Check the docs on os.system(). > > No. I've a function that uses subprocess

Re: Wrap a function

2010-01-28 Thread John Posner
On 1/28/2010 2:24 PM, Joan Miller wrote: On 28 ene, 19:16, Josh Holland wrote: On 2010-01-28, Joan Miller wrote: I've to call to many functions with the format: run("cmd") Check the docs on os.system(). No. I've a function that uses subprocess to run commands on the same shell and so s

Re: Need help with a program

2010-01-28 Thread MRAB
Steven Howe wrote: On 01/28/2010 09:49 AM, Jean-Michel Pichavant wrote: evilweasel wrote: I will make my question a little more clearer. I have close to 60,000 lines of the data similar to the one I posted. There are various numbers next to the sequence (this is basically the number of times th

Why am I getting this Error message

2010-01-28 Thread Ray Holt
Why am I getting the following error message. Area has been declared as an attribute of Circle. Thanks, Ray class Circle: def __init__(self): self.radius = 1 def area(self): return self.radius * self.radius * 3.14159 c = Circle() c.radius = 3 print c.area() Traceback (most rece

Re: Wrap a function

2010-01-28 Thread Steve Holden
Joan Miller wrote: > On 28 ene, 19:16, Josh Holland wrote: >> On 2010-01-28, Joan Miller wrote: >> >>> I've to call to many functions with the format: >> run("cmd") >> Check the docs on os.system(). > No. I've a function that uses subprocess to run commands on the same > shell and so substitu

Re: myths about python 3

2010-01-28 Thread Steve Holden
Carl Banks wrote: > On Jan 28, 8:10 am, a...@pythoncraft.com (Aahz) wrote: >> In article , >> Neil Hodgson wrote: >> >>> Carl Banks: There is also no hope someone will fork Python 2.x and continue it in perpetuity. Well, someone might try to fork it, but they won't be able to call

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Big Stu
> Have you actually looked at any of the standard library? > > Jean-Paul I'm looking at urllib2 right now and it is covering a bunch of the bases I'm looking for. And grepping in the /usr/lib/python2.5/ folder for import statements on various things I'm interested in is bringing up some good exa

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Josh Holland
On 2010-01-28, exar...@twistedmatrix.com wrote: > Have you actually looked at any of the standard library? Not recently or in depth, no. I would have thought that it would be of high quality. I must have been mistaken. -- Josh "dutchie" Holland http://www.joshh.co.uk/ http://twitter.com/jshholl

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Joan Miller
On 28 ene, 19:17, Big Stu wrote: > I'm hoping someone on here can point me to an example of a python > package that is a great example of how to put it all together.  I'm > hoping for example code that demonstrates: > > -Strict adherence to PEP 8 > -thorough use of Docstrings > -Conventional direc

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Big Stu
On Jan 28, 2:28 pm, Josh Holland wrote: > On 2010-01-28, Big Stu wrote: > > > I'm hoping someone on here can point me to an example of a python > > package that is a great example of how to put it all together.  I'm > > hoping for example code that demonstrates: > > Surely most of the Standard Li

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread exarkun
On 07:28 pm, j...@joshh.co.uk wrote: On 2010-01-28, Big Stu wrote: I'm hoping someone on here can point me to an example of a python package that is a great example of how to put it all together. I'm hoping for example code that demonstrates: Surely most of the Standard Library should satisf

Re: python 3's adoption

2010-01-28 Thread Fencer
On 2010-01-28 17:03, Mitchell L Model wrote: I have been working with Python 3 for over a year. I used it in writing my book "Bioinformatics Programming Using Python" (http://oreilly.com/catalog/9780596154509). That book sounds very interesting, even though I am more interested in the bioinfor

Re: Great example of a python module/package following up to date conventions.

2010-01-28 Thread Josh Holland
On 2010-01-28, Big Stu wrote: > I'm hoping someone on here can point me to an example of a python > package that is a great example of how to put it all together. I'm > hoping for example code that demonstrates: Surely most of the Standard Library should satisfy all your requirements? -- Josh

Re: Wrap a function

2010-01-28 Thread Joan Miller
On 28 ene, 19:16, Josh Holland wrote: > On 2010-01-28, Joan Miller wrote: > > > I've to call to many functions with the format: > > run("cmd") > > Check the docs on os.system(). No. I've a function that uses subprocess to run commands on the same shell and so substitute to bash scrips. But a

  1   2   >