Re: optparse.py: FutureWarning error

2005-06-08 Thread Magnus Lycka
Terry Reedy wrote: > This should REALLY be on the doc page of the Python site. Agreed. > It is really time to stop pretending that the only Python users > that count have a *nix on their desk. I agree with this too, but if you're a programmer on the Windows platform with possibility to install s

Re: calling ksh script from python

2005-06-08 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > thanks for your input... > well I just find out that modifying environment through ksh call is not > possible (can't get the new evironment back to python). I thought about this a few days ago. Can't you copy it like this: import os env_rows = os.popen('. some.script

Re: Destructive Windows Script

2005-06-08 Thread Magnus Lycka
rbt wrote: > data = ['0', 'a', '1', 'b', '2', 'c',\ > '3', 'd', '4', 'e', '5', 'f',\ > '6', 'g', '7', 'h', '8', 'i',\ > '9', 'j', '~', '!', '@', '#',\ > '$', '%', '^', '&', '*', ';'] > Note that the backsl

Re: reg php.ini equivalent file in python

2005-06-08 Thread Magnus Lycka
praba kar wrote: > Dear All, > > I have one doubt. Is there python.ini > file like php.ini in Php? There is no such thing in Python. Python is a programming language. It doesn't try to be an operating system or a web server. There are a number of web application toolkits written in Python,

Re: optparse.py: FutureWarning error

2005-06-09 Thread Magnus Lycka
John Abel wrote: > Magnus Lycka wrote: > As a programmer on Win32, and *nix platforms, I agree with needing > better tools. however, I find cygwin a pita. For tools such as grep > and find, try this http://unxutils.sourceforge.net/. No need for cygwin > ( though that's

Re: Python as client-side browser script language

2005-06-09 Thread Magnus Lycka
Paul Rubin wrote: > Magnus Lycka <[EMAIL PROTECTED]> writes: > >>Of course, one might suggest that it's the task of the browser, >>and not of the scripting language, to provide a safe sandbox >>where scripts can mess around and without causing havoc on &g

Re: DB API 2.0 and transactions

2005-06-10 Thread Magnus Lycka
You might have spotted a fairly nasty bug there! Christopher J. Bottaro wrote: > Hi, > Why is there no support for explicit transactions in the DB API? I mean > like transaction() to start the trans and commit() and rollback() would end > the trans or something. To quote from Date & Darwen "A Gu

Re: different time tuple format

2005-06-10 Thread Magnus Lycka
Maksim Kasimov wrote: > hi all, sorry if i'm reposting > > why time.strptime and time.localtime returns tuple with different DST (9 > item of the tuple)? I've been bitten by the quirks in the time modules so many times that I would advice against using it for any date handling. It's ok for time

Re: programmnig advise needed

2005-06-10 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Hi, > > I am writing a Python program that needs to read XML files and contruct > a tree object from the XML file (using wxTree). > The XML however is not an hiearchical XML file. It contains > and tags. The tags link the elements > together. Are you sure that you ge

Re: circular import Module

2005-06-10 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Hello, > > I have two modules (file1.py and file2.py) > Is that ok in python (without any weird implication) if my module > import each other. I mean in module file1.py there exist command import > file2 and in module file2.py there exist command import file1? Even if i

Re: DB API 2.0 and transactions

2005-06-13 Thread Magnus Lycka
I'm CC:ing this to D'Arcy J.M. Cain. (See comp.lang.python for prequel D'Arcy.) Christopher J. Bottaro wrote: > Check this out... > > > import pgdb > import time > > print time.ctime() > db = pgdb.connect(user='test', host='localhost', database='test') > time.sleep(5) > db.cursor().execute('ins

Re: circular import Module

2005-06-14 Thread Magnus Lycka
Greg Ewing wrote: > Magnus Lycka wrote: > >> Due to the cycle, you can never use file1 without >> file2 or vice versa. Why do you then want it to be >> two different modules instead of one? > > Perhaps because it would then be too big and > unwieldy to m

Re: python bytecode grammar

2005-06-14 Thread Magnus Lycka
M1st0 wrote: > Ops yes is BNF :P Bacus Normal Form if I am not wrong... Backus Naur Form. John Backus and Peter Naur first used it to describe ALGOL around 1960. See e.g. http://cui.unige.ch/db-research/Enseignement/analyseinfo/AboutBNF.html -- http://mail.python.org/mailman/listinfo/python-lis

Re: Generating HTML from python

2005-06-14 Thread Magnus Lycka
Philippe C. Martin wrote: > I now need to generate the HTML wxHtmlEasyPrinting can print: I need to have > a title followed by lines of text that do not look too ugly. If possible I > would like to use an existing module. How to do this really depends on what your data looks like, and how you get

Re: What is different with Python ? (OT I guess)

2005-06-14 Thread Magnus Lycka
Andrew Dalke wrote: > Andrea Griffini wrote: > >>This is investigating. Programming is more similar to building >>instead (with a very few exceptions). CS is not like physics or >>chemistry or biology where you're given a result (the world) >>and you're looking for the unknown laws. In programming

Re: What is different with Python ? (OT I guess)

2005-06-14 Thread Magnus Lycka
Scott David Daniels wrote: > Magnus Lycka wrote: > >> It seems to me that *real* computer scientists are very rare. > > I suspect the analysis of algorithms people are among that group. > It is intriguing to me when you can determine a lower and upper > bound on the time

Re: What is different with Python ?

2005-06-14 Thread Magnus Lycka
Peter Maas wrote: > Learning is investigating. By top-down I mean high level (cat, > dog, table sun, sky) to low level (molecules, atoms, fields ...). Aha. So you must learn cosmology first then. I don't think so. ;) I don't know if you really think that you learn things top down, but I doubt tha

Re: Strange socket problem

2005-06-15 Thread Magnus Lycka
huy wrote: > Hi, > > I'm using cherrypy to provide a user interface for users to start a > linux server program eg. os.system("nohup myserver.py &"). The problem > is that if I stop cherrypy server and restart, I get the "Address > Already In Use" problem until I stop myserver.py. Can someone s

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-18 Thread Magnus Lycka
Alex Martelli wrote: > PL/1 is basically gone, but its legacy of "take what you need and leave > the rest" is unfortunately alive in other languages that are blind to > the enormous advantages of simplicity and uniformity. Reminds me of RUP... No wonder Ivar Jacobson gave up and started all over.

Re: Future Python Gui?

2007-04-20 Thread Magnus Lycka
Jarek Zgoda wrote: > I am not a hacker, just a software developer, but I'd have no problems > in either installing PyGTK on Ubuntu box (sudo apt-get install > python-gtk2, but it's installed by default anyway) or on Windows XP > machine (double click on installer icon). "Simple user" is not an idio

Fast and capable XML parser?

2007-04-20 Thread Magnus Lycka
I'm looking for some library to parse XML code much faster than the libs built into Python 2.4 (I'm stuck with 2.4 for quite a while) and I also need XML Schema validation, and would appreciate support for e.g. XPath and XInclude. I also want an API which is more Pythonic than e.g. a thin wrapper o

Re: Fast and capable XML parser?

2007-04-20 Thread Magnus Lycka
Larry Bates wrote: > I don't know if it meets ALL of your requirements but this might > help: > > http://www.reportlab.org/pyrxp.html AFAIK, there is no XML Schema support in PyRXP. This is really bad enough. GPL is not an option for us, and a commercial licence is less good than e.g. MIT or LGP

Re: Python not giving free memory back to the os get's me in real problems ...

2007-04-26 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Our (python-)macro uses massively nested loops which are unfortunately > necessary. These loops perform complex calculations in this commercial > tool. To give you a quick overview how long this macros runs: > > The outer loop takes 5-7 hours for one cycle. Each cycle cr

Re: Where do they tech Python officialy ?

2007-08-01 Thread Magnus Lycka
On July 23, NicolasG wrote: > I want to be a professional python programmer... > unfortunately sometimes to work as a programmer is really hard in this > world, every employee requires professional experience and you can't > really start as a beginner.. On July 24, NicolasG wrote: > Python is

Re: Python end of file marker similar to perl's __END__

2007-08-01 Thread Magnus Lycka
beginner wrote: > Hi All, > > This is just a very simple question about a python trick. > > In perl, I can write __END__ in a file and the perl interpreter will > ignore everything below that line. This is very handy when testing my > program. Does python have something similar? raise SystemExit

Re: Python end of file marker similar to perl's __END__

2007-08-02 Thread Magnus Lycka
Neil Cerutti wrote: > On 2007-08-01, Cameron Laird <[EMAIL PROTECTED]> wrote: . >> I want to re-emphasize the "triple-quote it" tip mentioned >> earlier in this thread. I think the original questioner >> will find this quite satisfying, if I understand his situ- >> ation at all. >> >> *I* ce

Re: Something in the function tutorial confused me.

2007-08-09 Thread Magnus Lycka
Lee Fleming wrote: > Hello, > I have a simple question. Say you have the following function: > > def f(x, y = []): ... > But this, the code that "fixes" the list accumulation confounds me: > def f(x, y=None): > if y is None: y = [] ... > In other words, what's going on here? How is it that

Re: A question on python performance.

2007-09-28 Thread Magnus Lycka
Joe Goldthwaite wrote: > I didn't know about the getattr function. I tried to search for that > type of function but not knowing how to word the search request, > I couldn't find it. You should really read through chapter 2 (Built-in Objects) of the library reference. All that stuff is core Pytho

Re: python 2.5 and 3gb switch

2007-10-02 Thread Magnus Lycka
neil wrote: > I see python is not really there for 64 bit yet but most of the people I think you mean "Windows is not really there for 64 bit yet". Python works well on real 64 bit operating system. Blender does too I presume. -- http://mail.python.org/mailman/listinfo/python-list

Re: unit testing

2007-10-10 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I maintain old code... code written a long time ago, before unittest > was popular. Getting unittest to work on that is difficult at best. Writing unit tests for lots of old code is not the most funny thing you can imagine... For situations like that, it might be much b

Re: Random passwords generation (Python vs Perl) =)

2007-02-01 Thread Magnus Lycka
NoName wrote: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); If you generate passwords like that to normal computer users, you'll end up with a lot of "my password doesn't work" tickets. You should skip the symbols that are easy to mistake for

Re: Python and Db

2008-04-21 Thread Magnus Lycka
> <[EMAIL PROTECTED]> escribió: > >> I would like to use sqlite, But I also wanted a tutorial with the >> basis of the sql and etc, I never dealed with dbs before For practicing SQL on-line, I'd suggest sqlzoo.net. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-07 Thread Magnus Lycka
Terry Reedy wrote: > I believe it is Guido's current view, perhaps Google's collective view, and > a general *nix view that such increases can just as well come thru parallel > processes. I believe one can run separate Python processes on separate > cores just as well as one can run separate pr

Re: Learning different languages

2006-03-08 Thread Magnus Lycka
Rich wrote: > Anyway, my question is: what experience you people have with working > with different languages at the same time? I typically use Python, C++ and SQL. When there's been lots of Python and little C++, I tend to forget to terminate C++ statements with semicolon... Otherwise I seem to k

Re: ODBC module and strange date reference <...>

2006-03-08 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I'm all for using for the latest version of Python. I'm just now > learning about Python classes, and it seems like there were some > significant changes at 2.2. I don't remember exactly what appeared when, but nothing you learn with 2.1 will stop working in 2.2 (I think

Alternative style sheets - Re: New python.org website

2006-03-09 Thread Magnus Lycka
Phoe6 wrote: > beta.python.org evolved very nice and noticed today the new python.org > website going live. There is a change in the look n feel, wherein it > looks "more official" and maximum possible information about python is > now directly accessible from the home page itself. Kudoes to the

Re: New python.org website

2006-03-09 Thread Magnus Lycka
Nicola Musatti wrote: > The obviously perfect logo would be Kaa's face: > http://disney.go.com/vault/archives/villains/kaa/kaa.html The Soviet version is better, and I think most of the Maugli movies are made before 1973, which means that they aren't copyrighted outside the former Soviet Union. (D

Re: Python Evangelism

2006-03-09 Thread Magnus Lycka
rtilley wrote: > Steve Holden wrote: > >> Doug Bromley wrote: >> >>> I can see Ruby overtaking Python if we don't ALL do something about it. > > > I think it's the name. Python. Let's change it to something nicer. Think > about it... if you found a Ruby, you'd pick it up and put it in your > p

A better RE?

2006-03-09 Thread Magnus Lycka
I want an re that matches strings like "21MAR06 31APR06 1236", where the last part is day numbers (1-7), i.e it can contain the numbers 1-7, in order, only one of each, and at least one digit. I want it as three groups. I was thinking of r"(\d\d[A-Z]\d\d) (\d\d[A-Z]\d\d) (1?2?3?4?5?6?7?)" but tha

Re: String functions: what's the difference?

2006-03-09 Thread Magnus Lycka
Harro de Jong wrote: > Thanks for the pointer. I was using time.time(), which I now see isn't > very accurate on Windows. time.clock() is more accurate on Windows (and much less so on Linux, where it also measures something completely different.) -- http://mail.python.org/mailman/listinfo/python

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: > Thanks guys! I had a feeling exceptions were nothing like in C languages > (i.e. a pain to deal with). :) Since when does C have exceptions? (You're not confusing C with C++ or C#?) -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: > One of the things I learned with C# is that it's always better to handle > any errors that might occur within the codes itself (i.e. using if > statements, etc. to catch potential out of range indexing) rather than > use too many try/catch statements, because there is some

Re: A better RE?

2006-03-10 Thread Magnus Lycka
Schüle Daniel wrote: > >>> txt = "21MAR06 31APR06 1236" > > >>> m = '(?:JAN|FEB|MAR|APR|MAI|JUN|JUL|AUG|SEP|OCT|NOV|DEZ)' > # non capturing group (:?) > > >>> p = re.compile(r"(\d\d%s\d\d) (\d\d%s\d\d) > (?=[1234567])(1?2?3?4?5?6?7?)" % (m,m)) > > >>> p.match(txt).group(1) > '21MAR06' > >

Re: A better RE?

2006-03-10 Thread Magnus Lycka
Fredrik Lundh wrote: > Magnus Lycka wrote: > r"(\d\d[A-Z]{3}\d\d) (\d\d[A-Z]{3}\d\d) (?=[1234567])(1?2?3?4?5?6?7?)" > Thanks a lot. (I knew about {3} of course, I was in a hurry when I posted since I was close to missing my train...) -- http://mail.python.org/mailman/listinfo/python-list

Re: list/classmethod problems

2006-03-15 Thread Magnus Lycka
ahart wrote: > I thank you all for your help and suggestions. I wasn't aware that > default values were considered class (static) values. That seems a > little odd to me, but as long as I know that's the case, I'll be fine. It's all very simple and regular: Things in the class scope is shared betw

Re: python debugging question

2006-03-16 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I am a python newbie. I have writen some 500 lines of code. There are 4 > classes and in all 5 files. > > Now, I am trying to run the program. I am getting wrong values for the > simulation results. If you first write 500 lines of code, and *then* try to run it, it seem

Re: Need design advice. What's my best approach for storing this data?

2006-03-20 Thread Magnus Lycka
Mudcat wrote: > I am trying to build a tool that analyzes stock data. Therefore I am > going to download and store quite a vast amount of it. Just for a > general number - assuming there are about 7000 listed stocks on the two > major markets plus some extras, 255 tradying days a year for 20 years,

Re: Is there no end to Python?

2006-03-20 Thread Magnus Lycka
John Salerno wrote: > But isn't Python sort of known for the opposite, i.e. 'one simple way', > or something to that effect? If we compare it with the "opposite" language--Perl, and think of these languages as natural languages, rather than programming languages, Perl's inventor Larry Wall, felt

Re: Importing an output from another function

2006-03-20 Thread Magnus Lycka
Byte wrote: > Now what do I do if Func1() has multiple outputs and Func2() requires > them all to give its own output, as follows: > > import random > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > output2 = random.choice(choice) > return output >

Re: Python compiler

2006-03-21 Thread Magnus Lycka
Rc wrote: > But ,my question is when I start Python it is a Dos Window > that opened.I think it is not possible on a XP computer? The Windows NT family, including XP, is not based on MS DOS. It still has a text more interface, and it is much better than DOS ever was. You can start that by clicking

Re: datetime iso8601 string input

2006-03-23 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Why not > > dt = datetime.datetime(*time.strptime(s, "%Y-%m-%dT%H:%M:%S")[0:6]) > > ? Maybe due to neglection of the 7th commandment? Most of the other commandments can be ignored while coding Python, but the 7th certainly applies here. http://www.lysator.liu.se/c

Re: multiple assignment

2006-03-24 Thread Magnus Lycka
Anand wrote: > Suppose i have a big list and i want to take tke the first one and rest > of the list like car/cdr in lisp. > is there any easy way to do this in python? It seems like overkill to me to make the syntax more complex just to avoid writing a one-line function. def first_rest(seq): ret

Re: New development windows, IronPython or PythonWin

2006-03-28 Thread Magnus Lycka
Dan wrote: > Just starting to do some windows Client / Server programming. Which > would you recommend? I need to create a server to fire events and > communicate with clients over a lan. Thanks There are plenty of Python solutions for this, most of them work with Windows, but aren't locked to it.

Re: Suggestion for Web App

2006-03-28 Thread Magnus Lycka
Harlin Seritt wrote: > I want to make a recommendation to a group of internal customers where > I work concerning a Python web framework. They are seeking to build a > portal that can handle around 5000 total users but probably no more > than 100-200 simultaneous users. This is supposed to serve m

Re: What's the best way to learn perl for a python programmer?

2006-03-28 Thread Magnus Lycka
vj wrote: > I've been given a project which requires writing scripts that need to > be run on over 3000 servers. Only about 15% of them have python > installed on them. While all/most of them will have perl. > > I'll try and do as much as possible in pexpect but am sure I'll have do > some signifi

Re: Looking for a language/framework

2006-03-30 Thread Magnus Lycka
Steve Juranich wrote: > [EMAIL PROTECTED] wrote: > >> As far as hosting, I also know >> where Zope/Plone hosting from 7.95 a month - although the host doesn't >> list it on their ads, they do use and host it. > > Which host would this be? I'm currently exploring some options for getting > a Zope

Re: Python Debugger / IDE ??

2006-03-30 Thread Magnus Lycka
Don Taylor wrote: > Is there a free or low-cost version of Delphi for Windows available > anywhere? Sure. If my memory serves me correctly, I have several CDs from various computer magazines with previous versions of Delphi at home. I don't know if such offers have been around recently, but you

Re: does python could support sequence of short or int?

2006-03-30 Thread Magnus Lycka
momobear wrote: > hi, is there a way to let python operate on sequence of int or short? If you want to work with arrays of numbers, you might want to look at NumArray etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Set Windows Environment Variable

2006-03-30 Thread Magnus Lycka
Duncan Booth wrote: > Fuzzyman wrote: >> In the ``win32api`` package there is a ``GetEnvironmentVariable`` >> function, but no ``SetEnvironmentVariable``. Any options ? > > No, your only option is to find a solution which doesn't involve changing > another process's environment. Surely there mus

Re: does python could support sequence of short or int?

2006-03-30 Thread Magnus Lycka
momobear wrote: > but what about buffer is not be declared in python program, it comes > from a C function. and what about I want to treat a string as a short > list? Python is a high level language with much stronger typing than C. If you want a list of integers, use a list of integers. Strings a

Re: How to search HUGE XML with DOM?

2006-04-07 Thread Magnus Lycka
Ivan Vinogradov wrote: > I have not much clue about databases, except that they exist, somewhat > complex, and often use proprietary formats for efficiency. Prorietary storage format, but a standardized API... > So any points on whether RDBM-based setup > would be better would be greatly appreci

Re: Looking for a language/framework

2006-04-11 Thread Magnus Lycka
Gregor Horvath wrote: > Scott David Daniels schrieb: > >> Using a relational DBMS is most definitely _not_ premature optimization. >> A relational system provides a way to store data so that it is later > > I did not mean that using a relational DBMS is premature optimization > but not using a OR

Re: Py+SQLite or other (big output) ?

2006-04-11 Thread Magnus Lycka
DurumDara wrote: > I want to process many data with python, and want to store in database. ... > So I want to use one database file - but I want to protect it. > How to do it with SQLite ? > I see that solutions: > - 1. I use transactions. > - 2. I create full copy of database after every bigger tr

Re: About classes and OOP in Python

2006-04-12 Thread Magnus Lycka
Michele Simionato wrote: > Roy Smith wrote: > >> That being said, you can indeed have private data in Python. Just prefix >> your variable names with two underscores (i.e. __foo), and they effectively >> become private. Yes, you can bypass this if you really want to, but then >> again, you can b

<    1   2   3   4   5