Re: 450 Pound Library Program

2006-02-08 Thread Magnus Lycka
just a few style notes... > def checkOutBook(self, readerName): > "'Remove book from the front of the list, block if no books are > available'" I don't understand what "' is supposed to imply. If you meant to use triple quoting, you need to use ''' or """. Then the string can contain

Re: Question about idioms for clearing a list

2006-02-08 Thread Magnus Lycka
A slim lady in a brown overcoat appears and says with a silly French accent: "Lizten very carefully, I vill zay ziz only onze." BTW, I happen to reply to Ed's post now, but I'm really responding to a fairly common attitude which I find somewhat counterproductive. I hope people are openminded and a

Re: What editor shall I use?

2006-02-08 Thread Magnus Lycka
Lad wrote: > I did not find where I can set encoding type in vim Google is your friend. http://vim.sourceforge.net/scripts/script.php?script_id=789 http://www.vim.org/tips/tip.php?tip_id=246 http://www.vim.org/htmldoc/mbyte.html -- http://mail.python.org/mailman/listinfo/python-list

Re: 450 Pound Library Program

2006-02-08 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Ok, > > I give up. DRY = Don't Repeat Yourself (google Pragmatic Programmers) > but SPOT? Google is little help here, SPOT is too common a word. The only SPOT I worked with (as I know of) was SPOT4 (Le Systeme Pour 'l Observation de la Terre) but that's probably not it

Re: Is Python good for web crawlers?

2006-02-08 Thread Magnus Lycka
Simon Brunning wrote: > On 2/8/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > >>Bot? me? did I fail a Turing test again without even noticing?! > > > If you'd noticed the test, you'd have passed. No no, it's just a regular expression that notices the word 'bot' close to 'Martelli'. Wouldn't sur

Re: Question about idioms for clearing a list

2006-02-09 Thread Magnus Lycka
Bryan Olson wrote: > The original question was about idioms and understanding, but > there's more to the case for list.clear. Python is "duck typed". > Consistency is the key to polymorphism: type X will work as an > actual parameter if and only if X has the required methods and > they do the expec

Re: Python and the health of the public

2006-02-09 Thread Magnus Lycka
Tim Churches wrote: > The use of Python in a public health surveillance system is described > here (see references 15 and 26): > http://www.biomedcentral.com/1471-2458/5/141 > > Some more papers describing Python's starring role in some other public > health projects should appear in the next seve

Rethinking the Python tutorial

2006-02-09 Thread Magnus Lycka
While the official Python Tutorial has served its purpose well, keeping it up to date is hardly anyones top priority, and there are others who passionately create really good Python tutorials on the web. I think 'A Byte of Python' by Swaroop C H is a good beginners tutorial, and 'Dive Into Python'

New editions of several Python books.

2006-02-09 Thread Magnus Lycka
While I work at a company that uses Python a lot (and would have had a hard time finding such a place a few years ago) I don't really have a clear opinion on whether Python's marketshare (or mindshare) is growing significantly. Perl seems to be in decline, but on the other hand, Ruby is attracting

Re: Pulling all n-sized combinations from a list

2006-02-09 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: >>Windows don't support C ? that was a new one. > > > Windows comes with a C compiler? That's news to me. It doesn't come with Python either. Both Python and the compiler etc that you need can be freely downloaded from the internet. I suggest you

Re: New editions of several Python books.

2006-02-09 Thread Magnus Lycka
Aahz wrote: > If you can have _Borland C++ for Dummies_, _Python for Dummies_ makes a > lot more sense. :-/ Well, I guess Borland C++ for Dummies has a genuine purpose, but it could be a very short book. One page where is says: "Don't!" ;^) I guess it's a seal of mainstream approval to get a Dum

Re: Question about idioms for clearing a list

2006-02-10 Thread Magnus Lycka
Bryan Olson wrote: > Magnus Lycka wrote: >> Do you really have a usecase for this? It seems to me that your >> argument is pretty hollow. > > Sure: > > if item_triggering_end in collection: > handle_end(whatever) > collection.clear() >

Re: Pulling all n-sized combinations from a list

2006-02-10 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > But using the free SDK compiler from MS? That seems elusive. Have you seen this? http://www.vrplumber.com/programming/mstoolkit/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many if Statements?

2006-02-10 Thread Magnus Lycka
slogging_away wrote: > Adding it back in > cause it to not run - no error message - just a return to the >>> in > the IDLE console window much as if I had executed the 'Check Module' > command. What happens if you run it from the command line instead of IDLE? After all, it might be some problem in

Re: Question about idioms for clearing a list

2006-02-10 Thread Magnus Lycka
Bryan Olson wrote: > Magnus Lycka wrote: > >> Bryan Olson wrote: >>> big_union = set() >>> for collection in some_iter: >>> big_union.update(t) >>> collection.clear() >> >> I don't understand the second one.

Re: Pulling all n-sized combinations from a list

2006-02-13 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > But it turns out he actually had one, which he graciously provided > in response to my observation. If I had kept my trap shut, I wouldn't > have it, would I? I completely agree, but you could put your "questions" in a way that increases your chances of helpful replies.

Re: Rethinking the Python tutorial

2006-02-13 Thread Magnus Lycka
Ed Singleton wrote: > How about putting the current tutorial into the wiki and seeing if > people start updating it? I'm not saying it would work, but it might > have interesting effects... There are abviously a lot of ideas in the air concerning on-line editing of the new python web site, suppor

Re: Rethinking the Python tutorial

2006-02-13 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > There are now more than 300 tutorials listed at > www.awaretek.com/tutorials.html so one could even imagine a > "mega-tutorial" using the best-of-breed tutorial for each sub-section, > a la Turbogears ;-))) We certainly don't need 300 tutorials. :) Pick the best in the m

Re: Rethinking the Python tutorial

2006-02-13 Thread Magnus Lycka
Steve Holden wrote: > Magnus Lycka wrote: > As with all such content, the first thing you will need is a band of > volunteers dedicated to keeping the content up to date, both proactively > and in response to reader comments. That's why I suggested these already written tutori

Re: is there a better way?

2006-02-13 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Problem: > > You have a list of unknown length, such as this: list = > [X,X,X,O,O,O,O]. You want to extract all and only the X's. You know > the X's are all up front and you know that the item after the last X is > an O, or that the list ends with an X. There are neve

Re: installing python on a server?

2006-02-13 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I'm wondering whether you couldnn't use MovPy for this purpose - a > situation where you don't have root access. Huh? I thought the point with MovPy was *not* to install it! A normal Python installation can certainly be performed in the users home directory. *If* John

Re: Newbie

2006-02-14 Thread Magnus Lycka
LittlePython wrote: > Is this a good place to post python questions from newbie's, or would you > suggest another board? The best place to ask newbie questions is the Tutor mailing list. Go to http://mail.python.org/mailman/listinfo/tutor to subscribe. Check out the archives and you'll see how gre

Re: Rethinking the Python tutorial

2006-02-14 Thread Magnus Lycka
A.M. Kuchling wrote: > On Mon, 13 Feb 2006 11:03:55 -0500, > Steve Holden <[EMAIL PROTECTED]> wrote: >>What we are talking about here is a Python Language Users' Guide. > > I actually started on such a document over the holidays, but have only > described about 3 or 4 statements at this poi

Re: Rethinking the Python tutorial

2006-02-15 Thread Magnus Lycka
JW wrote: > I started with the official tutorial. It seemed up to date to me. > Things that changed from 2.4 to 2.5 changed in the tutorial as well. Agreed. I mainly felt that A Byte of Python seems to go through the features in Python in a more systematic way. The official tutorial is being kep

Re: Embedding an Application in a Web browser

2006-02-15 Thread Magnus Lycka
bruno at modulix wrote: > rodmc wrote: > >>Is it possible to embed a Python application within Internet explorer? > > No. Nor in any other browser (except from Grail, but I think this > doesn't count). This is simply not true! Python can work as a Windows scripting language just as VB Script. T

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-17 Thread Magnus Lycka
Gregory Piñero wrote: > I knew about that approach. I just wanted less typing :-( It's enough to introduce one float in the mix. 1.*a/b or float(a)/b if you don't want one more multiplication. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is empty string cached?

2006-02-17 Thread Magnus Lycka
Farshid Lashkari wrote: >> I really don't understand why it's so important: it's not a part of >> the language definition at all, and therefore whatever behavior you >> see is simply an artifact of the implementation you observe. > > > I guess I should rephrase my question in the form of an exa

Re: how to get function names from the file

2006-02-17 Thread Magnus Lycka
Petr Jakes wrote: > I have got names of functions stored in the file. For the simplicity > expect one row only with two function names: printFoo, printFOO > In my code I would like to define functions and then to read function > names from the file, so the functions can be executed in the order the

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-17 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Hi, > Is it true that that "Python 3000" is dead ? I think you should view Python 3000 as a metaphor for "Python as it would look if we didn't have to care about backward compatibility". Before this name appeared, Guido used to talk about Python 3.0 as a version where b

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-20 Thread Magnus Lycka
Steven D'Aprano wrote: > The tutorial shouldn't talk about Python3000 at all. What would be the > point of that? The tutorial is there to teach about the way Python works > now, not to make guesses and prediction about how it will work some time > in the indefinite future. There is no guessing inv

Re: web crawler in python or C?

2006-02-20 Thread Magnus Lycka
abhinav wrote: > I want to strke a balance between development speed and crawler speed. "The best performance improvement is the transition from the nonworking state to the working state."- J. Osterhout Try to get there are soon as possible. You can figure out what that means. ;^) When y

Re: any ftpd written in python?

2006-02-20 Thread Magnus Lycka
Kenneth Xie wrote: > [EMAIL PROTECTED] wrote: >> self-advertising: http://melkor.dnp.fmph.uniba.sk/~garabik/pyftpd.html >> it is a bit dated and I do not develop it anymore, but as a base of your >> own server software it can be quite good. > > Exactly what I need now, thank you very much. Maybe

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-20 Thread Magnus Lycka
Steve Holden wrote: > [EMAIL PROTECTED] wrote: >> My main point was/is: why is there not more discussion about "true >> division" !!? > > You are about three years too late for the discussion. It was debated to > death when Guido proposed that Python should behave more like > non-programmers ex

Re: Zope 3?? How do you start it on Windows?

2006-02-21 Thread Magnus Lycka
kbperry wrote: > Cool thx Matt. I did finally figure it out, but barely. Why would you > want to download and install Zope without creating an instance? It > seems kind of dumb to me. This is a quite normal separation. I think you will find the same thing among both database systems and various

Re: Mutable numbers

2006-02-21 Thread Magnus Lycka
Suresh Jeevanandam wrote: > # I am new to python. [...] > In any application most of the operation is numerical. So, i think, we > should get a good speed advantage with the availability of mutable > numbers. What do you think ? If you are new to Python, I think you should try to learn how to us

Re: question about scope

2006-02-22 Thread Magnus Lycka
John Salerno wrote: > But as far as ifs and loops, is there such a thing as scope in them? No. Local scopes are introduced with "def" or "class", nothing else (or did I forget something?). There is nothing in Python that corresponds directly to the { } in C and C++. If you want data to exist in

Re: Determing whether two ranges overlap

2006-02-22 Thread Magnus Lycka
Fredrik Lundh wrote: > def overlap(a, b): > return a[1] > b[0] and a[0] < b[1] Assuming that x[1] can't be smaller than x[0], this is the right way to compare two ranges. Well, I guess you need to figure out the borderline cases. Is it a[1] > b[0] or a[1] >= b[0] which is relevant? An

Re: embedding python in HTML

2006-02-22 Thread Magnus Lycka
John Salerno wrote: > Thanks, that makes much more sense to me now. But does this mean I can > still write HTML normally? What would an example be of having HTML > within a Python script? I have a hard time picturing this, because I > imagine that most of my pages will be almost all HTML, with j

Re: define loop statement?

2006-02-22 Thread Magnus Lycka
David Isaac wrote: > PS Here's the motivation. Python closely resembles pseudocode. With > a very little LaTeX hacking, it is often possible to write algorithms is > Python that typeset as reasonable pseudocode. A simple repetitive > loop is a bit of a sticking point. With slightly more LaTeX

Re: getting the line just before or after a pattern searched

2006-02-22 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > hi > > i have a file something like this > > abcdefgh > ijklmnopq > 12345678 > rstuvwxyz > . > . > . > 12345678 > . > > whenever i search the file and reach 12345678, how do i get the line > just above and below ( or more than 1 line above/below) the pa

Re: new wooden door step - fixing and finishing

2006-02-22 Thread Magnus Lycka
jkn wrote: > Hi all Hi! > I'm considering having a go at replacing the wooden door step to > our back door. The original is loose and rotting. Aha, like old perl scripts. > I'm sure some of this will be clearer when I remove the (metal) door > frame - how is such a step fixed? Vertical fram

Re: a little more help with python server-side scripting

2006-02-23 Thread Magnus Lycka
Dennis Lee Bieber wrote: > On Wed, 22 Feb 2006 20:43:38 GMT, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>Does that answer the question about active scripting language? > > > Slipping in... It sure sounds to me like they have Python as a pure > CGI

Re: a little more help with python server-side scripting

2006-02-23 Thread Magnus Lycka
John Salerno wrote: > The python installation on our windows hosting is not configured as > mod_python. Perhaps you can switch to linux hosting instead? If they have mod_python in that environment, you can use Python Server Pages, and whatever tools you use, there is much better support for Apac

Re: Is python very slow compared to C

2006-02-23 Thread Magnus Lycka
Isaac Gouy wrote: >>I think it is wrong to call Python "very slow" just because it is slower >>than some other language or languages, for the same reason it would be >>wrong to describe the population of the UK as "very low" because 60 >>million people is a smaller number than China or India's one

Re: May i customize basic operator (such as 1==3)?

2006-02-23 Thread Magnus Lycka
Casey Hawthorne wrote: > I have heard, that one should always use objects when programming and > avoid the builtin types! Who told you that? Some university teacher with no industrial experience? ;^) It's not good advice in Python programming, for two reasons. - It can influence performance signi

Re: a little more help with python server-side scripting

2006-02-23 Thread Magnus Lycka
John Salerno wrote: > After a little more investigation, this seems to be just one > implementation of PSP. I need to just figure out how to get 'regular' > PSP working for me, or if it's even possible on a Windows 2003 server. I don't think there is such a thing as "regular PSP". If they've ena

Re: a little more help with python server-side scripting

2006-02-24 Thread Magnus Lycka
John Salerno wrote: > Ok, seems like the verdict is that the server doesn't have mod_python > nor does it detect the .psp extension. It can, however, detect the .py > extension. But does this mean I can simply include Python code in my > HTML files, and then give my HTML files a .py extension?

Re: MySQLdb slow on MySQL 5

2006-02-24 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I'm not calling COMMIT at all. Then you must be using autocommit if your records stay in the table. An DB-API 2.0 compliant adapter should turn off autocommit by default! Does MyISAM even support proper commit handling? Oh well, Oracle will probably kill MySQL soon. G

Re: Unexpected timing results

2006-02-24 Thread Magnus Lycka
Steven D'Aprano wrote: > It looks like the time function under Linux at least is very slow. Perhaps you should try doing the same thing in C. Then you can see whether the problem is in the wrapper or in the system call. -- http://mail.python.org/mailman/listinfo/python-list

Re: why don't many test frameworks support file-output?

2006-02-24 Thread Magnus Lycka
kanchy kang wrote: > i browsed the following frameworks briefly: nose, OOBTest, > testosterone, py.test, Sancho ... and found out they do support > imediate screen-output only. Look at TextTest. -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime iso8601 string input

2006-02-24 Thread Magnus Lycka
Rubic wrote: > I can understand why datetime can't handle > arbitrary string inputs, but why not just > simple iso8601 format -- i.e. the default > output format for datetime? Have you actually read the ISO 8601 standard? If you have, you would know that parsing valid ISO 8601 is fairly close to h

Re: PYTHONPATH?

2006-02-24 Thread Magnus Lycka
Dr. Pastor wrote: > Several Documents about Python refer to PYTHONPATH. If you need to import libraries into Python, that don't reside in the standard locations in your Python installation, you need to define a PYTHONPATH environment variable in the operating system, which points out this director

Re: ls files --> list packer

2006-02-24 Thread Magnus Lycka
kpp9c wrote: > that other sillyness i mentioned is not strickly required ... just > dreaming but i know involves some kind of os walk type thing prolly ... os.walk isn't exactly rocket science... Something similar to this? >>> import os >>> for dir, dirs, files in os.walk('.'): ... txt_fil

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-24 Thread Magnus Lycka
Paul Probert wrote: > Yes, I'm doing this: > . > oldtime=time.time() > time.sleep(1) > newtime=time.time() > dt=newtime-oldtime > if dt > 2: > print 'dt=',dt,' time=',time.strftime('%Y_%m_%d_%Hh_%Mm_%Ss') > Its happening roug

Re: a little more help with python server-side scripting

2006-02-24 Thread Magnus Lycka
John Salerno wrote: > Maybe I'm misunderstanding what is meant when you say to use ASP. I'm > thinking that it involves having to learn another language (such as C# > with ASP.NET), instead of writing my code in Python. Is that not the case? Nope. Just like CGI, ASP is language agnostic. It's a

Re: a little more help with python server-side scripting

2006-02-24 Thread Magnus Lycka
John Salerno wrote: > But isn't this code: > > Response.Write('Python Test') > Response.write('Smaller heading') > > written using ASP instead of Python? Listen John. This will be the last time I respond to this thread, since you just ask more and more instead of digesting all the information yo

Re: Using ElementTree to tidy up an XML string to my liking

2006-02-24 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Yes I am but, I'm using a DOM Serializer in Firefox which for some > reason turns myCamelNames into MYCAMELNAMES for the nodenames. I'll > therefore need to control the case-spelling of these things as I'm > formatting the XML string. I realize that it's difficult to mak

Re: datetime iso8601 string input

2006-02-24 Thread Magnus Lycka
Rubic wrote: > Yeah, it's a trivial function that's rewritten for each new project > that passes datetime objects as strings <0.2 wink>. On the basis of it > being a trivial convenience, I could propose removing hundreds of > "redundant" functions from the library. ;-) I think the big issue is t

Re: MySQLdb slow on MySQL 5

2006-02-24 Thread Magnus Lycka
Gerhard Häring wrote: >> Oh well, Oracle will probably kill MySQL soon. > > Did you read too much Slashdot to spread such FUD? :) I guess I should have used half a smiley, since I was only half serious. Buying InnoBase OY was...an interesting move. Cheap too! It's a while since I visited /. For

Re: sort one list using the values from another list

2006-02-27 Thread Magnus Lycka
Dolmans Sun wrote: > Kent Johnson wrote: >> >>> [a for b,a in sorted(zip(B,A))] > > also, [a for _,a in sorted(zip(B,A))] > > didn't read refs, tested above python-2.2.3. Is there something here I can't see, or did you just change a variable name and present that as another solution? -- http:

Re: Using ElementTree to tidy up an XML string to my liking

2006-02-27 Thread Magnus Lycka
Richard Townsend wrote: > On Fri, 24 Feb 2006 18:21:59 +0100, Magnus Lycka wrote: >>Concerning element names, it's your coice of course, but I agree >>more and more with Guido and PEP008 that camelCase is ugly. (Not >>that ALLCAPS is better...) > > I

Firebird and Python

2006-02-27 Thread Magnus Lycka
Jarek Zgoda wrote: > They just hired Jim Starkey. Perhaps MySQL AB hopes he will write a > transactional engine for MySQL, as he previously wrote one for Interbase > (which is known to be one of the best a man could imagine). > > Anyway, we got far off topic, so we better go somewhere else. Ok,

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Peter Hansen wrote: > Magnus Lycka wrote: > >> With an operating system such as Windows, this is >> probably something you can expect to happen, although >> I'm surprised if such long lag times as 200 s are typical. > > No way. I mean, I'm the biggest cri

Re: ls files --> list packer

2006-02-27 Thread Magnus Lycka
kpp9c wrote: > that is nice but the little further wrinkle, which i have no idea > how to do, would be to have the contents of each directory packed into > a different list since you have no idea before hand how many lists > you will need (how many subdirs you will enounter) ... well that

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Claudio Grondi wrote: > I mean, that using time.clock() solves the problem, because the output > of the following code: On Windows that it. At least on Linux and Solaris, time.clock() returns CPU time. If time.clock() returns significantly different values before and after time.sleep(1), there's

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-27 Thread Magnus Lycka
per9000 wrote: > ...and there was much rejoicing... Even better, thanks - you guys are > the best. > > import string, time, sys > sys.path.append("../../py_scripts") > > Works just nice, and yes, I removed the env.variable before I tried it > :-D The *right* thing to do might be to install the p

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Magnus Lycka
Tim Chase wrote: > ...throw UnthrowableKoan > ... > > (okay...maybe it's a little too early on a weekdays.mon morning) Probably, since a SyntaxError slipped in. Throw is C++ Tim. It's "raise UnRaisableKoan". -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython: help(wx) causes segfaulting?

2006-02-28 Thread Magnus Lycka
Franz Steinhaeusler wrote: > maybe you have 2.4.2 and I 2.4. This looks like a wxPython problem, not a Python problem. It might well be a version issue for you guys, but it's more likely that a certain wxPython version is the culprit, not a certain Python version. Note however that the OP is usin

Re: Firebird and Python

2006-02-28 Thread Magnus Lycka
Claudio Grondi wrote: > Do I understand it right, that I can use Firebird database in the same > way as I can use the Berkeley one provided in Python standard distribution? That depends on what you mean by "the same way"... As with Berkeley, you can use it in-process, and don't need a separate s

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-03-01 Thread Magnus Lycka
Mladen Adamovic wrote: > Magnus Lycka wrote: > >> On Windows that it. At least on Linux and Solaris, time.clock() returns >> CPU time. If time.clock() returns significantly different values before >> and after time.sleep(1), there's something seriously broken

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-01 Thread Magnus Lycka
Jonathan Gardner wrote: > On database portability... > > While it is noble to try to have a generic interface to these > libraries, the end result is that the databases are always different > enough that the interface just has to work differently. Considering the use case in question... "What I

Re: Problem solved: Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-03-01 Thread Magnus Lycka
Paul Probert wrote: > Thanks everyone for your help. > It was the "Abouttime.exe" program, a time synch utility. To get the > problem, you have to run it as a service, and possibly it has to have > trouble connecting to its time servers. It would cause time.sleep(1) to > sometimes block for 20

Re: how to write file with cp1250 encodings?

2006-03-01 Thread Magnus Lycka
Grzegorz Smith wrote: > Hi all. I have got situation: i load data from database(MSSQL) wchich are > encoded cp1250 Are you sure that you are getting cp1250 from the database? How do you communicate with the database? With the database APIs I used in Windows, I always got Unicode objects from data

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-02 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > This is from a database I didn't design and can't change. The problem > is that the ODBC module suffixes an "L" to any integer returned that > was defined as data type number(p). For example, an integer stored as: > 56 will be returned as 56L. Numbers that were specifie

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-02 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > The other thing I didn't do a good job of explaining is that I want to > have a layer of abstraction between the underlying RDBMS and the > business logic. It's the business logic I want to use Python for, so > that would stay roughly the same between RDBMS changes, if we

Re: re-posting: web.py, incomplete

2006-03-03 Thread Magnus Lycka
_wolf wrote: > then the output is :: > > Hello, oops! > Hello, oops! > <20 lines omitted/> > Hello, oops! > Hel Are you running Python unbuffered? I.e. python -u -- http://mail.python.org/mailman/listinfo/python-list

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > # Print new list > print recordList > > [872L, 'ACTIVE', , >>>00EA1428>, None, '1.0.0.0', None, None, None] Read the Python library manual chapter 2. Read all of it, it's all very useful information, but take a particular look at str() and repr(). All Python object

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

2006-03-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Incidentally, I have just ordered: > > * Learning Python > * Python Cookbook > * Python Pocket Reference > > Are there any other books y'all would recommend as essential Python > references and/or books for becoming fluent in Python? Both Beazley's "Python Essential Re

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

2006-03-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Been using the ODBC module for Python 2.1 It might well become a problem that you are stuck with a five year old Python version. Python 2.1 is no longer a supported Python version. Support for 2.2 will probably end soon. Are you using an old version of ESRI software, o

Re: white space in expressions and argument lists

2006-03-03 Thread Magnus Lycka
Sybren Stuvel wrote: > Scott David Daniels enlightened us with: > >>One reason is such code changes too much on code edits, which makes >>code differences hard to read. > > Good point. I'll keep it in mind :) Think particularly about using version management systems and applying patches coming f

Re: re-posting: web.py, incomplete

2006-03-03 Thread Magnus Lycka
Dennis Lee Bieber wrote: > On 3 Mar 2006 04:01:44 -0800, "_wolf" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>it does look like it, no? No, it looks the other way around: You have buffered output, and parts of your stdout never gets flushed. -u is not a problem, it's

Re: Python advocacy in scientific computation

2006-03-06 Thread Magnus Lycka
Dennis Lee Bieber wrote: > I did look at Ruby once... It looked to me like the worst aspects of > PERL grafted onto the worst parts of old Python. Don't forget that there are portions of Smalltalk syntax (blocks) added in as well. I guess it could be seen as Perl-NG. Both the name 'Ruby' and

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-06 Thread Magnus Lycka
Sergei Organov wrote: > Well, without reading the manuals I'd expect this to raise an exception > instead of yielding of meaningless and confusing result, consider: Without reading the manuals, you can only expect that Python will be "compatible" with the ideas you have of things based on previous

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Magnus Lycka
john67 wrote: > The company I work for is about to embark on developing a commercial > application that will cost us tens-of-millions to develop. When all is > said and done it will have thousands of business objects/classes, Ok, that sounds like a big app, but does it really have to be like tha

Re: newbie file/DB processing

2005-05-19 Thread Magnus Lycka
len wrote: > I am an old time > cobol programmer from the IBM 360/370 eria and this ingrained idea of > file processing using file definition (FD's) I believe is causing me > problems because I think python requires a different way of looking at > datafiles and I haven't really gotten my brain aro

Re: regexp for sequence of quoted strings

2005-05-30 Thread Magnus Lycka
gry@ll.mit.edu wrote: > I have a string like: > {'the','dog\'s','bite'} > or maybe: > {'the'} > or sometimes: > {} ... > I want to end up with a python array of strings like: > > ['the', "dog's", 'bite'] Assuming that you trust the input, you could always use eval, but since it seems fairly ea

Re: Get number of lines in file

2005-05-30 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Thanks! I was trying len(cpn_version) and that didn't work. What's your problem? You get a value that's one more than you expected? You should use splitlines() instead of split('\n'), or easier, use readlines() instead of read(). Of course, with a modern python you can

Re: Determine if windows drive letter is hard drive or optical from python?

2005-05-30 Thread Magnus Lycka
Wolfgang Strobl wrote: > ... for drive in string.letters[len(string.letters)/2:]: Or better... ..for drive in string.ascii_uppercase: string.letters differ with locale, but Windows drives are always only A-Z (right?) and just iterating over upper case (or lower) seems more clear than

Re: Is there a better way of doing this?

2005-05-30 Thread Magnus Lycka
Steven D'Aprano wrote: > print is a statement, not a function. The brackets are syntactically > correct, but pointless. Remove them. ... > On Sat, 28 May 2005 13:24:19 +, Michael wrote: >> while( newNS ): > > Guido (our Benevolent Dictator For Life and creator of Python) hates > seeing white

Re: Threading questions

2005-05-30 Thread Magnus Lycka
Antal Rutz wrote: > Hi, All! > > I'm new to threading. I have some design questions: > Task: I collect data and store them in an RDBMS (mysql or pgsql) > > The question is how to do that with threading? > The data-collecting piece of the code runs in a thread. > > 1. Open the db, and each thread

Exiting SocketServer: socket.error: (98, 'Address already in use')

2005-05-30 Thread Magnus Lycka
I have a socket server like below which I want to exit when it's out of data. If I interrupt the client, I'll get a broken pipe on the server side, and after a Ctrl-C, I can restart the server again, but if I let it run out of data, and exit via handle_error as can be seen below, I will get a socke

Re: Case Sensitive, Multiline Comments

2005-05-30 Thread Magnus Lycka
Terry Reedy wrote: > Difference annoyances for different folks, I guess. IN MY EXPERIENCE, MANY PEOPLE ON THE INTERNET ARE ANNOYED BY PEOPLE WHO DON'T USE CASE THE WAY THEY ARE EXPECTED. IT ALSO SEEMS TO ME THAT LOWER CASE TEXT IS OFTEN MORE EASY TO READ, AND ALSO THAT IT IS EASIER TO SCAN TEXTS I

Re: eric3 question

2005-05-31 Thread Magnus Lycka
Gerrit van Dyk wrote: > Try using raw_input() instead of the sys.stdin.readline(). raw_input() > is the preferred way of getting console input. Is it? Guido's "Python Regrets" slides (Google for them) seems to say the opposite. Besides, that's not the problem here... Alexander Zatvornitskiy wrot

Re: Exiting SocketServer: socket.error: (98, 'Address already in use')

2005-05-31 Thread Magnus Lycka
Thank's a lot Andrew and Dennis. Andrew Dalke wrote: > You can set the class variable "allow_reuse_address = True" in > your derived ExitableSocketServer to get the behaviour you > expect, at the expense of some problems mentioned in the > above URL. Ok. I added a STOP message to my protocol, so

Re: Report generator for object databases.

2005-05-31 Thread Magnus Lycka
Mir Nazim wrote: > Hi, > I m planning to use ZODB for an applicaton. Is any one aware of report > generators like Data Vision, Crystal Reports, fo python object > databases. ZODB isn't like a relational database. It doesn't have a query language etc. In other words, a report generator for a ZODB a

Re: Newbie Here

2005-05-31 Thread Magnus Lycka
Mark Sargent wrote: > A question I have, is, those of you who use it > for the same things, what do you primarily use it for. Erh, I'm sure different people use it for very different things. In contrast to e.g. PHP or bash, Python is a very generic language usable for most preogramming tasks. My

Re: Seti-like program

2005-06-01 Thread Magnus Lycka
GMane Python wrote: > I'd like to consider making a program which is 'seti-like' where I could run > a command-line Python script to just 'do something', and then be able to > launch a viewer program (maybe linux x11 or Windows, possibly over a network > socket) using wxPython to be able to inter-a

Re: Python as client-side browser script language

2005-06-01 Thread Magnus Lycka
Rune Strand wrote: > What would it take to create a Firefox extension that enables Python as > a script language in the browser - just like Javascript? Is it at all > possible? Are the hundred good reasons not to bother? There are certainly security issues. A simple implementation that started a "

Re: xml processing

2005-06-01 Thread Magnus Lycka
Jeff Elkins wrote: > I've like to use python to maintain a small addressbook which lives on a > Sharp > Zaurus. This list will never grow beyond 200 or so entries. I've installed > pyxml. > > Speaking generally, given a wxpython app to do data entry, > I'm planning to: > > 1. parse the addres

Re: anygui,anydb, any opinions?

2005-06-03 Thread Magnus Lycka
Skip Montanaro wrote: > Glade is fine for building Gtk user interfaces. I have no idea if there are > similar tools for other widget sets, though I wouldn't be surprised if such > tools existed. Once the GUI is fairly stable, most of the development after > that occurs in the underlying functiona

<    1   2   3   4   5   >