Re: Getting rid of "self."

2005-01-09 Thread Tim Roberts
BJörn Lindqvist <[EMAIL PROTECTED]> wrote: >I think it would be cool if you could refer to instance variables >without prefixing with "self." I know noone else thinks like me so >Python will never be changed, but maybe you can already do it with >Python today? > >.import sys >. >.def magic(): >.

Re: pyparsing: how to negate a grammar

2005-01-09 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I want to define a rule for a line that does NOT start with a given > Literal. How do I do that? I try the following and my program just hang > there: > > BodyLine = ~Literal("HTTP/1.1") + restOfLine > > Thanks, > Khoa > Khoa -

Re: The best way to do web apps with Python?

2005-01-09 Thread Ian Bicking
Steve Holden wrote: More ways than you can shake a stick at, but nowadays you should consider using WSGI if you want your code to be portable across many frameworks. The Web SIG worked very hard last year on defining this gateway interface, with the intention that it should become widely availa

Re: python3: 'where' keyword

2005-01-09 Thread Carlos Ribeiro
On Sun, 09 Jan 2005 15:54:08 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Here's another nice one if 'where' is added to compound statements as well: > > @dbc(pre, post) > def foo(): >pass > where: >def pre(): > pass >def post(): > pass Interesting. It solves some of the

Re: complex numbers

2005-01-09 Thread Jürgen Exner
[EMAIL PROTECTED] wrote: > #python supports complex numbers. [...] So? > # Perl doesn't support complex numbers. But there are packages that > supports it. The Math::Complex module is part of the standard installation already, no need for any "packages" (whatever that might be). Did you check "

Re: The best way to do web apps with Python?

2005-01-09 Thread Carlos Ribeiro
On Sat, 8 Jan 2005 21:11:49 +0800, worzel <[EMAIL PROTECTED]> wrote: > > What is the best way to web developemnt with Python? Is there anything close > to PHP style in-page script placement that can create and use other Python > objects? I am not really interested in Zope (I believe that is more

Re: unicode support

2005-01-09 Thread Jürgen Exner
[EMAIL PROTECTED] wrote: > # -*- coding: utf-8 -*- > # python supports unicode in source code by putting a coding > declaration > # as the first line. So? > In perl, support of unicode is very flaky. The language does not > support it, but packages that changes behaviors of string handling (in >

Re: curses is not imported under Linux (and Python 2.4)

2005-01-09 Thread Konrad Koller
Thanks for your hint. >What Linux distro? SuSE 9.1 >Is the Python version you're running one you compiled, one that shipped >with the distro, or a 3rd party RPM? compiled with Python-2.4.tar.bz2 > >At a guess, I'd say you compiled it yourself and you don't have the >ncurses development packages (pr

Re: The best way to do web apps with Python?

2005-01-09 Thread Jon Perez
worzel wrote: What is the best way to web developemnt with Python? Is there anything close to PHP style in-page script placement that can create and use other Python objects? Spyce ( http://spyce.sf.net ) is what you're looking for. I was looking exactly for the same thing as you are - a PHP w

Re: The best way to do web apps with Python?

2005-01-09 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > You can read about it in Philip Eby's excellent PEP at > >http://www.python.org/peps/pep-0333.html I looked at this and I have the impression that it tries to do something worthwhile, but I can't tell precisely what. The "rationale and goals" sectio

Re: Display Function Code Body?

2005-01-09 Thread Fernando Perez
Haibao Tang wrote: > > Hail Python pals! I played with the R (http://r-project.cran.org) last > night to do some statistics and it has an interactive session too, and > I found a feature that is quite useful. [...] > # or any shallow function code from a file import calendar; disp(calendar

Re: Pre/Postconditions with decorators

2005-01-09 Thread Stephen Thorne
On 08 Jan 2005 15:50:48 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Stephen Thorne <[EMAIL PROTECTED]> writes: > > Unresolved Problems: > > 1) How do you handle duck types, i.e. a method that accepts StringIO, > > cStringIO or any other object that has a .readlines(), .seek() and >

Re: python3: accessing the result of 'if'

2005-01-09 Thread Andrey Tatarinov
Carl Banks wrote: As a compromise, howabout: . if m > 20 where m=something(): . do_something_with(m) That's good, but first idea was about 'where' block that contains any expressions, that we need, for example function definition. the syntax you proposed has same problems as 'lambda'. The ma

Re: Pre/Postconditions with decorators

2005-01-09 Thread Paul Rubin
Stephen Thorne <[EMAIL PROTECTED]> writes: > > It should be left on. Leaving it in for development and turning it > > off for production is like wearing a parachute during ground training > > and taking it off once you're in the air. > So we can't use this for a case where we have an extremely lar

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Peter Hansen wrote: >>> print words[3], words[5] where: >>> words = input.split() - defining variables in "where" block would restrict their visibility to one expression Then your example above doesn't work... print takes a sequence of expressions, not a tuple as you seem to think. sorry, I

Re: python3: 'where' keyword

2005-01-09 Thread Alex Martelli
AdSR <[EMAIL PROTECTED]> wrote: > I don't know haskell, but it looks SQL-ish to me (only by loose Indeed, the fact that many MANY more people are familiar with SQL than with Haskell may be the strongest practical objection to this choice of syntax sugar; the WHERE clause in an SQL SELECT has suc

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Paul Rubin wrote: You mean I can't say # compute sqrt(2) + sqrt(3) x = (sqrt(a) where: a = 2.) \ + sqrt (a) where: a = 3. No, I'd prefer to not embed 'where' into expression. -- http://mail.python.org/mailman/listinfo/python-list

Re: time module precision

2005-01-09 Thread janeaustine50
Tim Peters wrote: [snip] > Python's time.sleep() calls the Win32 API Sleep() function on Windows. > All behavior is inherited from the latter. See MS's docs: > > Oh, after a short research, I found that tim

Re: python3: 'where' keyword

2005-01-09 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes: > Trying to push it a level further (down to expressions) would, IMO, be > a lot of effort for something which would hurt readability a lot. I think we should just try to do things in a simple and general way and not try to enforce readability. For example

Re: Ranting about the state of Python IDEs for Windows

2005-01-09 Thread Jussi Jumppanen
Carlos Ribeiro wrote: > Oh well. A mailing list is not the most appropriate place for > rants (a blog is better), but it's still better than keeping > it for myself. > > I'm frustrated. My search for a good IDE to support my activities Take a look at Zeus: http://www.zeusedit.com/lookma

Re: python3: 'where' keyword

2005-01-09 Thread Nick Coghlan
Alex Martelli wrote: I wonder if 'with', which GvR is already on record as wanting to introduce in 3.0, might not be overloaded instead. Perhaps we could steal 'using' from the rejected decorator syntax. x = [f(x) for x in seq] using: def f(x): return x * x Cheers, Nick. -- Nick Coghlan |

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Nick Coghlan wrote: Current: assignment_stmt ::= (target_list "=")+ expression_list augmented_assignment_stmt ::=target augop expression_list New: assignment_stmt ::= (target_list "=")+ expression_list [where_clause] augmented_assignment_stmt ::=target augop expression_list [where_

Re: Getting rid of "self."

2005-01-09 Thread Alex Martelli
BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > I think it would be cool if you could refer to instance variables > without prefixing with "self." I know noone else thinks like me so Some do -- Kent Beck's excellent book on TDD-by-example has a specific grouse against that in the chapter where he de

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Nick Coghlan wrote: sorry, I used "expression" carelessly. I mean that >>> print words[3], words[5] is a single expression (and that would be in Python 3, when print would be subtituted with write()/writeln()). 'statement' is the appropriate word in Python's grammar. thanks ) And I don't think we

Re: python3: 'where' keyword

2005-01-09 Thread Alex Martelli
Nick Coghlan <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > I wonder if 'with', which GvR is already on record as wanting to > > introduce in 3.0, might not be overloaded instead. > > Perhaps we could steal 'using' from the rejected decorator syntax. > > x = [f(x) for x in seq] using: >

Re: Old Paranoia Game in Python

2005-01-09 Thread Paul Rubin
Oh cool, I sort of remember that game from back in the day. I didn't play it very much so never got very far in it. I'll have to try your version. -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-09 Thread Nick Coghlan
Andrey Tatarinov wrote: sorry, I used "expression" carelessly. I mean that >>> print words[3], words[5] is a single expression (and that would be in Python 3, when print would be subtituted with write()/writeln()). 'statement' is the appropriate word in Python's grammar. And I don't think we'd ac

Re: Pre/Postconditions with decorators

2005-01-09 Thread rittersporn
Thank you very much for reminding me. I have been sloppy. It should have said static type checking. ciao Skip Montanaro wrote: > >> Eiffel (language) has both type checking and design by contract. > >> Python lacks both. > > Actually, Python is strongly typed. It's just dynamically instead o

Re: python3: 'where' keyword

2005-01-09 Thread Nick Coghlan
Paul Rubin wrote: Nick Coghlan <[EMAIL PROTECTED]> writes: Trying to push it a level further (down to expressions) would, IMO, be a lot of effort for something which would hurt readability a lot. I think we should just try to do things in a simple and general way and not try to enforce readability

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Paul Rubin wrote: What would be the advantage of that over this? . x = sqrt(a) + sqrt(b) where: . a = 2.0 . b = 3.0 The idea of "where" is to allow re-using variable names instead of having to keep track of which ones are in use. I just tried to give a very simple example of how you might

Statement local namespaces summary (was Re: python3: 'where' keyword)

2005-01-09 Thread Nick Coghlan
Andrey Tatarinov wrote: So it seems that people loved the idea of 'where' keyword, may be it's time to think about PEP draft? I appreciate any help (cause my english is not that good =)). There's certainly a PEP in the idea. Here's a summary of what we have so far in this thread in a PEPish form

static compiled python modules

2005-01-09 Thread Thomas Linden
Hi, I made a static version of my python modules (2.4), all modules were build statically. The modules were linked into libpython2.4.a which has ~ 8 MB then. The build process then links the python binary against the libpython2.4.a, the resulting binary has ~ 5 MB afterwards (?). The problem is,

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
Alex Martelli wrote: Indeed, the fact that many MANY more people are familiar with SQL than with Haskell may be the strongest practical objection to this choice of syntax sugar; the WHERE clause in an SQL SELECT has such wildly different semantics from Haskell's "where" that it might engender huge

Re: Getting rid of "self."

2005-01-09 Thread John Roth
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] BJörn Lindqvist <[EMAIL PROTECTED]> wrote: I think it would be cool if you could refer to instance variables without prefixing with "self." I know noone else thinks like me so Some do -- Kent Beck's excellent book on TDD-b

Pygame and pyopengl with py2exe ?

2005-01-09 Thread Nyx42
Hi, I have 2 programs which run without problems, but after building them with py2exe, they don't work (program opens the window and closed it immediately) First program (uses only pygame): screen = pygame.display.set_mode((W_WIDTH_F, W_HEIGHT)) This line refuses to be compiled correctly. Why ?

Re: python3: 'where' keyword

2005-01-09 Thread Andrey Tatarinov
And about examples for usage "where" keyword reading http://manatee.mojam.com/~skip/python/fastpython.html I understand that almost every example should use that keyword =) -- http://mail.python.org/mailman/listinfo/python-list

Re: Pygame and pyopengl with py2exe ?

2005-01-09 Thread Andrey Tatarinov
Nyx42 wrote: Second program (pygame + pyopenGL): Py2exe can't import OpenGL.GL and OpenGL.GLU :( about that, may be names of imports are generated in runtime, so you can try to specify them directly options = {"py2exe": {"packages": ["OpenGL.GL","OpenGL.GLU"]}}, -- http://mail.python.org/mailman/

Re: Python application extending, plugins

2005-01-09 Thread Kartic
John, To achieve this, your application must define an API that third party coders can use to extend your application. How you define your API is upto you; there are no general "guidelines", AFAIK. But if you want seamless extensibility, it entirely depends on how elegantly you design the API for

Python3: on removing map, reduce, filter

2005-01-09 Thread Andrey Tatarinov
Hi. How does GvR suggestions on removing map(), reduce(), filter() correlate with the following that he wrote himself (afaik): http://www.python.org/doc/essays/list2str.html ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Paul Rubin
Andrey Tatarinov <[EMAIL PROTECTED]> writes: > How does GvR suggestions on removing map(), reduce(), filter() > correlate with the following that he wrote himself (afaik): > > http://www.python.org/doc/essays/list2str.html I think that article was written before list comprehensions were added to

Re: pyparsing: how to negate a grammar

2005-01-09 Thread knguyen
Hi Paul, I am trying to extract HTTP response codes from a HTTP page send from a web server. Below is my test program. The program just hangs. Thanks, Khoa ## #!/usr/bin/python from pyparsing import ParseException, Dict, CharsNotIn, Group,Lite

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Andrey Tatarinov
Paul Rubin wrote: How does GvR suggestions on removing map(), reduce(), filter() correlate with the following that he wrote himself (afaik): http://www.python.org/doc/essays/list2str.html I think that article was written before list comprehensions were added to Python. anyway list comprehensions ar

Re: Recent infoworld column

2005-01-09 Thread Michael Hoffman
Carlos Ribeiro wrote: """ When people talk about the heroes of open source, you tend to hear such familiar names as Linus Torvalds, Larry Wall, Brendan Eich, Guido van Rossum, Monty Widenius, Miguel de Icaza, and Rasmus Lerdorf... """ Of course, I had to look up who Rasmus Lerdorf was... -- Michael

Re: windows mem leak

2005-01-09 Thread Peter Hansen
Bob Smith wrote: Attached is the code. Run it yourself and see. You too Peter. Be gentle with me, this was my first attempt with threads. Thanks, Bob, and I will, but not before you answer some of my questions. I had good reasons to ask them, one of which is that I don't feel like wasting my time

Re: Python Installation

2005-01-09 Thread Peter Hansen
Simon John wrote: I would say install on one machine, then just copy the C:\Python24 directory, but then you'd have to deal with the missing Registry entries That part is pretty trivial to automate as well. Fredrik Lundh has a useful utility on his web site that will do much of what is require

Re: Python Operating System???

2005-01-09 Thread Arich Chanachai
John Roth wrote: "jtauber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] My experiment, Cleese, was making progress before I got distracted by other things. I should probably get back to it at some stage. As my ex-wife was fond of saying, "I wish you'd have told me it was impo

Re: time module precision

2005-01-09 Thread Peter Hansen
[EMAIL PROTECTED] wrote: So the problem (waiting tens to hundreds of us without busy looping) still remains... That's actually not a "problem", it's your solution to a problem. Can you describe the _real_ problem, what you are trying to do? _Why_ do you want to wait such brief amounts of time? I

Re: mysterious buggy behavior

2005-01-09 Thread Andrea Griffini
On 8 Jan 2005 20:40:37 -0800, [EMAIL PROTECTED] (Sean McIlroy) wrote: >def newGame(): >BOARD = [blank]*9 >for x in topButtons+midButtons+botButtons: x['text'] = '' Do you know that "BOARD" here is a local variable and has nothing to do with the global BOARD ? You can change that by doing

Re: Python Operating System???

2005-01-09 Thread Arich Chanachai
Roose wrote: It's a difference of degree, but an important difference. I haven't looked at Linux or Windows NT source, but my guess is the assembly used is just small functions for accessing special CPU instructions for atomicity, context switching, and the like. I KNOW they don't have huge a

Re: Python Operating System???

2005-01-09 Thread Arich Chanachai
Paul Rubin wrote: ... OK, then give me an example of Lisp OS that runs on a PC. I would like to install it on my PC tomorrow. Or maybe my Mac. That was your whole point, originally, that since it could be done in Lisp, why not Python? Huh? That's a non-sequitur, nothing prevents you from r

raw sockets ? i need a python sniffer

2005-01-09 Thread ionel
on windows xp well i got pylibpcap-0.4 but i can't compile it :( i got python 2.4, visual studio 2003 when i run "setup.py build" i get this: C:\Python24\lib\distutils\dist.py:222: UserWarning: 'licence' distribution optio n is deprecated; use 'license' warnings.warn(msg) running build running bu

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Paul Rubin
Andrey Tatarinov <[EMAIL PROTECTED]> writes: > anyway list comprehensions are just syntaxic sugar for > >>> for var in list: > >>> smth = ... > >>> res.append(smth) > > (is that correct?) I would expect lc's to work more like map does. -- http://mail.python.org/mailman/listinfo/python

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Robert Kern
Andrey Tatarinov wrote: anyway list comprehensions are just syntaxic sugar for >>> for var in list: >>> smth = ... >>> res.append(smth) (is that correct?) so there will be no speed gain, while map etc. are C-implemented It depends. Try def square(x): return x*x map(square, rang

use a file as a database, access rights

2005-01-09 Thread Torsten Mohr
Hi, i'd like to write a script that makes use of a database. It would be great if the database would store all its data in a file, that would be great for data exchange. It would also be great if i could use SQL, as i have some experience in that. Also, i NEED access rights to certain parts of

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Roman Suzi
On Sun, 9 Jan 2005, Paul Rubin wrote: >Andrey Tatarinov <[EMAIL PROTECTED]> writes: I hope there will be from __past__ import functional_paradigma in Python 3 ;-) And, also, what is the best way to replace reduce() ? Sincerely yours, Roman Suzi -- [EMAIL PROTECTED] =\= My AI powered by GNU/

Re: python3: 'where' keyword

2005-01-09 Thread Steve Holden
Alex Martelli wrote: AdSR <[EMAIL PROTECTED]> wrote: I don't know haskell, but it looks SQL-ish to me (only by loose Indeed, the fact that many MANY more people are familiar with SQL than with Haskell may be the strongest practical objection to this choice of syntax sugar; the WHERE clause in an

Re: python3: accessing the result of 'if'

2005-01-09 Thread Steve Holden
Nick Coghlan wrote: Carl Banks wrote: What if the condition you wanted to test wasn't the same as the thing you want to save? In other words, how would you convert this? . where: . m = something() . if m > 20: . do_something_with(m) Yeah, this problem eventually occurred to me as well. Ho

Re: Python Installation

2005-01-09 Thread Steve Holden
Peter Hansen wrote: Simon John wrote: I would say install on one machine, then just copy the C:\Python24 directory, but then you'd have to deal with the missing Registry entries That part is pretty trivial to automate as well. Fredrik Lundh has a useful utility on his web site that will do mu

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Steve Holden
Andrey Tatarinov wrote: Hi. How does GvR suggestions on removing map(), reduce(), filter() correlate with the following that he wrote himself (afaik): http://www.python.org/doc/essays/list2str.html ? It promotes the sensible realization that when optimization is the goal code may well tend to ge

Re: use a file as a database, access rights

2005-01-09 Thread Steve Holden
Torsten Mohr wrote: Hi, i'd like to write a script that makes use of a database. It would be great if the database would store all its data in a file, that would be great for data exchange. It would also be great if i could use SQL, as i have some experience in that. Also, i NEED access rights to c

Re: use a file as a database, access rights

2005-01-09 Thread Kartic
Torsten, Please explain the environment you are planning to use - Operating System, whether you have full control of the machine that runs the database, how many users?. If you are using Windows and if your needs are simple, you can use Access as it has some simple access control that can be set

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Andrey Tatarinov
Steve Holden wrote: Andrey Tatarinov wrote: Hi. How does GvR suggestions on removing map(), reduce(), filter() correlate with the following that he wrote himself (afaik): http://www.python.org/doc/essays/list2str.html > And note that the summary in the conclusiogn BEGINS with "Rule number one: o

Re: Old Paranoia Game in Python

2005-01-09 Thread Lucas Raab
Sean P. Kane wrote: I ported the old (and long since removed) game from the bsd-game pacakge called, Paranoia, based on the old Paranoia role playing game from C to Python as a simple exercise in learning the language and pure late night boredom. Anyways, here it is for anyone looking for a few

Re: Pygame and pyopengl with py2exe ?

2005-01-09 Thread Nyx42
Same problem: the window closes immediately. For the first program, I precise that the "pygame window" opens also. -- http://mail.python.org/mailman/listinfo/python-list

Re: use a file as a database, access rights

2005-01-09 Thread Kartic
Steve Holden wrote: > Sounds to me like you need to add a rights layer to gadfly. Aha...I did not consider that possibility. I have not gone indepth into Gadfly...is that a straigtforward thing to implement? -- http://mail.python.org/mailman/listinfo/python-list

Guild of Python consultants?

2005-01-09 Thread Miklós P
Hello freelancers out there, Is there such a thing somewhere? Yes, I'm aware of the Python Business Forum. But I mean something specifically for (individual) consultants. By searching on Google, I couldn't find a "virtual guild" of consultants who try to make a living from Python and technologies

Long strings as function parameters

2005-01-09 Thread onlyonemc
I would like to have functions that operate on long strings, 10-100 MB. In C I would of course pass a pointer to the string for a quick function call. What is an efficient way to do this in python? Cheers, -mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Old Paranoia Game in Python

2005-01-09 Thread Aahz
In article <[EMAIL PROTECTED]>, Lucas Raab <[EMAIL PROTECTED]> wrote: >Sean P. Kane wrote: >> >> I ported the old (and long since removed) game from the bsd-game pacakge >> called, Paranoia, based on the old Paranoia role playing game from C to >> Python as a simple exercise in learning the lang

Re: Python3: on removing map, reduce, filter

2005-01-09 Thread Robert Kern
Andrey Tatarinov wrote: Steve Holden wrote: Andrey Tatarinov wrote: Hi. How does GvR suggestions on removing map(), reduce(), filter() correlate with the following that he wrote himself (afaik): http://www.python.org/doc/essays/list2str.html > And note that the summary in the conclusiogn BEGINS

Re: Long strings as function parameters

2005-01-09 Thread Irmen de Jong
[EMAIL PROTECTED] wrote: I would like to have functions that operate on long strings, 10-100 MB. In C I would of course pass a pointer to the string for a quick function call. What is an efficient way to do this in python? Err, just pass the string to the function? In Python, all function argument

Re: Securing a future for anonymous functions in Python

2005-01-09 Thread Anna
Jacek Generowicz wrote: > "Anna" <[EMAIL PROTECTED]> writes: > > > Having taken some calculus (derivatives, limits, some integrals) but > > never even heard of lambda calculus, to me, lambda means absolutely > > NOTHING. Less than nothing. > > And before you took calculus, the chances are that der

Re: Long strings as function parameters

2005-01-09 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > I would like to have functions that operate on long strings, 10-100 MB. > In C I would of course pass a pointer to the string for a quick > function call. What is an efficient way to do this in python? > Cheers, In Python, *every* expression is a pointer. This fact is

Re: use a file as a database, access rights

2005-01-09 Thread Torsten Mohr
Hi, sorry for being unclear and thanks for your answers. Yes, i'd like to use a flat-file database AND access rights. One way i thought of would be to handle the access rights in the script that i write. But to let some other module handle it would also be great. If for example i could embed so

Re: Recent infoworld column

2005-01-09 Thread Roger Binns
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dwarf Electrician wrote: >> from a long time listener... >> >> http://www.infoworld.com/article/04/12/30/01OPstrategic_1.html > > Kudos for Roger Binns! It is a very nice article :-) BitPim like many other projects is a

Re: time module precision

2005-01-09 Thread Tim Peters
[Tim Peters] >> Python's time.sleep() calls the Win32 API Sleep() function on >> Windows. All behavior is inherited from the latter. See MS's docs: >> >> >> [EMAIL PROTECTED] > Oh, after a short research, I

SuSE 9.1: updating to python-2.4

2005-01-09 Thread Torsten Mohr
Hi, along with my distribution SuSE 9.1 came python 2.3.3. I'd like to update to 2.4 now, is this an easy thing to do or will lots of installed modules refuse to work then? Is there an easy way to find out what i need to update? Thanks for any hints, Torsten. -- http://mail.python.org/mailma

Re: Pre/Postconditions with decorators

2005-01-09 Thread George Sakkis
"Stephen Thorne" <[EMAIL PROTECTED]> wrote: > Unresolved Problems: > 1) How do you handle duck types, i.e. a method that accepts StringIO, > cStringIO or any other object that has a .readlines(), .seek() and > .read() method? I think the 'proper' way of checking duck types (among other things) is

Re: Pre/Postconditions with decorators

2005-01-09 Thread Andrew Dalke
Paul Rubin wrote: > [Type checking] should be left on. Leaving it in for development > and turning it off for production is like wearing a parachute > during ground training and taking it off once you're in the air. Why isn't it like practicing the trapeze with a net but going without a net when

Dr. Dobb's Python-URL! - weekly Python news and links (Jan 9)

2005-01-09 Thread Josiah Carlson
QOTW: Jim Fulton: "[What's] duck typing?" Andrew Koenig: "That's the Australian pronunciation of 'duct taping'." "I'm thinking that the I-Ching is a vast untapped resource for programming wisdom, plus it makes it funny." -- Mark Carter Nick Coghlan brings up the 'lambdas are going away in 3

read numbers from file and covert to integer

2005-01-09 Thread Øystein Western
I got a file with a lot blocks of numbers that are strings. I'd like to read all this numbers and convert them to numbers for futher compareation. How can I convert all this numbers to integer? Do I have to put all numbers into a list? regards frengky -- Organisation nr: 983063349 Frengky, Ol

Re: unicode support

2005-01-09 Thread Matt Garrish
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] # -*- coding: utf-8 -*- # python supports unicode in source code by putting a coding declaration # as the first line. print "look chinese chars: ?" # Note, however, identifiers cannot use unicode chars. # e.g. you cannot define a fu

Re: Python Installation

2005-01-09 Thread Peter Hansen
Steve Holden wrote: Peter Hansen wrote: Simon John wrote: I would say install on one machine, then just copy the C:\Python24 directory, but then you'd have to deal with the missing Registry entries That part is pretty trivial to automate as well. Fredrik Lundh has a useful utility on his web

Re: windows mem leak

2005-01-09 Thread Bob Smith
Peter Hansen wrote: Bob Smith wrote: Attached is the code. Run it yourself and see. You too Peter. Be gentle with me, this was my first attempt with threads. Thanks, Bob, and I will, but not before you answer some of my questions. I had good reasons to ask them, one of which is that I don't feel

Re: Recent infoworld column

2005-01-09 Thread Stephen Waterbury
Roger Binns wrote: You may also find a talk I gave at baypiggies in July 2004 of interest. http://bitpim.org/papers/baypiggies/ It covers the various issues in doing a "real world" Python application, including packaging [etc -- lots of great stuff ...] *Very* nice presentation -- THANKS! Especia

Re: Guild of Python consultants?

2005-01-09 Thread Peter Hansen
Miklós P wrote: Hello freelancers out there, Is there such a thing somewhere? Yes, I'm aware of the Python Business Forum. But I mean something specifically for (individual) consultants. By searching on Google, I couldn't find a "virtual guild" of consultants who try to make a living from Python a

Re: Speed revisited

2005-01-09 Thread Bulba!
On 8 Jan 2005 18:25:56 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: >> Both versions use local variables, etc. Both have their >> lists initially sorted. Both essentially use a loop with >> conditional for comparison, >> then process the record in the >> same way. > >"process the record in the

Re: read numbers from file and covert to integer

2005-01-09 Thread Peter Hansen
Øystein Western wrote: I got a file with a lot blocks of numbers that are strings. I'd like to read all this numbers and convert them to numbers for futher compareation. How can I convert all this numbers to integer? Do I have to put all numbers into a list? It would help immensely if you could p

Re: windows mem leak

2005-01-09 Thread Peter Hansen
Bob Smith wrote: Peter Hansen wrote: [snip details of Bob's platform] WinXP Home, Service Pack 2, AMD 1400MHz proc, 256MB Ram That's not really much RAM for a WinXP box. Do you have lots of physical memory available before running? (I presume you're using a version of nmap that's compiled for Wind

Re: Speed revisited

2005-01-09 Thread Bulba!
On Sat, 08 Jan 2005 17:57:30 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: >Note that Python lists are implemented basically as arrays, which means >that deleting an item from anywhere but the end of the list is O(n) >because all items in the list must be moved down to fill the hole. Ouch...

Re: "A Fundamental Turn Toward Concurrency in Software"

2005-01-09 Thread Jorgen Grahn
On 07 Jan 2005 13:48:41 -0800, Paul Rubin <> wrote: > aurora <[EMAIL PROTECTED]> writes: >> Just gone though an article via Slashdot titled "The Free Lunch Is >> Over: A Fundamental Turn Toward Concurrency in Software" >> [http://www.gotw.ca/publications/concurrency-ddj.htm]. It argues that >> the

Re: windows mem leak

2005-01-09 Thread Roel Schroeven
Bob Smith wrote: Peter Hansen wrote: How have you proven that it is not *that* program which is at fault?) It would surprise me: even if it consumes much CPU-time, memory and other resources, each instances returns all resources when it exits. I have not. All I know is that on WinXP, the program

Re: printing line numbers for debugging purpose

2005-01-09 Thread python
Below is a function to get the current line number and file name. /Jean Brouwers - # dashes added to preserve indentation. - - import traceback - - def caller(up=0): - '''Get file name, line number, function name and -source text of the caller's caller as 4-tuple: -(file, li

Re: unicode support

2005-01-09 Thread Charlton Wilbur
> "xah" == xah <[EMAIL PROTECTED]> writes: xah> python supports unicode in source xah> code by putting a coding declaration as the first line. [...] xah> In perl, support of unicode is very flaky. The language does xah> not support it, [...] All: Xah Lee is trolli

Re: windows mem leak

2005-01-09 Thread Peter Hansen
Roel Schroeven wrote: Peter Hansen wrote: How have you proven that it is not *that* program which is at fault?) It would surprise me: even if it consumes much CPU-time, memory and other resources, each instances returns all resources when it exits. I agree with that statement, but you assume that

else condition in list comprehension

2005-01-09 Thread Luis M. Gonzalez
Hi there, I'd like to know if there is a way to add and else condition into a list comprehension. I'm sure that I read somewhere an easy way to do it, but I forgot it and now I can't find it... for example: z=[i+2 for i in range(10) if i%2==0] what if I want i to be "i-2" if i%2 is not equal to 0

Re: Speed revisited

2005-01-09 Thread John Machin
Bulba! wrote: > On 8 Jan 2005 18:25:56 -0800, "John Machin" <[EMAIL PROTECTED]> > wrote: > > >Secondly, you are calling cmp() up to THREE times when once is enough. > >Didn't it occur to you that your last elif needed an else to finish it > >off, and the only possible action for the else suite was

Re: windows mem leak

2005-01-09 Thread Roel Schroeven
Peter Hansen wrote: Roel Schroeven wrote: Peter Hansen wrote: How have you proven that it is not *that* program which is at fault?) It would surprise me: even if it consumes much CPU-time, memory and other resources, each instances returns all resources when it exits. I agree with that statement

Re: python3: 'where' keyword

2005-01-09 Thread Bengt Richter
On 09 Jan 2005 03:10:15 -0800, Paul Rubin wrote: >Nick Coghlan <[EMAIL PROTECTED]> writes: >> Trying to push it a level further (down to expressions) would, IMO, be >> a lot of effort for something which would hurt readability a lot. > >I think we should just try to do t

Re: else condition in list comprehension

2005-01-09 Thread Reinhold Birkenfeld
Luis M. Gonzalez wrote: > Hi there, > > I'd like to know if there is a way to add and else condition into a > list comprehension. I'm sure that I read somewhere an easy way to do > it, but I forgot it and now I can't find it... > > for example: > z=[i+2 for i in range(10) if i%2==0] > what if I w

Re: python3: accessing the result of 'if'

2005-01-09 Thread Bengt Richter
On Sat, 08 Jan 2005 18:30:25 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: >> Right. But you know that as soon as you add this to simple >> expressions, a bunch of people are going to come here whining about how >> they don't get to use where with if-expressions. So why should

  1   2   >