Re: Project organisation

2006-07-19 Thread Magnus Lycka
rony steelandt wrote: > Imagine I have x projects and they all use util.py > > What would be the best way to organise this > > 1. > c --\project1\*.py > | > |-\project2\*.py > | > --\globals\util.py > > This organisation has the problem that if I have to modify something to > util.py tha

Re: Permission Denied

2006-08-23 Thread Magnus Lycka
Jorge Godoy wrote: > ;-) And think about security as well. I.e. put '.' in the end of your PATH, never in the beginning! -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is Python in the scheme of things?

2006-10-09 Thread Magnus Lycka
gord wrote: > As a complete novice in the study of Python, I am asking myself where this > language is superior or better suited than others. For example, all I see in > the tutorials are lots of examples of list processing, arithmetic > calculations - all in a DOS-like environment. Python runs

Re: Python to use a non open source bug tracker?

2006-10-09 Thread Magnus Lycka
Fredrik Lundh wrote: > you're not on the infrastructure list, I hear. I tried to figure out where that list is, so I could have a look at the archives, but I didn't find it in the (for me) obvious places. Could someone please provide a link to the archives for this mailing list, or aren't there

Re: What value should be passed to make a function use the default argument value?

2006-10-12 Thread Magnus Lycka
Antoon Pardon wrote: > Well maybe he didn't intend that, but how is the reader of the > documentation to know that? The reader can only go by how > things are documented. If those are not entirely consistent > with the intend of the programmer, that is not the readers > fault. I don't think I ever

Re: Where is Python in the scheme of things?

2006-10-12 Thread Magnus Lycka
Bruno Desthuilliers wrote: > gord wrote: >> As a complete novice in the study of Python, I am asking myself where this >> language is superior or better suited than others. For example, all I see in >> the tutorials are lots of examples of list processing, arithmetic >> calculations - all in a D

Re: How to write Smart Python programs?

2006-10-18 Thread Magnus Lycka
Raj wrote: > Hi, > > We just executed a project with Python using TG. The feedback was to > use more python like programming rather than C style code executed in > Python. The feedback is from a Python purist and for some reasons we > cannot solicity his help. > > So we'd like to do is to scrub t

Re: Ok. This IS homework ...

2006-10-19 Thread Magnus Lycka
Frederic Rentsch wrote: > Once upon a time programmers did things like this: > > BEGIN > | > -->|<- > | | | > | catch input| >

Re: Book about database application development?

2006-10-19 Thread Magnus Lycka
Wolfgang Keller wrote: > does anyone know of a good book that about development of database > applications? Scott Ambler's "Agile Database Techniques" Regardless of whether you'll actually use a full MVC framework or not, I suggest that you write model classes that are fully decoupled from the U

Re: print dos format file into unix format

2006-10-27 Thread Magnus Lycka
Tim Roberts wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> Suppose I have a dos format text file. The following python code will >> print ^M at the end. I'm wondering how to print it in unix format. >> >> fh = open(options.filename) >> for line in fh.readlines() >> print line, > > Are

Re: Restricting import file lookup for pyd, dll, ...

2006-10-27 Thread Magnus Lycka
Bernard Lebel wrote: > Hi, > > That's because I'm using Python through another application, via the > pywin32 extensions. When that other application starts, it performs > several thousands of file requests (we're talking 4,500, roughly) in > the Python installation, locations where there are Pyth

Re: Python 2.5 ; Effbot console ; thank ; pb release.

2006-10-27 Thread Magnus Lycka
Méta-MCI wrote: > Hi! (***sorry for my approximative english***) That's ok. Quite amusing to read that you were repaired. > A few months ago, I needed a console, under Windows. > After several research, I selected the console of EffBot. > > Thank you very much, Fredrik Lundh, for this small

Re: python GUIs comparison (want)

2006-10-27 Thread Magnus Lycka
David Boddie wrote: > You're forgetting that Qt isn't just a widget toolkit. I suspect that the non-GUI parts are (just like in Wx) C++ stuff which is more or less equivalent with things that are either Python builtins or parts of Python's standard library. Besides, getting those proprietary depen

Re: ANN: wxPython 2.7.1.3

2006-11-02 Thread Magnus Lycka
robert wrote: > John Salerno wrote: >> You want Python 2.3 for Windows? > > yes. > (I know no other big libs which already stops support of py2.3-win) The general policy for Python is to support version 2.n-1 when 2.n is the current version, but not older versions than that. There was recently a

Re: Event driven server that wastes CPU when threaded doesn't

2006-11-02 Thread Magnus Lycka
Snor wrote: > I'm attempting to create a lobby & game server for a multiplayer game, > and have hit a problem early on with the server design. I am stuck > between using a threaded server, and using an event driven server. I've > been told time and time again that I should use an event driven serve

Re: Python in sci/tech applications

2006-11-03 Thread Magnus Lycka
robert wrote: > When one follows .. > http://docs.python.org/inst/tweak-flags.html#SECTION000622000 > http://www.zope.org/Members/als/tips/win32_mingw_modules > > ..this seems only to cover the immediate python dll issues. What happens > with the C runtime libraries? You'll bind 2 di

Re: is mod_python borked?

2006-11-03 Thread Magnus Lycka
walterbyrd wrote: > *sigh* maybe I'll just use php until the web-hosters catch up, if they > ever do. The first general availability release of Apache 2.0 (2.0.35) appeared in April 2002. There are many ISPs. Perhaps you should limit yourself to those who lag behind less than four years? I can und

Re: Is there a commas-in-between idiom?

2006-11-09 Thread Magnus Lycka
Ernesto García García wrote: > list = [1,2,3,4,5,6] Just a nit-pick: It's considered an anti-idiom to hide builtins just as list by using it as a name for a variable. >>> list=[1,2,3,4,5] >>> tuple = (1,2,3,4,5) >>> if list == list(tuple): print "equal" ... Traceback (most recent call last):

Re: Python component model

2006-11-13 Thread Magnus Lycka
sturlamolden wrote: > There is a whole generation of computer users out there scared stiff of > using the keyboard. Soon, computers will not have a keyboard at all. > The trend is perhaps more pronounced among managers not writing code > themselves, but "taking decisions" about which tools to use.

Re: Py3K idea: why not drop the colon?

2006-11-16 Thread Magnus Lycka
John Salerno wrote: > personally, i don't mind the colon and see no need to lose it, but if we > are talking in the realm of aesthetics, it actually seems like it would > be cleaner if it weren't there...sure, at first everyone who is used to > it might feel like something is missing, or the lin

Re: Is python for me?

2006-11-17 Thread Magnus Lycka
I think Python is for you. lennart wrote: > Can you define 'large'? Is that large in code, or large in database? I > don't know which database is supported. If its a external db, like > MySql, the query is performed through the software of MySql, am I > right? If I'm correct, the 'slowness' comes

Re: Specifing arguments type for a function

2006-07-04 Thread Magnus Lycka
Paolo Pantaleo wrote: > I have a function > > def f(the_arg): > ... > > and I want to state that the_arg must be only of a certain type > (actually a list). Is there a way to do that? You can state that in your documentation. You're very likely to get a reasonable runtime error from this when y

Is it just me, or is Sqlite3 goofy?

2006-09-08 Thread Magnus Lycka
While I can understand your frustration, I think it is important to think about the tone in our postings here. Hydrocephalus is one of the most common birth defects, and it's not terribly unlikely that someone who reads this has a family member or someone else in his proximity who suffers from this

Re: Is it just me, or is Sqlite3 goofy?

2006-09-11 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I think an explanation of how Sqlite3 differs from SQL and > a better set of examples is still warranted. In general, Python standard library modules that are wrappers for third party libraries are very thinly documented, and they should probably remain that way, because

Re: [ANN] RuPy 2007 - Python & Ruby Conference

2006-09-11 Thread Magnus Lycka
Jakub Piotr Nowak wrote: > RuPy 2007 > Python & Ruby Conference > > Poznan, Poland > April 7-8, 2007 Are you aware of the EuroPython Conference which will take place in Vilnius three months later? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it just me, or is Sqlite3 goofy?

2006-09-13 Thread Magnus Lycka
First of all, anyone with extensive experience in database systems understand that validating and cleaning input is an unavoidable task. Static typing can help identify some of the problems, but far from all, and there is often data processing done before the data enters the database, so it's ofte

Re: Is it just me, or is Sqlite3 goofy?

2006-09-13 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > What was Richard Hipp's justification for slandering the > writers of the SQL Language Specification? First of all, if you read the text you quoted and understand English, you should be able to see that the author of the text is clearly expressing an opinion, not stating

Re: Is it just me, or is Sqlite3 goofy?

2006-09-13 Thread Magnus Lycka
Paul Boddie wrote: > To be fair, that text originates in section 12.3, referring to input > parameters to procedures. Meanwhile, the following text (subclause > 13.8, "") appears to be more pertinent: > > "If the data type of the target identified by the i-th is > an exact numeric type, then the

Re: Is it just me, or is Sqlite3 goofy?

2006-09-14 Thread Magnus Lycka
Paul Boddie wrote: > Well, if the client is free not to bother signalling anything about > erroneous value types, one has to wonder why there's so much of a > specification. If you read it, I think you'll notice that the committee has managed to produce a lot of text without spending too much ink

Re: best small database?

2006-09-14 Thread Magnus Lycka
David Isaac wrote: > I have no experience with database applications. > This database will likely hold only a few hundred items, > including both textfiles and binary files. > > I would like a pure Python solution to the extent reasonable. > > Suggestions? You haven't provided enough requirement

Re: question about including something like sqlite in python

2006-09-14 Thread Magnus Lycka
John Salerno wrote: > I was just thinking, since Python 3.0 is supposed to clean up a lot of > the unnecessary or redundant features of Python and make other things > more streamlined, does it seem to anyone that including SQLite goes > against this goal? Not to me. I don't see the redundancy.

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-19 Thread Magnus Lycka
Fredrik Lundh wrote: > this article > > http://effbot.org/zone/python-objects.htm > > may be useful for those who haven't already seen it. I don't know how many times I've referred to, or paraphrased, that article. Shouldn't it be incorporated into the standard tutorial? I think it's very he

Re: Python programs always open source?

2006-09-22 Thread Magnus Lycka
Ben Finney wrote: > Leif K-Brooks <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > So long as you're not distributing some or all of Python itself, > or a derivative work, the license for Python has no legal effect > on what license you choose for your own work. > >> I was reply

Re: does anybody earn a living programming in python?

2006-09-27 Thread Magnus Lycka
walterbyrd wrote: > If so, I doubt there are many. Depends on what you compare with. I'm pretty sure there are thousands of people working as Python programmers, and many more using it as a smaller tool in their work. Of course this is small compared to Java or C++. In the US, it seems a lot of

Re: I need some tips to begin a simple project

2006-09-27 Thread Magnus Lycka
dutche wrote: > Hi, I'm new in Python and I'm learning with "Learning Python" oreilly's > book which is very good written and explanatory. You're not saying how new you are to programming (particularly GUI programming) in general. Python itself is probably not the tricky part here. > And I can us

Re: Replace single character at given position

2006-09-27 Thread Magnus Lycka
Larry Bates wrote: >> How do I replace a single character in a string at a given position? You can't. Strings can't be mutated in Python how ever hard you try. The string type is immutable. (Of course, I suspect you can write a horrible C extension that would help you cheat. Yuk!) You need to cre

Re: does anybody earn a living programming in python?

2006-09-28 Thread Magnus Lycka
Stuart Bishop wrote: > My personal experience is that there is a shortage of good Python > programmers. In Melbourne, Australia for example there is a continual need > for about 2 more - one Python shop there just hires clueful developers and > makes their first task 'learn Python'. We generally ha

Re: a different question: can you earn a living with *just* python?

2006-09-29 Thread Magnus Lycka
John Salerno wrote: > It's a nice thought that a person can earn a living programming with > Python, which is fun enough to use just for its own sake. But for > someone like me (i.e. no programming experience) it's always a little > disheartening to see that most (if not all) job descriptions th

Re: A critique of cgi.escape

2006-09-29 Thread Magnus Lycka
Jon Ribbens wrote: > In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> maybe you haven't done software long enough to understand that >> software works better if you use it the way it was intended to be >> used, but that's no excuse for being stupid. > > So what's your excuse? If you don't

Re: Talking to marketing people about Python

2006-09-29 Thread Magnus Lycka
Roy Smith wrote: > I'm working on a product which for a long time has had a Perl binding for > our remote access API. A while ago, I wrote a Python binding on my own, > chatted it up a bit internally, and recently had a (large) customer enquire > about getting access to it. > > I asked for per

Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-29 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Steve makes a good point. Fredrik is one of the most important > contributors of Python code, tools, etc and as far as I am concerned, > that is so important that it gives him the right to be cranky from tiem > to time. Since February last year I've had the opportunity t

Re: OODB vs RDBMS

2006-11-29 Thread Magnus Lycka
Thomas Guettler wrote: > Hi, > > most of the time I use ZODB/Durus to store my data. > > I like it, but I know that it has some weaknesses: > - only accesible from python > - I need to code your indexes for fast searching yourself. There are other features of relational database systems that I

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

2006-01-22 Thread Magnus Lycka
QOTW: "The IEEE-754 standard doesn't wholly define output conversions, and explicitly allows that a conforming implementation may produce any digits whatsoever at and after the 18th signficant digit, when converting a 754 double to string. In practice, all implementations I know of that exploit t

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

2006-01-23 Thread Magnus Lycka
QOTW: "The IEEE-754 standard doesn't wholly define output conversions, and explicitly allows that a conforming implementation may produce any digits whatsoever at and after the 18th signficant digit, when converting a 754 double to string. In practice, all implementations I know of that exploit t

Re: Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-23 Thread Magnus Lycka
Roy Smith wrote: > For the most part, I agree with Terry; I want a site that gives me the info > I need without any fluff getting in the way. But, at the same time, I > realize that there is a need for marketing to suits. I'll leave layout to others, but content-wise, I don't think this is very

Re: append to the end of a dictionary

2006-01-25 Thread Magnus Lycka
Tim Chase wrote: > orderedDict = [(k,mydict[k]) for k in mydict.keys().sorted()] Wrong. As you stated, sorted() is a function, not a method. orderedListOfTuples = [(k,mydict[k]) for k in sorted(mydict.keys())] It's great that many people try to help out on comp.lang.python, the community won't s

Re: append to the end of a dictionary

2006-01-25 Thread Magnus Lycka
Tim Chase wrote: > I would lean towards using tuples, as in > > ports = [('5631','udp'), ('5632', 'tcp'), ('3389','tcp'), ('5900','tcp')] > > which you can then drop into your code: > > for (port, protocol) in ports: > print port, protocol > #do more stuff > > This allows yo

Re: append to the end of a dictionary

2006-01-25 Thread Magnus Lycka
Paul Rubin wrote: > ports = [('5631', 'udp'), > ('5632': 'tcp'), > ('3389': 'tcp'), > ('5900': 'tcp')] Change the colons to commas, and this will work... -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a more random int?

2006-01-25 Thread Magnus Lycka
Steven D'Aprano wrote: > But all joking aside, the random number generator used by Python is one of > the best in the world. What is at fault is your intuition about what > random numbers should look like, not the random number generator. This is a well known problem, and there are methods to dete

Re: Python code written in 1998, how to improve/change it?

2006-01-25 Thread Magnus Lycka
Wolfgang Keller wrote: > The way I understand this, resuming a generator causes less overhead than the > inital overhead of a function call. I don't have Python 2.4 handy, but it doesn't seem to be true in 2.3. I'm not very proficient with generators though, so maybe I'm doing something stupid he

Re: Creating a more random int?

2006-01-25 Thread Magnus Lycka
Grant Edwards wrote: > Well, it happens to slightly less than 1/365th of the > population[1], so it is rather unusual. Of course it's no more > unusal that being born on June 19th or November 3rd or any > other date you choose... Exactly. And I've never heard anyone say to my sons that it's so un

Re: Mining strings from a HTML document.

2006-01-26 Thread Magnus Lycka
Derick van Niekerk wrote: > Could you/anyone explain the 4 lines of code to me though? A crash > course in Python shorthand? What does it mean when you use two sets of > brackets as in : beg = [1,0][text.startswith(s1)] ? It's not as strange as it looks. [1,0] is a list. If you put [] after a list

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Magnus Lycka
Fred wrote: > Slackware Linux 10.2 Heh, Slackware was my first Linux distro. Version 2.2 I think. 1993 maybe? > Everything worked great up to this error when trying to load the > webpage: > "ImportError: No module name MySQLdb" Some suggestions: Start python interactively and try "import MySQLd

Re: How to handle two-level option processing with optparse

2006-01-26 Thread Magnus Lycka
R. Bernstein wrote: > I see how I missed this. Neither disable_.. or enable_.. have document > strings. And neither seem to described in the optparser section (6.21) > of the Python Library (http://docs.python.org/lib/module-optparse.html). http://docs.python.org/lib/optparse-other-methods.html --

Re: Using non-ascii symbols

2006-01-27 Thread Magnus Lycka
Terry Hancock wrote: > That's interesting. I think many people in the West tend to > imagine han/kanji characters as archaisms that will > disappear (because to most Westerners they seem impossibly > complex to learn and use, "not suited for the modern > world"). I don't know about "the West". Isn

Re: Loading a Python collection from an text-file

2006-01-27 Thread Magnus Lycka
Ilias Lazaridis wrote: > [EMAIL PROTECTED] wrote: > >> another approach (probably frowned upon, but it has worked for me) is >> to use python syntax (a dictionary, say, or a list) and just import (or >> reload) the file >> > > this sounds good. > > can I import a whole collection of instances th

Re: Loading a Python collection from an text-file

2006-01-27 Thread Magnus Lycka
Ido Yehieli wrote: > perhapse consider using the pickle module? > http://docs.python.org/lib/module-pickle.html User editable? We should be kind to our users! >>> d = {'peter':14, 'paul':23} >>> pickle.dumps(d) "(dp0\nS'paul'\np1\nI23\nsS'peter'\np2\nI14\ns." -- http://mail.python.org/mailman/

Re: Loading a Python collection from an text-file

2006-01-27 Thread Magnus Lycka
Ilias Lazaridis wrote: > within a python script, I like to create a collection which I fill with > values from an external text-file (user editable). If a spreadsheet like layout fits, use the csv module and a plain comma separated file. Then the end user can also use e.g. Excel to edit the data.

Re: Question about isinstance()

2006-01-27 Thread Magnus Lycka
Mr.Rech wrote: > Hi all, > I've read some thread about isinstance(), why it is considered harmful > and how you can achieve the same results using a coding style that > doesn't break polymorphism etc... Since I'm trying to improve my Python > knowledge, and I'm going to design a class hierarchy fro

Re: beta.python.org content

2006-01-27 Thread Magnus Lycka
>> Python is an agile programming language often compared to Tcl, Perl, >> Ruby, Scheme or Java. While it has much in common with them it also has >> unique features that set it apart. James Stroud wrote: > Maybe: > > "Python is an object oriented programming language designed to increase > prod

Re: generating method names 'dynamically'

2006-01-27 Thread Magnus Lycka
Daniel Nogradi wrote: > Well, I would normally do what you suggest, using parameters, but in > the example at hand I have to have the method names as variables and > the reason is that the whole thing will be run by apache using > mod_python and the publisher handler. There a URL > http://something

Re: beta.python.org content

2006-01-27 Thread Magnus Lycka
Steve Holden wrote: > How does > > http://beta.python.org/about/beginners/ > > look? I think it's a well written text, but it looks more like an introductionary chapter in a book about Python than a text for a web site. A book looks the same for all its readers, and it's basically sequential.

OT: Re: Using non-ascii symbols

2006-01-29 Thread Magnus Lycka
Runsun Pan wrote: > The simplified chinese exists due to the call for modernization of > language decades ago. That involved the 'upside-down' of almost > entire culture This is in some ways quite the opposite compared to Nynorsk in Norway, which was an attempt to revive the old and pure Norwegian

Re: VB to Python migration

2006-01-29 Thread Magnus Lycka
Josh wrote: > We currently use a MS Access back end and need to migrate to a proper > SQL server. We need to leave options open for SQL Server (for customers > who want to use existing infrastructure) and something like MySQL or > PostgreSQL. But in the mean time, we need to be able to access an

Re: VB to Python migration

2006-01-29 Thread Magnus Lycka
Ravi Teja wrote: > 230 UI screens is a lot. An app of that nature is not something people > commonly do in Python (although I would be happy to see people show me > wrong). Maybe not, but I don't doubt that it's reasonable to replace a VB app with 230 UI screens with Python code. A code of that s

Re: VB to Python migration

2006-01-30 Thread Magnus Lycka
Ravi Teja wrote: > Rewrites are always good and result in smaller code base if features > are not added. However, I doubt that will make the screens fewer. Lines > of code? Certainly. That depends on whether you just refactor the implementation of if you look at the problem domain with a different

Re: Python vs C for a mail server

2006-01-30 Thread Magnus Lycka
Donn Cave wrote: > If we give him credit for having some idea of what he's talking about, > then we could perhaps read his "encourages" as "makes trivially easy." > These two languages are in such different levels with introspection > that it seems kind of disingenuous to me to make this argument,

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

2006-01-30 Thread Magnus Lycka
QOTW: "[The state pattern] can be very confusing for newbies and peoples having no experience with *dynamic* languages, and I guess control-freaks and static-typing-addicts would runaway screaming. But I like it anyway !-)" - bruno desthuilliers "[D]ubious Python hacks that should never be used

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

2006-01-31 Thread Magnus Lycka
QOTW: "[The state pattern] can be very confusing for newbies and peoples having no experience with *dynamic* languages, and I guess control-freaks and static-typing-addicts would runaway screaming. But I like it anyway !-)" - bruno desthuilliers "[D]ubious Python hacks that should never be used

Re: VB to Python migration

2006-01-31 Thread Magnus Lycka
Josh wrote: > I understand what you are saying, and I'm sure the tasks our program > does could be made much cleaner. But, implementing an ERP which is > basically what we have, is a large project and the users need (or maybe > just want) access to lots of information. I'm not pretending to kno

Re: triple quoted strings as comments

2006-02-01 Thread Magnus Lycka
dmh2000 wrote: > I recently complained elsewhere that Python doesn't have multiline > comments. It seems you have a bad editor if it can't conveniently add and remove comment markers for arbitrary blocks in your source. (Maybe you just didn't find this feature.) That every comment line begins wit

Re: wxPython Conventions

2006-02-01 Thread Magnus Lycka
Jared Russell wrote: > My other question involved the proper location of specific functions. Never mix business with plea^h^h^h^hGUI. I'd suggest that you write a Python module with all your business logic that you can test from the interactive interpreter. Roughly like this: >>> import gmailche

Re: Request for suggesstions and comments

2006-02-01 Thread Magnus Lycka
Vivek Kumar wrote: > Hi all, > > I have to write a network server (sort of) and I am > looking for your valuable comments. You might want to look at twisted for this. http://twistedmatrix.com/ -- http://mail.python.org/mailman/listinfo/python-list

Test driven programming, was Re: VB to Python migration

2006-02-01 Thread Magnus Lycka
Josh wrote: > As for the testing, that's something we'll need to learn about. I've > read some articles about test driven programming in relation to extreme > programming. Can you give me links to any good sites explaining how this > all works? (Off list may be better for these off-topic links)

Re: Python vs C for a mail server

2006-02-01 Thread Magnus Lycka
Randall Parker wrote: > C++ provides ways to be type unsafe. Does that mean that C++ is type > unsafe period? Most code in C++ is going to be type safe. Some > programmers will never do dangerous casting. Others will do bad things > with casts. Sure, but on the other hand, you are really on your o

Re: Python vs C for a mail server

2006-02-01 Thread Magnus Lycka
Randall Parker wrote: > I return objects in Python and in C++. In C++ I can see what their > types are right on the m method signature. In Python I've got to write > a comment on the line above it. Ouch! Don't do that! As you've noticed, it's not very maintainable. First of all, if you want to u

Re: Python vs C for a mail server

2006-02-01 Thread Magnus Lycka
Randall Parker wrote: > Also, compile time errors get caught sooner. They get caught before > tests even get written. Not if you do Test Driven Tevelopment. Then you write the tests before you compile your target code! It's also my experience that the write test - write code - run test cycle in TD

Re: Python vs C for a mail server

2006-02-01 Thread Magnus Lycka
Jay Parlar wrote: > Well guess what: The *only* code you'll have to change is inside the > function returning the object, none of the callers would have to change. > That's completely different from C++, where you'll have to change not > only the return type and the function, but you'll also hav

Re: Python vs C for a mail server

2006-02-01 Thread Magnus Lycka
Jens Theisen wrote: > Jay wrote: >> How much time in your C/C++ code is spent casting and trying to >>trick the compiler into doing something that it thinks you shouldn't be >>doing? > > Not much frankly. Though I have no doubt that there is a lot of code that > does, but more so in older C++ co

Re: Parsing sizes

2006-02-01 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I want to be able to parse sizes in bytes in several formats, such as > "1048576", "1024K", "1024KB", "1M" etc. > > Is there a module that will help me with that? > > /David > Like this? import re units = {'B':0, 'k':10,'M':20,'G':30,'T':40} def parse(text):

Re: Test driven programming, was Re: VB to Python migration

2006-02-02 Thread Magnus Lycka
First of all, while I use TextTest, I'm fortunate to be surrounded by TextTest experts such as Goeff and Johan here at Carmen, so I'm not a TextTest expert by any measure. I probably use it in an non- optimal way. For really good answers, I suggest using the mailing list at sourceforge: http://list

Re: Python vs C for a mail server

2006-02-02 Thread Magnus Lycka
Randall Parker wrote: > Magnus Lycka wrote: > >>Randall Parker wrote: >> >>>Also, compile time errors get caught sooner. They get caught before >>>tests even get written. >> >>Not if you do Test Driven Tevelopment. Then you write >>the tes

Re: OO conventions

2006-02-02 Thread Magnus Lycka
Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>And now, at long last, the image object actually is an image. So why make >>this a two step process? Whatever the Image() initialization does, why >>can't it be done automatically when you read the file? > > "Two-step construct" (

Re: Detecting filename-encoding (on WinXP)?

2006-02-02 Thread Magnus Lycka
Tim N. van der Leeuw wrote: > Hi, > > I have a need to store directory and filenames in a database. For the > database I chose to use UTF-8 encoding; but the actual encoding used is > probably immaterial: whichever coding I take, I'll run into this issue > eventually. > > At first my code worked

Re: Another try at Python's selfishness

2006-02-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > What do you think? The impression I get from your suggestion is that you haven't really understood Python. I'm sure that some things could be better designed or better documented, but your suggestions would actually make things worse. Sorry. Today, Python has a syntacti

Re: How do I dynamically create functions without lambda?

2006-02-03 Thread Magnus Lycka
Terry Hancock wrote: > Note also in the datasets that *overperformers* *underrated* > their performance. Well, if you're the best in the group and aren't perfectly exact in your evaluation of your position relative to others, you can't overrate yourself. It's quite natural that the self evaluation

Re: Python vs C for a mail server

2006-02-05 Thread Magnus Lycka
John J. Lee wrote: > I guess the same is true of Python in some respects: it's still > incrementally changing (more than C++, I guess), and isn't all that > much younger than C++ (around 15 and 23 years old respectively). But C++ is almost entirely backwards compatible with C, which adds another d

Re: Compiling

2006-02-05 Thread Magnus Lycka
Simon Faulkner wrote: > Pardon me if this has been done to death but I can't find a simple > explanation. > > I love Python for it's ease and speed of development especially for the > "Programming Challenged" like me but why hasn't someone written a > compiler for Python? > > I guess it's not

Re: Generators vs. Functions?

2006-02-05 Thread Magnus Lycka
Duncan Booth wrote: > Steven D'Aprano wrote: >>So on the basis of my tests, there is a small, but significant speed >>advantage to _calling_ a function versus _resuming_ a generator. > > I get the same, but the difference is much less on my system: With Python 2.4? Doesn't surprise me a bit. I t

Re: Learning Python

2006-02-05 Thread Magnus Lycka
Byte wrote: > Yes, sorry, didnt realise diffrence between int and input. Since i'm > such an idiot at this, any links to sites for people who need an > unessicerily gentle learning curve? http://wiki.python.org/moin/BeginnersGuide http://www.honors.montana.edu/~jjc/easytut/easytut/ http://www.hetl

Re: Importing a class, please help...

2006-02-05 Thread Magnus Lycka
Jorgen Grahn wrote: >>Yeah, the definition of "JAR" is Java ARchive, why the hell would a >>Python script be able to read a JAR in the first place > > You are rude to an obvious newbie here ... Agreed. I don't think it was intended, but we should be cautious with our language when we address str

Re: translating PHP to Python

2006-02-05 Thread Magnus Lycka
Dave wrote: > Is there a built in way to do this in Python, or do I have to pass > "parent" when I init Thing? While I'm sure you could find a "clever" way to do this, passing in "parent" explicitly is the "proper" way to do it. Once in a while, you might actually want some other object than the l

Re: Get System Date?

2006-02-05 Thread Magnus Lycka
Dave wrote: > Dustan, > > Python has a module called, appropriately, "time". This is basically a wrapper around the standard C time library. Python has a more modern and spiffy datetime module which isn't restrained to 1970-2038, and just handles spiffy date and datetime objects instead of makin

Re: translating PHP to Python

2006-02-05 Thread Magnus Lycka
Peter Hansen wrote: > Good you clarified that, because "parent" definitely isn't used that way > by most other people here. Unless they are coding GUIs? I guess it's pretty common that GUI controls are contained in other controls called parents. At least that's how it's done in wxPython. -- http

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 6)

2006-02-06 Thread Magnus Lycka
QOTW: "Excessive cleverness can lead to unmaintainable code. So can excessive stupidity." -- Alan Morgan "Also Python code is pretty bare-metal, so that file.write or socket.write go to the syscall immediately. Try that in Java and you'll find 30 layers of complex abstractions for doubtful benef

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 6)

2006-02-06 Thread Magnus Lycka
QOTW: "Excessive cleverness can lead to unmaintainable code. So can excessive stupidity." -- Alan Morgan "Also Python code is pretty bare-metal, so that file.write or socket.write go to the syscall immediately. Try that in Java and you'll find 30 layers of complex abstractions for doubtful benef

Re: Python Class use

2006-02-07 Thread Magnus Lycka
Roel Schroeven wrote: > import MyModule > > x = MyModule.MyClass() > x.f() > > Or you could directly import MyClass into the global namespace like this: > > from MyModule import MyClass > > x = MyClass() > x.f() > > But that's not recommended since it clutters the global namespace and > makes

Re: Question about idioms for clearing a list

2006-02-08 Thread Magnus Lycka
Ed Singleton wrote: > I'm a fairly average programmer (better than average compared to my > immediate colleagues). I've read every tutorial I can get my hands > on, but I have no _memory_ of ever coming across the del keyword, let > alone that it is fundamental to Python, and I have no idea what

Re: Question about idioms for clearing a list

2006-02-08 Thread Magnus Lycka
Ed Singleton wrote: > Is it obvious to a newbie what the difference between mappings and > "not-mappings", and is it obvious exactly what is and isn't a mapping? > > Should it be necessary to "know" python before it becomes easy to use? QOTW! (You are joking, aren't you? :) I can undestand how p

Re: Is Python good for web crawlers?

2006-02-08 Thread Magnus Lycka
Tempo wrote: > I was wondering if python is a good language to build a web crawler > with? For example, to construct a program that will routinely search x > amount of sites to check the availability of a product. Or to search > for news articles containing the word 'XYZ'. These are just random > i

<    1   2   3   4   5   >