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

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: 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: 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

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

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

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,

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: 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-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

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: 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.

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
>> 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: 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: 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: 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: > [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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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

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

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

Re: Being unjust

2006-01-20 Thread Magnus Lycka
Fredrik Lundh wrote: > if you can find one that's relatively stable, simple enough to enable > beginners to > do simple things with just a little python code, can do simple stuff without > needing > a full-blown DB, and can run as an ordinary CGI if necessary, I'm definitely > +1. > > (hmm. ma

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Magnus Lycka
Claudio Grondi wrote: > You seem here to try to give a definition of the term 'value' for > Python. If I understand it right, the definition of the term can't be > generally given for many reasons. It depends at least on type and in > advanced usage it can be arbitrary defined or changed. > That

Re: New Python.org website ?

2006-01-19 Thread Magnus Lycka
Roel Schroeven wrote: > - The header is too empty. Maybe "The Official Python Programming > Language Website" should be there instead of under it. (I also think > that title should be shorter, maybe something simply like "The Python > Programming Language" I also think that grey header area is

Re: Decimal vs float

2006-01-19 Thread Magnus Lycka
Fredrik Lundh wrote: str(1.1) > > '1.1' > repr(1.1) > > '1.1001' To add to the confusion: >>> str(1.1001) '1.1' >>> repr(1.1001) '1.1001' Floating point numbers are not precise. Decimals are, so they require precise information when th

Re: Multiple modules with database access + general app design?

2006-01-19 Thread Magnus Lycka
Robin Haswell wrote: > Can anyone give me advice on making this all a bit more transparent? I > guess I really would like a method to bring all these files in to the same > scope to make everything seem to be all one application, even though > everything is broken up in to different files. This is

Re: PyCon Vs. Europython

2006-01-19 Thread Magnus Lycka
Simon Burton wrote: > My employer has given me the choice to go to either Pycon or Europython > this year, > and I need some help deciding which would be more useful (for me, my > company, and python itself). > > I am mainly interested in scientific/engineering applications of > python; As far as

Re: New Python.org website?

2006-01-19 Thread Magnus Lycka
Steve Holden wrote: > The trepidation was accounted for solely by a concern that Python would > become involved in any kind of religious controversy, or that someone of > extreme views might claim that Python was associated with, or against, a > particular religious belief. I'm sure there are a

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

2006-01-18 Thread Magnus Lycka
QOTW: "*what* the value is is defined by the operations that the object supports (via its type). *how* the value is represented inside the object is completely irrelevant; a Python implementation may use electric charges in small capacitors, piles of rocks, diapers,or an endless supply of small

Re: Newcomer question wrt variable scope/namespaces

2006-01-18 Thread Magnus Lycka
Florian Daniel Otel wrote: > Do I understand it correctly > that actually the rule has to be refined as pertaining to the (so > called) "immutable" types (like e.g. integers, tuples/strings) > whereas lists and dictionaries are "mutable" types and the said > scoping rule does not apply ? No! The

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

2006-01-17 Thread Magnus Lycka
QOTW: "*what* the value is is defined by the operations that the object supports (via its type). *how* the value is represented inside the object is completely irrelevant; a Python implementation may use electric charges in small capacitors, piles of rocks, diapers,or an endless supply of small

Re: Visual Python, really "Visual"?

2005-12-14 Thread Magnus Lycka
Tolga wrote: > After a very rapid entrance into the Python, I have immediately looked > for a good IDE. Komodo and Wing IDE look very good and I think they are > enough. But now, I am searching for a Pyhton environment which should > look like Delphi / Kylix, Borland's C++ builder or Allegro Common

Re: Still Loving Python

2005-12-14 Thread Magnus Lycka
Peter Maas wrote: > If you design a moderately complex UI a designer will be faster. It's > not the speed of typing vs. dragging that matters. You see the result > instantly and don't have to start your program, look, type code, start > again and so on. A GUI builder is more pleasant to work with,

Re: I want a Python Puppy !

2005-12-14 Thread Magnus Lycka
Claudio Grondi wrote: > I have some trouble to understand how Python works > on it because it is not organized as on Windows (e.g. there is no [Lib] > directory under the [Python2.4] one) I guess it's at /usr/lib/python2.4 It's Windows which is odd by the way... Linux is organized in a way whic

Re: I want a Python Puppy !

2005-12-14 Thread Magnus Lycka
Paul Rubin wrote: > Are you seriously saying that whatever distro came out most recently > (and therefore have the latest Python version) gets to be your > favorite? You're going to have to change favorites practically every > week. Python is very high on the agenda for the Ubuntu project, and *t

Re: Newbie: executing a system command from my Python app

2005-12-14 Thread Magnus Lycka
Dan M wrote: > Have done so. Thanks for pointing out the shutils module! I keep finding > more and more excellent modules available. Do we have a Python equivalent > to Perl's CPAN? See http://www.python.org/pypi -- http://mail.python.org/mailman/listinfo/python-list

Re: OO in Python? ^^

2005-12-14 Thread Magnus Lycka
Christopher Subich wrote: > Doesn't work; duck typing is emphatically not subclass-typing. For this > system to still work and be as general as Python is now (without having > to make all variables 'object's), we'd need true interface checking. > That is, we'd have to be able to say: > > imple

Re: const objects (was Re: Death to tuples!)

2005-12-14 Thread Magnus Lycka
Gabriel Zachmann wrote: > > I was wondering why python doesn't contain a way to make things "const"? > > If it were possible to "declare" variables at the time they are bound to > objects that they should not allow modification of the object, then we > would have a concept _orthogonal_ to data

Re: OO in Python? ^^

2005-12-14 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Magnus Lycka wrote: > >>I don't really know Haskell, so I can't really compare it >>to Python. A smarter compiler can certainly infer types from >>the code and assemble several implementations of an >>algorithm, but unless I

Re: OO in Python? ^^

2005-12-14 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Magnus Lycka wrote: > >>The static typing means that you either have to make several >>implementations of many algorithms, or you need to work with >>those convoluted templates that were added to the language as >>an afterthought. > &

Re: sql using characters like é and ã

2005-12-13 Thread Magnus Lycka
Diez B. Roggisch wrote: > "Select * from table where name like '%s%%'" % > "José".decode("latin-1").encode("utf-8") Ouch! Please use parameter passing instead of building full SQL statements with embedded parameter values. You're opening up for SQL injection attacks if you allow user provided inpu

Re: I want a Python Puppy !

2005-12-13 Thread Magnus Lycka
Claudio Grondi wrote: > I have just discovered the existance of Puppy Linux which is a complete > operating system with a suite of GUI apps, only about 50 - 60M booting > directly off the CDROM ( http://www.puppylinux.org ). > > This approach appears to me very Pythonic, so it were a nice thin

Re: OO in Python? ^^

2005-12-13 Thread Magnus Lycka
Welcome to Python Matthias. I hope you will enjoy it! Matthias Kaeppler wrote: > Another thing which is really bugging me about this whole dynamically > typing thing is that it seems very error prone to me: > > foo = "some string!" > > # ... > > if (something_fubar): >fo = "another string"

Re: How to find the type ...

2005-12-09 Thread Magnus Lycka
Lad wrote: > Hello > How can I find out in Python whether the operand is integer or a > character and change from char to int ? I'm not sure what you mean by "character" in a Python context. A string? "i = int(i)" will make sure both 5 and "5" are used as 5, and "five" will be rejected with a Val

Re: efficient 'tail' implementation

2005-12-09 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > hi > > I have a file which is very large eg over 200Mb , and i am going to use > python to code a "tail" > command to get the last few lines of the file. What is a good algorithm > for this type of task in python for very big files? > Initially, i thought of reading eve

Re: ElementTree - Why not part of the core?

2005-12-09 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > >> ElementTree on the other hand provides incredibly easy access to XML > >> elements and works in a more Pythonic way. Why has the API not been > >> included in the Python core? > > Magnus> I'd really like to see that too. Sure, it's fairly trivial to >

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Magnus Lycka
Fredrik Lundh wrote: > but seriously, given how easy it is to build things with distutils, I don't > think your > configuration folks would have much trouble adding support for "anything that > has > a setup file, and is reasonably self-contained" to their build scripts. True. It's one more thin

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > ElementTree on the other hand provides incredibly easy access to XML > elements and works in a more Pythonic way. Why has the API not been > included in the Python core? I'd really like to see that too. Sure, it's fairly trivial to install it, but each different package

Re: Need help on designing a project

2005-12-07 Thread Magnus Lycka
Mardy wrote: > This works, but my problem is that SQL connections (MySQL or sqlite) don't > get closed when the script execution finishes, and at the next execution > of a CGI they may lock the database (this is especially true with sqlite, > but even mysql on Windows gave me these problems). You

Re: wxPython : getting started

2005-12-05 Thread Magnus Lycka
hrh1818 wrote: > One possible source of help is the book "Python Programming on Win 32". > It has a 20 page introducrtion on using wxPython. I think that's pretty much out of date though, unless there is a 2nd edition that I missed. I can't say that I remember that chapter, but wxPython changed q

Re: wxPython : getting started

2005-12-05 Thread Magnus Lycka
Peter Milliken wrote: > Personally I "bounced" when I attempted to learn wxPython - I found it much > easier to learn and use Tkinter combined with Pmw. It's my impression that Pmw isn't really maintained. AFAIK, the last release (as well as the last CVS commit) is more than two years old. -- htt

Re: wxGrid and Focus Event

2005-12-05 Thread Magnus Lycka
Paul McNett wrote: > Bugs wrote: > >> So Paul, are you saying there's a bug with the wxGrid control and if so, > > Yes, I think it is a bug. I'm not so sure. I seem to remember being told on the mailing list that I had to check the specific sub-window for events. Even if it's by design, it's ce

Re: SQLObject transaction rollback not working

2005-12-05 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Does anyone see what I'm doing wrong? Using MySQL? Are you aware that MySQL doesn't support transaction handling with COMMIT and ROLLBACK in all configurations. It depends on your MySQL version and what table backend you are using. The Python DB-API states that autocomm

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Where does that misconception that 2-3 spaces for indenting makes > things less readable come from? There was an article in Comm. of the > ACM on research into readability back in 1984 or so, that indicated 2-4 > spaces has very similar readability and 8 spaces significan

Re: Writing big XML files where beginning depends on end.

2005-11-28 Thread Magnus Lycka
Gerard Flanagan wrote: > what about multiple xml files? We have deployed code that relies of the XML files looking the way they do, and we'd prefer not to change that. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-24 Thread Magnus Lycka
Mike Meyer wrote: > This isn't noticably different than the original. Of course, if you > want to *do* something after the for loop, you have to test > the conditional again (or use a flag variable): > > def f(): > for i in range(20): > if i > 10: break > inloop() > if not

Re: about sort and dictionary

2005-11-24 Thread Magnus Lycka
Alex Martelli wrote: > I don't think these headaches and difficulties justify dumping the whole > field of reasoning about programs, nor the subfield of PbC. The concept > of "immutable" is really just a tiny corner of these fields, and it's a > long way from being the hardest or most problematic

Re: Writing big XML files where beginning depends on end.

2005-11-24 Thread Magnus Lycka
Ben Sizer wrote: > output = [] > > def write_tree(node): > output.append("") > sum = 0 > for child in reversed(node.children): > if child.type = leaf: > output.extend(["", "%d" % node.value, ""]) > sum += node.value > else: > sum += w

Re: Writing big XML files where beginning depends on end.

2005-11-24 Thread Magnus Lycka
Fredrik Lundh wrote: > what's the typical overall structure for this tree ? is it short and wide, > or tall and > narrow ? That varies quite a bit. It's basically a call graph for a functional language, where also aggregated results are stored in the XML tree. In other words, the shape depends o

Re: defining the behavior of zip(it, it) (WAS: Converting a flat list...)

2005-11-24 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Oh, find a need to shut other up ? > Oh, find a need to get the last word? /Magnus P.S. Yes, this *is* a test. -- http://mail.python.org/mailman/listinfo/python-list

Re: defining the behavior of zip(it, it) (WAS: Converting a flat list...)

2005-11-24 Thread Magnus Lycka
Antoon Pardon wrote: > What does this mean? It means that the hammer works better if you learn how to hold and swing it, instead of trying to modify it so that it's more comfortable to use it in a non-optimal way. -- http://mail.python.org/mailman/listinfo/python-list

Writing big XML files where beginning depends on end.

2005-11-24 Thread Magnus Lycka
We're using DOM to create XML files that describes fairly complex calculations. The XML is structured as a big tree, where elements in the beginning have values that depend on other values further down in the tree. Imagine something like below, but much bigger and much more complex:

Re: about sort and dictionary

2005-11-24 Thread Magnus Lycka
Alex Martelli wrote: > I think you mean volatile or mutable rather than transient? "transient" > is not a keyword in C++, while both volatile and mutable are, with > different semantics. Anyway, C++'s 'const' is a mess both theoretical > AND practical. I'm told Ruby's "object-freezing" works be

Re: about sort and dictionary

2005-11-24 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > "do things right" is my fundamental beef with Python. > Dispite claims, I don't believe Python's designers have > a monopoly on the definition of "right". "This hammer is stupid. It's very uncomfortable, and it's not hard and heavy enough to get the nails into the wall."

Re: drawline

2005-11-23 Thread Magnus Lycka
Ben Bush wrote: > I had the following code and when I clicked the left mouse button one > time. I got green line and the second click got a purple line and the > green disappeared. > I was confused by two questions: It's good that these postings are archived, so that teachers can check them before

Re: about sort and dictionary

2005-11-23 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Alex Martelli wrote: > >>[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> ... >> >>>intuitive seems to be a very subjective matter, depends on once >>>background etc :-) >> >>That's a strong point of Ruby, actually -- allowing an exclamation mark >>at the end of a metho

Re: about sort and dictionary

2005-11-23 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > a reminder" that the change is inplace. How arrogant! While > I'm sure the designers had kindly intentions. my memory, though > bad, is not that bad, and I object to being forced to write code > that is more clunky than need be, because the designers thought > they need

Re: Why are there no ordered dictionaries?

2005-11-23 Thread Magnus Lycka
Ganesan Rajagopal wrote: >> [EMAIL PROTECTED] com <[EMAIL PROTECTED]> writes: > what would be > > the definition of "sorted" and "ordered", before we can > go on ? Sorted > would be ordered by key comparison. Iterating over such a container will > give you the keys in sorted order. Java ca

Re: Hot to split string literals that will across two or more lines ?

2005-11-23 Thread Magnus Lycka
Fredrik Lundh wrote: > cursor.execute( > 'select * from foo' > ' where bar=%s' > ' limit 100', > bar > ) The disavantage with this is that it's easy to make a mistake, like this... cursor.execute( 'select * from foo ' 'where bar=%s

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Magnus Lycka
Christoph Zwerschke wrote: > I still believe that the concept of an "ordered dictionary" ("behave > like dict, only keep the order of the keys") is intuitive and doesn't > give you so much scope for ambiguity. Sure. Others think so too. The problem is that if you and these other people actually

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Magnus Lycka
Christoph Zwerschke wrote: > But please see my other reply: If the dictionary has more than 3 items > (say 10 or 20), and an effective ordered dict is used, it's not really > "a lot" slower. At least if we are talking about a situation were "on > demand" is "always". So, on the other side there

Re: Advice on distutils and distribution policies

2005-11-21 Thread Magnus Lycka
Mardy wrote: > Hi, > I've built a small project (http://eligante.sf.net) which I'm actually > trying to package using distutils. ... > However, I don't know if this directory layout is suitable for > site-packages, since at a first glance it looks to me that datafiles might > not be welcome under

Re: about sort and dictionary

2005-11-21 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > most built-in function/method don't return the "object" but None. This > I believe is the language creator's preference for everything being > explicit. The list methods .sort() and .reverse() don't create copies, but rather change the existing object. The reson for thi

Re: Python Book

2005-11-14 Thread Magnus Lycka
David Rasmussen wrote: > What is the best book for Python newbies (seasoned programmer in other > languages)? I think most of the best books have been mentioned, but I thought that I'd add some comments. After all, different people have different ways of learning, and like different book styles.

Re: Python obfuscation

2005-11-11 Thread Magnus Lycka
petantik wrote: > Alex Martelli wrote: >>I think that's feeble protection. If you have valuable code, and >>distribute it, people WILL crack it -- just check the warez sites for >>experimental proof... EVERYTHING that people are really interested in >>DOES get cracked, no matter what tricky machin

Re: Python obfuscation

2005-11-11 Thread Magnus Lycka
The Eternal Squire wrote: > Two things: ... > 2) Only sell to an honest customer willing to be locked into > nondisclosure agreements. This goes back to the maxim of good > salesmanship: Know Your Customer. If you have this, you don't need the obfuscation. -- http://mail.python.org/mailman/lis

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Magnus Lycka
Mike Meyer wrote: > In that case, you're using the wrong IDE. I run the Python interpeter > inside of Emacs. I edit my code in another buffer. In the source code > buffer, I hit M-C-x, and the current version of the function I'm > currently editing gets sent to the interpreter. Reload is pretty eas

Re: Application monitor

2005-11-09 Thread Magnus Lycka
Daniel Crespo wrote: > Respect Twisted... Mmm... I already started with another networking > library (TCPServer and SimpleXMLRPCServer), and I wouldn't like to mix > things because I don't know so much about those libraries. I know that > Twisted can do what I already have. But replacing it can be

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-09 Thread Magnus Lycka
python wrote: > so how can i use python to debug code and change that code without having to > restart the code. I don't know how well the commercial GUIs, such as Wing IDE manage to handle debugging. Perhaps that's worth looking into. It's my impression that debugger support in Python is weaker

Re: Application monitor

2005-11-09 Thread Magnus Lycka
dcrespo wrote: > Hi to all, > > I'd like to have an app monitor that gets rid of another app, in the > way that if it closes unspectedly, the app monitor just wake it up one > more time, and viceversa. Twisted contains such a thing. I think it's called twisted.runner, and no, it's not just for ke

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-08 Thread Magnus Lycka
vinjvinj wrote: > I have an application which allows multiple users to write models. > These models get distributed on a grid of compute engines. users submit > their models through a web interface. I want to > > 1. restrict the user from doing any file io, exec, import, eval, etc. I > was thinkin

Re: Lie Hetland book: Beginning Python..

2005-11-08 Thread Magnus Lycka
Vittorio wrote: > Nonetheless, I was unable to find any documentation about such a > different behaviour between Pysqlite and Pysqlite2; from my beginner > point of view the Pysqlite (Magnus' version) paramstyle looks a better > and more pythonic choice and I don't grasp the Pysqlite2 developers

Re: python server

2005-11-08 Thread Magnus Lycka
linuxpld wrote: > I`m writing a program (server in future) in python. > I would like to write it in such a way that I will be able to write gui > in any language and connect to my python program and use functionality > included with it. > are there any libraries that I could use? Thee are many sol

Re: Class Variable Access and Assignment

2005-11-08 Thread Magnus Lycka
Antoon Pardon wrote: > Fine that goes both ways. I don't mind not being taken serious by people > I have trouble taking serious my self. No doubt that goes for you too. You know Antoon, these internet communities aren't really like Speaker Corner in Hyde Park. You earn respect based on your merits

Re: when and how do you use Self?

2005-11-07 Thread Magnus Lycka
Tieche Bruce A MSgt USMTM/AFD wrote: > Well, thanx for all the ... useful information. > > I thought that I would try, but this has turned out to be a waist of my time. As with all studying, it might be somewhat time consuming to filter out the useful stuff in a sea of information. You did get co

Re: how to present Python's OO feature in design?

2005-11-07 Thread Magnus Lycka
pcmanlin wrote: > As I know java has many UML tools to design for its OO feature, is > there any tools or good concept for Python project Modeling? My favourite is whiteboard and digital camera. I don't generate any code from that though... ;) It's the approach suggested in Scott Ambler's "Agile M

Re: help-I am new to python, I have some query could sombody help me out.

2005-11-07 Thread Magnus Lycka
sumi wrote: > I am very new to python , I have small query could some one help me. > every time I get a new load i need to do few things like creating some > dir, changing some file contents and moving some files , i would like > to know if i can write a python script to do all these operation .

Re: Python gui

2005-11-07 Thread Magnus Lycka
Philippe C. Martin wrote: > Thanks, Tkinter it is. It really depends on what you want to achieve. If you want to make any advanced GUI application, you'll probably want some third party extension to Tkinter anyway, and then you might as well choose another tool kit from the beginning, whether it's

Re: Using Which Version of Linux

2005-11-07 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > ok, i m going to use Linux for my Python Programs, mainly because i > need to see what will these fork() and exec() do. So, can anyone tell > me which flavour of linux i should use, some say that Debian is more > programmer friendly, or shold i use fedora, or Solaris.

Re: Class Variable Access and Assignment

2005-11-07 Thread Magnus Lycka
First of all, I've still not heard any sensible suggestions about a saner behaviour for augmented assignment or for the way Python searches the class scope after the instance scope. What do you suggest? Today, x += n acts just as x = x + n if x is immutable. Do you suggest that this should change

<    1   2   3   4   5   >