Re: sorting tuples...

2005-09-26 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I edited my code earlier and came up with stringing the groups > (200501202010, sender, message_string) into one string delimited by > '%%%'. Why? It seems you are trying to use a string as some kind of container, and Python has those in the box. Just use a list of tuple

Re: Indexed variables

2005-09-27 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Hello, > > being an almost complete Python AND programming neophyte I would like to ask > the following - very elementary, as I might suspect - question: > > How do I do the following flawed things right: > > > a1=a2=0 > > def f(x): > if x == a1: > a1 =

Re: Carrying variables over from function to function

2005-09-27 Thread Magnus Lycka
Ivan Shevanski wrote: > Thanks for your quick responce Roy, thats exactly what I needed. =) No, it isn't! ;) It might seem like a good idea right now, but it's not a good choice in the long run. It's like peeing in bed: Initially it's both a relief and you get warm and cosy, but you'll end upp wi

Re: good exercises for Beginner

2005-09-28 Thread Magnus Lycka
Kanthi Kiran Narisetti wrote: > I am new to programming and python. In my quest to get good at > programming, even when I am able to get through the python tutorials I > feel for lack of exercises & examples that emphasises the programming > logic skills. The examples are just introduction to parti

Re: number of python users

2005-09-28 Thread Magnus Lycka
Scott David Daniels wrote: > * 2.3 was called Python-in-a-tie; Nope, that's 2.2. See e.g. http://lists.debian.org/debian-python/2002/08/msg00025.html Sadly, it seems the Python Business Forum has died, or at least fallen into some kind of coma, so I don't know if that's an issue. In corporate i

Re: number of python users

2005-09-28 Thread Magnus Lycka
Bryan wrote: > is there a rough estimate somewhere that shows currently how many python > 1.5 vs 2.2 vs 2.3 vs 2.4 users there are? have a majority moved to 2.4? > or are they still using 2.3? etc... Why do you want to know that? -- http://mail.python.org/mailman/listinfo/python-list

Re: number of python users

2005-09-29 Thread Magnus Lycka
Robert Kern wrote: > So he can make an informed decision about how far back he should > maintain compatibility? I wasn't asking you! ;) Depending on what kind of software this is, who the potential users are, how the software will be distributed etc, the importance of being backward compatible va

Re: Python <=> Excel question

2005-10-04 Thread Magnus Lycka
Gerry Blais wrote: > Newbie questions: > > Suppose abc.xls has sheets a, b, c. > > How can I find, in Python, the sheet names? > > Given a sheet name, how can I export the sheet as a csv file? > > Finally, how can I, in Python, make a .txt version of a Word document? I think Google will help y

Re: what does 0 mean in MyApp(0)

2005-10-04 Thread Magnus Lycka
Alex wrote: > Alterbnative 2 is simple and useful, so that's why everybody use that > alternative. Everybody doesn't... Particularly in Windows, it's common that people make a .pyw-file, and then you don't see any console, or otherwise they double-click on a .py-file, and if the app dies with an

Re: Distributing programs

2005-10-04 Thread Magnus Lycka
Jason wrote: > A non-python programming friend of mine has said that any programs made > with Python must be distributed with, or an alternative link, to the > source of the program. > > Is this true? There seems to be some confusion regarding what you are asking. Are you asking about legal is

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Some people just don't get the simple fact that declarations are > essentially kind of unit test you get for free (almost), and the compiler > is a testing framework for them. It seems you've missed the entire point of using a dynamically typed language. It's not just ab

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Magnus Lycka
James A. Donald wrote: > What can one do to swiftly detect this type of bug? Unit tests. In my experience the edit - test cycle in Python is typically roughly as fast as the edit - compile cycle in e.g. C++, and much faster than the full edit - compile - link - test cycle in C++. You do use autom

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread Magnus Lycka
Paul Rubin wrote: > So where are the complex templates and dangerous void pointers in ML? You're right about that of course. There aren't any templates or pointers in COBOL either as far as I know, and COBOL has been used for lots of real world code (which ML hasn't). I don't know what your point

Re: Extending Python

2005-10-06 Thread Magnus Lycka
Tuvas wrote: > I am looking for a good tutorial on how to extend python with C code. I > have an application built in C that I need to be able to use in Python. > I have searched through various sources, starting of course with the > Python site itself, and others, but I felt a bit lacking from the

Re: Convert hex to string

2005-10-06 Thread Magnus Lycka
Java and Swing wrote: > I have some output stored in a string that looks like.. > > >>>x > > '\x01\xee\x1eo\xc3+\x8b\x83\xfad\xf6E\xaa\x0ea/I\x96\x83\xf5G\xa3\rQ\xfcH\xee\r' > > > According to, http://docs.python.org/lib/typesseq-strings.html, this is > "Unsigned Hexidecimal (lowercase)". How

Re: Controlling who can run an executable

2005-10-07 Thread Magnus Lycka
Cigar wrote: > What I want: > - the simplest thing that could possibly work! A splash screen that informs the user that it's confidential data, and that unauthorized use will lead to prosecution? Besides, I think it's not the program you need to protect, but the data. Think about that. Who cares

Re: semi-newbie module namespace confusion

2005-10-07 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > The main jist of the problem is that I'm trying add data from one > module to a list and a dictionary in another module, and it doesn't > seem to stick over there. It's probably best to avoid any circular depentencies, but as long as you make sure you really use your mod

Re: date reformatting

2005-10-11 Thread Magnus Lycka
Bell, Kevin wrote: > Anyone aware of existing code to turn a date string "8-15-05" into the > number 20050815? >>> import datetime >>> s = "8-15-05" >>> month,day,year = map(int, s.split('-')) >>> date = datetime.date(2000+year,month,day) >>> date.strftime('%Y%m%d') '20050815' Of course, if

Re: Best way to share a python list of objects

2005-10-11 Thread Magnus Lycka
kyle.tk wrote: > So I have a central list of python objects that I want to be able to > share between different process that are possibly on different > computers on the network. Some of the processes will add objects to > list and another process will be a GUI that will view objects in the > list.

Re: Python's Performance

2005-10-11 Thread Magnus Lycka
Donn Cave wrote: > Quoth "Fredrik Lundh" <[EMAIL PROTECTED]>: > | Alex Stapleton wrote > | > | > Except it is interpreted. > | > | except that it isn't. Python source code is compiled to byte code, which > | is then executed by a virtual machine. if the byte code for a module is up > | to date, t

Re: List performance and CSV

2005-10-12 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > But a really fast approach is to use a dictionary or other structure > that turns the inner loop into a fast lookup, not a slow loop through > the 'Customers' list. Another approach is to sort both sequences, loop over both in one loop and just update the index for the

Teaching Python, was: Re: is there any Python code for spatial tessellation?

2005-10-13 Thread Magnus Lycka
Shi Mu wrote: > is there any course website about teaching python? > for instance, some computer science courses website? Your subject line wasn't very helpful... See: http://mcsp.wartburg.edu/zelle/python/ http://mail.python.org/pipermail/edu-sig/ http://tech.canterburyschool.org/pycon/ http://w

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-14 Thread Magnus Lycka
Rune Strand wrote: > I've read a lot of your comments the last years. Your friendliness > always strikes me. Trying to be ironic? He *is* always right though! ;) If ones ideas are getting shut down by people like Fredrik and Steve, the rational reaction would be to assume that they are right and

Re: File compare

2005-10-14 Thread Magnus Lycka
PyPK wrote: > I have two files > file1 in format > > 'AA' 1 T T > 'AB' 1 T F > > file2 same as file1 > > 'AA' 1 T T > 'AB' 1 T T > > Also the compare should be based on id. So it should look for line > starting with id 'AA' (for example) and then match the line so if in > second case. S

Re: Profiling results

2005-10-17 Thread Magnus Lycka
Dave wrote: > I'm trying to profile a Python program using gprof, I don't think you will learn anything meaningful about a Python program from gprof. Use the profiling tools in Python. http://docs.python.org/lib/profile.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an immutable object in python

2005-10-17 Thread Magnus Lycka
Mapisto wrote: > Hi, > > I've noticed that if I initialize list of integers in the next manner: > > my_list = [0] * 30 > > > It works just fine, even if I'll try to assign one element: > > id( my_list[4] ) > > 10900116 > id( my_list[6] ) > > 10900116 > my_list[4] = 6

Re: Writing an immutable object in python

2005-10-20 Thread Magnus Lycka
Mapisto wrote: > Ok, I've understood my mistake. > > Now, my list contains a shared entry of an empty object. When an entry > is needed to be changed, I check if the entry is the shared empty > object; in that case I create a new unique instance. If the entry is > already a unique instance, I use

Re: Writing an immutable object in python

2005-10-20 Thread Magnus Lycka
Mapisto wrote: > Ok, I've understood my mistake. > > Now, my list contains a shared entry of an empty object. When an entry > is needed to be changed, I check if the entry is the shared empty > object; in that case I create a new unique instance. If the entry is > already a unique instance, I use

Re: Using graphviz to visualize trace.py output, anybody?

2005-11-01 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Hi, > > has anybody thought of / already used graphviz to convert the output of > trace.py into a graph? Thanks for the pointer to trace.py. I hadn't seen that before. Are you thinking about a call-graph or sequence diagram, based on the output from trace.py --trace?

Re: Problem With Insert with MySQLdb

2005-11-01 Thread Magnus Lycka
Dennis Lee Bieber wrote: > On Sun, 30 Oct 2005 18:44:32 -0500, "David Mitchell" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >> sql = "INSERT INTO category (category_name) VALUES ('" + >>req.form['category'] + "')" >> cursor.execute(sql) > > Don't do that! >

Re: Print to printer

2005-11-01 Thread Magnus Lycka
avnit wrote: > I can't seem to figure out how to print with my printer using python. > I'm using Mac OSX 10.4. I was thinking maybe something with > applescript. Does anyone know? Mac OSX is unix, right? This ought to work then: >>> import os >>> printer = os.popen('lpr', 'w') >>> printer.writ

Re: Need Python Pro for Help!! Plzz

2005-11-01 Thread Magnus Lycka
Alex Hunsley wrote: > My apologies to the OP for assuming he was wanting to have a private one > on one email discussion. There are certainly times when it's appropriate to request private assistance, and I personally think it's ok to make such a request available in this forum, but maybe I'm no

Re: Need Python Pro for Help!! Plzz

2005-11-01 Thread Magnus Lycka
Ruben Charles wrote: > What is better? It's better if programs work by design and not just by accident. There is of course a risk that "experts" talk above the heads of newbies, and that newbies feel uncomfortable exposing their lack of knowledge to much better programmers, but I think the Tutor

Re: String Identity Test

2005-11-01 Thread Magnus Lycka
Thomas Moore wrote: a="test" b="test" a is b > > True > > About identity, I think a is not b, but "a is b" returns True. > Does that mean equality and identity is the same thing for strings? Not exactly: >>> a="this is also a string" >>> b="this is also a string" >>> a is b False I

Re: Forced to Embed?

2005-11-01 Thread Magnus Lycka
Lloyd wrote: > As far as I can tell I have to export these all in one massive module as > there is no way for the different python modules to directly communicate > with each other? I don't see how this is a Python issue. If you can make these modules into shared objects / dynamically linked lib

Re: Flat file, Python accessible database?

2005-11-02 Thread Magnus Lycka
Karlo Lozovina wrote: > I've been Googling around for _small_, flat file (no server processes), > SQL-like database which can be easily access from Python. There are some suggestions in my EPC 2004 DB presentation: http://www.thinkware.se/epc2004db/epc04_mly_db.pdf -- http://mail.python.org/mail

Re: how to check for unix password

2005-11-02 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > hi > i created a login page that authenticate the user and his/her password > to the unix ssystem. what modules can i used to compare the unix > password with what the user typed in the cgi form? the password is > encrypted (shadowed) so i need to That's not the same thi

Re: Python and MySQL

2005-11-02 Thread Magnus Lycka
Aquarius wrote: > I appologize in advance for this strange (and possibly stupid) > question. > > I want to know if there is a way to interface a MySQL database without > Python-MySQL or without installing anything that has C files that need > to be compiled. The reason for this, is that I want to

Re: Forcing the position of scroll bars on a wxTextCtrl

2005-11-02 Thread Magnus Lycka
Someone who's probably not really called Clans Of Intrigue wrote: > Hello, this is my first post here so apologies if it's in the wrong > place, inappropriate or embarrassingly stupid - please let me know :) No, that's ok. The wxpython mailing list might give better answers though. > My problem s

Re: Forcing the position of scroll bars on a wxTextCtrl

2005-11-03 Thread Magnus Lycka
Clans Of Intrigue wrote: > Thanks, that did the trick perfectly :) > > also got rid of the self._log member so the class is now just: > > class LogControl: > """ Simple helper to redirect stdout to a panel in the GUI """ > def __init__( self, textCtrl ): > self._ctrl = textCtrl >

Re: computer programming

2005-11-03 Thread Magnus Lycka
Brandon K wrote: > what is .tk? Turkmenistan? or is it just some arbitrary suffix. Nope that's tm. Tokelau has tk. I'm sure you can learn more from Wikipedia etc. See e.g. http://en.wikipedia.org/wiki/ISO_3166-1 > >> www.javaholics.tk > > > > > == Posted via Newsgroups.com - Usenet Acc

Re: PEP submission broken?

2005-11-03 Thread Magnus Lycka
Steve Holden wrote: > Volunteers don't always behave as perfect bureaucrats :-) Neither do typical bureaucrats! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to print random strings

2005-11-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > So how would I go about have 5 strings, and running a program that will > randomly pick one of those to print? >>> import random >>> text = "Perhaps reading the manual is a good idea?".split() >>> random.choice(text) 'is' >>> random.choice(text) 'reading' >>> random

Re: Class Variable Access and Assignment

2005-11-03 Thread Magnus Lycka
Antoon Pardon wrote: > Op 2005-11-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > > >>>There are two possible fixes, either by prohibiting instance variables >>>with the same name as class variables, which would allow any reference >>>to an instance of the class assign/read the value of the va

Re: Class Variable Access and Assignment

2005-11-03 Thread Magnus Lycka
Antoon Pardon wrote: > There is no instance variable at that point. How can it add 2, to > something that doesn't exist at the moment. Because 'a += 1' is only a shorthand for 'a = a + 1' if a is an immutable object? Anyway, the behaviour is well documented. http://docs.python.org/ref/augassign.h

Re: Python and MySQL

2005-11-03 Thread Magnus Lycka
Thomas Bartkus wrote: > But heck! Now I'm looking at the /usr/lib/python2.3/site-packages on a > Mandrake Linux box. No [_mysql.] pyd here! Fewer files overall and while > there are other file extensions, everything seems to have a corresponding > [.py]. I suspect you might find _mysql.so there.

Re: Learning multiple languages (question for general discussion)

2005-11-03 Thread Magnus Lycka
infidel wrote: > Python has spoiled me. I used to periodically try out new languages > just for fun, but since learning Python, it's become a lot less > interesting. I find myself preferring to just try new ideas or > techniques in Python rather than searching for new languages to dabble > in. A

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Magnus Lycka
Stuart Turner wrote: > Hi Everyone, > > I'm working hard trying to get Python 'accepted' in the organisation I work > for. I'm making some good in-roads. One chap sent me the text below on > his views of Python. I wondered if anyone from the group could give me > some advice on how to respond /

Re: Learning multiple languages (question for general discussion)

2005-11-03 Thread Magnus Lycka
John Salerno wrote: > LOL. As weird as it sounds, that's what I *don't* want to happen with > C#! I've spent a lot of time with it, and I love it, but I don't want > Python to take over! :) Then it might be better to keep away from Python. It *will* spoil you. Python is a good team player. It's

Re: Class Variable Access and Assignment

2005-11-04 Thread Magnus Lycka
Antoon Pardon wrote: >>Because b.a += 2 expands to b.a = b.a + 2. Why would you want b.a = >> to correspond to b.__class__.a = ? > > > That is an implemantation detail. The only answer that you are given > means nothing more than: because it is implemented that way. Something that is written in

Python is like COBOL! was: Re: Getting Python Accepted in my Organisation

2005-11-04 Thread Magnus Lycka
Steve Holden wrote: >> To put things into perspective, it's important to get beyond the very >> broad categories of programming languages. It's pointless to judge >> Python on the merits of Perl or AWK, just because a certain label is >> sometimes applied to all three. That would be like saying tha

Re: Learning multiple languages (question for general discussion)

2005-11-04 Thread Magnus Lycka
Alex Martelli wrote: > Yes, but I haven't found knowing (and using) Python dampens my > enthusiasms for learning new languages. But you're more enthusiatic than most of us Alex. I wish I could say the same, but I must admit that I only did halfhearted attempts at learning new languages after Pytho

Re: Class Variable Access and Assignment

2005-11-04 Thread Magnus Lycka
Antoon Pardon wrote: > Would it be too much to ask that in a line like. > > x = x + 1. > > both x's would resolve to the same namespace? They always do Antoon. There is no such issue for local (or global) varibles. The issue has to do with c.x = c.x + 1. In this case it's clearly designed and

Re: Class Variable Access and Assignment

2005-11-04 Thread Magnus Lycka
Graham wrote: > My question remains however, i suppose i'm not familiar with how this > functions in > other languages, but what is the common way of referring to a class > variable. > > is . the norm? > or . the norm. It's not always that easy, due to inheritance. You might want the defined in

Re: Cheapest pocket device to code python on

2005-11-04 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > What is the cheapest/affordable pocket device that I can code python > on? I think the closest I have seen is pocketpc from this page: A used Fujitsu Lifebook running Linux and fairly large pockets? ;) There is some version of Python running on Palms, but it's stripped

Re: Class Variable Access and Assignment

2005-11-04 Thread Magnus Lycka
Antoon Pardon wrote: > I have looked and didn't find it in the language reference. > > This is what I have found: > > An augmented assignment expression like x += 1 can be rewritten > as x = x + 1 to achieve a similar, but not exactly equal effect. It's just a little further down. I'll post th

Re: I Need Motivation Part 2

2005-11-04 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > i m currently in a network (LAN). i started python because i heard > that it has great ability for networking programs and/or scripts, but > i m losing my motivation with python because there are sooo many > modules, that i cant just learn them all, this deters from c

Re: Shareware in Python

2005-11-04 Thread Magnus Lycka
Ivan Sas wrote: > I want to create some shareware program in Python. Can I distribute > this program with > python24.dll file from Python 2.4.2? I'm not sure if Python GPL > compatible license allowing for doing it. GPL compatible means "can be used as a component in GPL software". It doesn't imp

Re: Class Variable Access and Assignment

2005-11-04 Thread Magnus Lycka
Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >>Follow the logical implications of this proposed behaviour. >> >>class Game: >>current_level = 1 >># by default, games start at level one > > > That's bogus. Initialize the current level in the __init__ method > where

Re: Print to printer

2005-11-07 Thread Magnus Lycka
avnit wrote: > Do you know if there's a way to print a file? I'm trying to print an > HTML file, so your solution is good, but doesn't really work for me. > Just reading the HTML file and the printing the content obviously > wouldn't work. I also tried: > > >>> printer.write(file('path/to/file.ext

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

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

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

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

  1   2   3   4   5   >