Re: How to replace all None values with the string "Null" in a dictionary

2005-10-28 Thread bruno at modulix
dcrespo wrote: > Hi all, > > How can I replace all None values with the string 'Null' in a > dictionary? > > For example: > convert this: > a = {'item1': 45, 'item2': None} > > into this: > a = {'item1': 45, 'item2': 'Null'} > I think it would be time for you to read the Fine Manual... for ke

Re: data hiding/namespace pollution

2005-10-31 Thread bruno at modulix
Alex Hunsley wrote: > There's no really specific questions in this post, but I'm looking for > people's thought on the issues within... > > > The two main versions I've encountered for data pseudo-hiding > (encapsulation) Hmmm... Are data-hiding and encapsulation really the same things ? > i

Re: data hiding/namespace pollution

2005-10-31 Thread bruno at modulix
Alex Hunsley wrote: > bruno at modulix wrote: > >> Alex Hunsley wrote: >> (snip) >>> >>> method 1: >>> >>> _X - (single underscore) - just cosmetic, a convention to let someone >>> know that this data should be private. >&g

Re: 'super' to only be used for diamond inheritance problems?

2005-10-31 Thread bruno at modulix
Alex Hunsley wrote: > I've seen a few discussion about the use of 'super' in Python, including > the opinion that 'super' should only be used to solve inheritance > diamond problem. (And that a constructor that wants to call the > superclass methods should just call them by name and forget about su

Re: About the Python Expert

2005-11-02 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hey, i didnt say i need an expert. wel i did... anyways, i m just > saying that Fan is not a good python programmer, he doesnt know enough > python to help those who have joined his group, i know its askin a > lot, and i m not askin for a private tutor, just someone(s)

Re: expanding dictionary to function arguments

2005-11-02 Thread bruno at modulix
Noah wrote: > Bruno Desthuilliers a écrit : > >>Noah a écrit : >>If you have control over the API functions declarations, makes them so: >>def my_api_func(arg1='', arg2='whatever', **kwargs): >> code_here > > > Unfortunately I cannot change the API functions. > I should have mentioned that. Y

Re: when and how do you use Self?

2005-11-03 Thread bruno at modulix
Tieche Bruce A MSgt USMTM/AFD wrote: > I am new to python, > > > > Could someone explain (in English) how and when to use self? > Don't use self. Use other. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -

Re: how to write a blog system with Python

2005-11-03 Thread bruno at modulix
ice wrote: > I am a fresh here , and I have no idea of it. > Do you have any comments? > Learn Python Learn web programming Write the specs for your blog system Design the solution Implement it -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '

Re: when and how do you use Self?

2005-11-03 Thread bruno at modulix
Chris Cioffi wrote: as a point of style, top-posting is a Bad Thing(tm) (fixed) > > On 03/11/05, bruno at modulix <[EMAIL PROTECTED]> wrote: > >>Tieche Bruce A MSgt USMTM/AFD wrote: >> >>>I am new to python, >>> >>>Could someone explain

Re: when and how do you use Self?

2005-11-03 Thread bruno at modulix
Steven D'Aprano wrote: > On Thu, 03 Nov 2005 10:14:23 +0100, bruno at modulix wrote: > > >>Tieche Bruce A MSgt USMTM/AFD wrote: >> >>>I am new to python, >>> >>> >>> >>>Could someone explain (in English) how and when t

Re: I Need Motivation Part 2

2005-11-04 Thread bruno at modulix
[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, Why would you lear

Re: recursive function call

2005-11-08 Thread bruno at modulix
Nicolas Vigier wrote: > Hello, > > I have in my python script a function that look like this : > > def my_function(arg1, arg2, opt1=0, opt2=1, opt3=42): > if type(arg1) is ListType: How should it behave with tuples or subclasses of List ? Or if it's any other iterable ? Testing against

Re: which feature of python do you like most?

2005-11-08 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > which feature of python do you like most? > > I've heard from people that python is very useful. > Many people switch from perl to python because they like it more. > > I am quite familiar with perl, I've don't lots of code in perl. > Now, I was curious and interested i

Re: Diff. between Class types and classic classes

2005-11-08 Thread bruno at modulix
venk wrote: > Hi, > can some one properly explain the differences between class types and > classic classes? ... Still face problems in identifying what is what. I'm not sure I understand your question. Are you talking about the diff between old-style and new-style classes, or the diff between c

Re: Hi, from my login i want to login as a other user ,

2005-11-09 Thread bruno at modulix
sumi wrote: > Hi, from my login i want to login as a other user , how can i do it > using python. http://www.catb.org/~esr/faqs/smart-questions.html -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http:/

Re: append to non-existing list

2005-11-09 Thread bruno at modulix
Yves Glodt wrote: > Hello, > > if I do this: > > for row in sqlsth: > pkcolumns.append(row[0].strip()) > etc > > > without a prior: > > pkcolumns = []; > > > I get this error on first iteration: > UnboundLocalError: local variable 'pkcolums' referenced before assignment > >

Re: append to non-existing list

2005-11-09 Thread bruno at modulix
Yves Glodt wrote: (snip) > > ok I see your point, and python's... > > (just FYI, and not to start a flamewar ;-): > In php, the [] means "append to an array object". yes, I know this. > If the array does not exist yet, it's created. Which is what I don't like. It should crash. > [] *is* expli

Re: iterate over class variables

2005-11-10 Thread bruno at modulix
Yves Glodt wrote: > Yves Glodt wrote: > >> Hello list, >> >> I need to iterate over a class and get all her variable names and >> values, e.g. considering this example: >> >> >> class testclass: >> var1 = 'ab' >> var2 = 'cd' >> var3 = 'ef' Take care, these are *class* variables, not i

Re: getting results into one variable

2005-11-10 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > hi (snip) > > in python, can we do something like > > a = db.execute(stmt) and then expand variable 'a' > instead of doing > (a,b) = db.execute(stmt) for return of 2 > (a,b,c) = for return of 3 > (a,b,c,d) for return of 4 Did you try ?-) Took me about 30'': >>> def

Re: What do you use as symbols for Python ?

2005-11-10 Thread bruno at modulix
Pierre Barbier de Reuille wrote: > When you need some symbols in your program, what do you use in Python ? > > For example, an object get a state. This state is more readable if > expressed as a symbols, for example "opened", "closed", "error". > Typically, in C or C++, I would use an enum for tha

Re: derived / base class name conflicts

2005-11-11 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (snip) > So putting two underscores in front of an instance variable (or any > identifier used inside the scope of a class statement) invokes a name > mangling mechanism (snip) > Is it commonplace to use underscores I assume you mean double underscore... > when definin

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread bruno at modulix
Peter A. Schott wrote: > Per subject - I realize I can copy/paste a line at a time into an interactive > session when I'm trying to debug, but was wondering if there is any tool out > there that allows me to copy sections of working Python scripts to paste into > my > interactive console and let t

Re: Import statements for timeit module

2005-11-11 Thread bruno at modulix
ChaosKCW wrote: > Hi > > I was wondering if someone could help with the import statements needed > to use the timeit module in the following code. I need to access the > "cur" object. > > Thanks, > > import cx_Oracle > import timeit > > def VerifyTagIntegrity(con, TableOwner): > cur = con.c

Re: Nufox : Nouveaux examples...

2005-11-11 Thread bruno at modulix
Salvatore wrote: > Sur : http://www.salvatore.exolia.net:9090/ > (Nécessite Firefox ou Mozilla) > Heu, Salvatore, tu te serais pas un peu trompé de ng, là ?-) (x-post et fu2 f.c.l.py) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: Calling values from a webform to Python

2005-11-11 Thread bruno at modulix
mjakowlew wrote: > hi, > > I'm trying to pass some values from a webform into a python script. > (snip) > Also this > is done through Zope if that makes a difference to anyone. Yes, it makes a difference. Zope is a world in itself, and is slighty OT here. Note that there's a Zope mailing-list: h

Re: Import statements for timeit module

2005-11-11 Thread bruno at modulix
ChaosKCW wrote: > So timeit is mostly useless then ? > I wouldn't say so. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing multiple instances of commas beginning at specific position

2005-11-14 Thread bruno at modulix
striker wrote: > I have a comma delimited text file that has multiple instances of > multiple commas. Each file will contain approximatley 300 lines. For > example: > > one, two, threefour,fivesix > one, two, three,four,,eighteen, and so on. > > There is one time when multiple

Re: more newbie help needed

2005-11-15 Thread bruno at modulix
Steve Holden wrote: > john boy wrote: > >> using the following program: >> >> fruit = "banana" >> index = 0 >> while index < len (fruit): >> letter = fruit[index-1] >> print letter >> index= index -1 >> >> this program is supposed to spell "banana" backwards and in a vertical >

Re: Need advice on subclassing code

2005-11-15 Thread bruno at modulix
Rusty Shackleford wrote: > Hi -- > > We have some code that returns an object of a different class, depending > on some parameters. For example: > > if param x is 1 and y is 1, we make an object of class C_1_1. > if param x is 1 and y is 2, we make an object of class C_1_2. > > C_1_1 and C_1_2

Re: Default method arguments

2005-11-15 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hello everybody! > I have little problem: > > class A: > def __init__(self, n): > self.data = n > def f(self, x = ) > print x > > All I want is to make self.data the default argument for self.f(). (I > want to use 'A' class as following : >

Re: Default method arguments

2005-11-15 Thread bruno at modulix
Dennis Lee Bieber wrote: > > (snip) > but that may not be desirable if None is a valid value => myA.f(None), > so... > > class A(object): > def __init__(self, n): > self.data =n > def f(self, *arg): > if len(arg) == 0: > x = self.data > else: >

Re: HTML generation vs PSP vs Templating Engines

2005-11-16 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hello everybody, > > I am in the process of writing my very first web application in Python, > and I need a way to > generate dynamic HTML pages with data from a database. (snip) > After some thought I decided to leave the various frameworks > aside for the > time bein

Re: Python, Linux, Desktop Environment

2005-11-16 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > So, I've written my first GUI app in python. I've turned it into a > binary .exe and .app that runs on Windows and Mac respectively, but on > my Linux box, where I wrote the thing, I still have to drop to the > command line and ./myscript.py. What can I do to make it a

Re: Creating (rather) generic plugin framework?

2005-11-16 Thread bruno at modulix
Edvard Majakari wrote: > Hi, > > My idea is to create a system working as follows: each module knows > path to plugin directory, and that directory contains modules which > may add hooks to some points in the code. > > Inspired by http://www.python.org/pycon/2005/papers/7/pyconHooking.html > > I

Re: Zope vs Php

2005-11-18 Thread bruno at modulix
Steve wrote: > I am going to go the mod_python route. > > as for why a person would go route one over route 2 > > is that the number of lines of html/output vs python code are usually > 10 to 1 and it's much easier to encapsulate the python code than to > quote and escape all the html/css/xml >

Re: Zope vs Php

2005-11-18 Thread bruno at modulix
Mike Meyer wrote: > Jorge Godoy <[EMAIL PROTECTED]> writes: > >>Mike Meyer <[EMAIL PROTECTED]> writes: >> (snip) > > While I'm at it - how does KID do for things that aren't HTML? It doesn't. Kid is explicitely for XML/HTML templating. -- bruno desthuilliers python -c "print '@'.join(['.'.join

Re: the first element in the list of list

2005-11-22 Thread bruno at modulix
Ben Bush wrote: > I have a lis: > [[1,3],[3,4],[5,6],[8,9],[14,0],[15,8]] > I want a code Then write it. And when (if) you have problems with it, repost, we'll then be happy to help you. > to test when the difference between the first element in > the list of list is equal to or larger than 6,

Re: What a curious assignment.

2005-11-23 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > [test 1] > class A: > > ...i = 1 > ... > a = A() A.i > > 1 > a.i > > 1 > A.i = 2 A.i > > 2 > a.i > > 2 > > > [test2] > class A: > > ...i = 1 > ... > a = A() A.i > > 1 > a.i > > 1 > a.i = 2 A.i

Re: strange behaviour when writing a large amount of data on stdout

2005-11-23 Thread bruno at modulix
Manlio Perillo wrote: > Regards. > > On my system: > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] > on win32, Windows XP > > I have this problem: > > n = 61409 + 1 data = 'x' * n > > print data > > > Traceback (most recent call last): > File "xxx", lin

Re: user-defined operators: a very modest proposal

2005-11-23 Thread bruno at modulix
Joseph Garvin wrote: > Tom Anderson wrote: > >> Jeff Epler's proposal to use unicode operators would synergise most >> excellently with this, allowing python to finally reach, and even >> surpass, the level of expressiveness found in languages such as perl, >> APL and INTERCAL. s/expressiveness/u

Re: a new design pattern for Python Library?

2005-11-23 Thread bruno at modulix
Ben Sizer wrote: > The Eternal Squire wrote: > >>I tend to use this design pattern a lot in order to aid in >>compartmentalizing interchangeable features in a central class that >>depend on the central class's data. > > > I'm afraid I've read this paragraph and the code 3 times and I still > hav

Re: a new design pattern for Python Library?

2005-11-23 Thread bruno at modulix
Ben Sizer wrote: > bruno at modulix wrote: > >>Ben Sizer wrote: >> >>>I'm afraid I've read this paragraph and the code 3 times and I still >>>have no idea what you're trying to convey. >> >> > > > Got anything more

Re: books: Dive into Python vs Beginning Python

2005-11-25 Thread bruno at modulix
Franz Mueller wrote: > Hi, > > which of the following books would you recommend: > "Dive into Python" or "Beginning Python: From Novice to Professional"? I can't recommand the second since I've never read it. But you can freely make your own opinion on the first, since it's freely available onlin

Re: Web functions idea

2005-11-29 Thread bruno at modulix
Mark Carter wrote: > I was musing recently about how one could, for example, set up a really > simple mailing subscription list. It occurred to me that a really simple > way to implement it would be to use xmlrpc. > So there could be a function > subscribe(emailAddress), > which would send an email

Re: python speed

2005-11-30 Thread bruno at modulix
David Rasmussen wrote: > Frithiof Andreas Jensen wrote: > >> >> From the speed requirement: Is that correspondance chess by any chance?? >> > > Regular chess at tournament time controls requires speed too. Any pure > Python chess program would lose badly to the best C/C++ programs out > there now

Re: mmm-mode, python-mode and doctest-mode?

2005-12-01 Thread bruno at modulix
John J Lee wrote: > Is it possible to get doctest-mode to work with mmm-mode and python-mode > nicely so that docstrings containing doctests are editable in doctest-mode? I don't know. (snip) > > Any tips appreciated! > Seems like comp.emacs could be a good place for this question -- bru

Re: [OT] mmm-mode, python-mode and doctest-mode?

2005-12-01 Thread bruno at modulix
John J. Lee wrote: > bruno at modulix <[EMAIL PROTECTED]> writes: > > >>John J Lee wrote: >> >>>Is it possible to get doctest-mode to work with mmm-mode and python-mode >>>nicely so that docstrings containing doctests are editable in doctest-mode? &g

Re: Instances behaviour

2005-12-02 Thread bruno at modulix
Inyeol Lee wrote: (snip) class A(object): ... def __init__(self, foo): ... if self.__class__ is A: ... raise TypeError("A is base class.") s/TypeError/NotImplementedError/ s/base class/abstract class/ -- bruno desthuilliers python -c "pri

Re: Instances behaviour

2005-12-02 Thread bruno at modulix
Mr.Rech wrote: > Thanks for your suggestions. They are very usefull and indeed bypass my > problem. However, I've found a (perhaps) more elegant way to get the > same result using metaclasses. (snip code) > > I know metaclasses are a complete different beast, anyway I find this > approach more

Re: Putting in an html table

2005-12-05 Thread bruno at modulix
Little wrote: > Could someone start me on putting in a table into this code, and some > HTML tags. I would to make the table below the map and have a header at > the top. Thanks for the help. > > """ Publisher example """ > > def query(req, building=""): > # NOTE: best way to understand this

Re: ADD HTML to the code

2005-12-05 Thread bruno at modulix
Little wrote: > Could someone tell me how to add some HTML tags to this program. I want > to be able to change the background color, add some headers, and put a > table below the map that will be displayed. Could someone please tell > me how to add this to the current program. Thanks in advance. >

Re: Efficient lookup in list of dictionaries

2005-12-05 Thread bruno at modulix
David Pratt wrote: (snip) > Can someone advise a more efficient lookup when using lists of > dictionaries. Many thanks. > > > TEST_CONSTANTS = [ > {'color':'red', 'shape':'octagon'}, > {'color':'yellow', 'shape':'triangle'}, > {'color':'green', 'shape':'circle'}] COLOR_INDEX = dict([

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread bruno at modulix
Gary Herron wrote: > Mohammad Jeffry wrote: > >> Dear All, >> >> Can't a lambda uses the input parameter more then once in the lambda >> body? >> eg: >> lambda x : print x/60,x%60 >> >> I tried with def and it works but got syntax error with lambda. Below >> is an interactive sample: > > > Lambd

Re: dynamic variable referencing

2005-12-07 Thread bruno at modulix
Michael Williams wrote: > I would RTM, but I'm not sure exactly what to look for. Basically, I > need to be able to call a variable dynamically. Meaning something like > the following: > > - I don't want to say OBJECT.VAR but rather > OBJECT. ("string") and have

Re: Mutability of function arguments?

2005-12-08 Thread bruno at modulix
ex_ottoyuhr wrote: > I'm trying to create a function that can take arguments, say, foo and > bar, and modify the original copies of foo and bar as well as its local > versions -- the equivalent of C++ funct(&foo, &bar). This is already what you have. In Python, all you have are references to objec

Re: OO in Python? ^^

2005-12-12 Thread bruno at modulix
Mike Meyer wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>> ^^ There is no functionality to check if a subclass correctly >>>implements an inherited interface >> >>I don't know of any language that provide such a thing. At least for >>my definition of "correctly". > > > Well, since

Re: Proposal: Inline Import

2005-12-12 Thread bruno at modulix
Mike Meyer wrote: > Shane Hathaway <[EMAIL PROTECTED]> writes: > (snip) > >>What's really got me down is the level of effort required to move code >>between modules. After I cut 100 lines from a 500 line module and >>paste them to a different 500 line module, I have to examine every >>import in

Re: Get rid of recursive call __getattr__

2005-12-14 Thread bruno at modulix
Pelmen wrote: > How can I get rid of recursive call __getattr__ inside this method, if > i need to use method or property of the class? > Sorry, but I don't understand your question. Which recursive calls to __getattr__ ? __getattr__ is only called if a/ it's defined and b/ the attribute has not b

Re: Get rid of recursive call __getattr__

2005-12-15 Thread bruno at modulix
Steve Holden wrote: > Peter Otten wrote: > >> Pelmen wrote: >> >> >> class Test: >>> >>> >>> def __getattr__(self, attr): >>>print attr >>> >>> def foo(x): >>>print x >>> >>> >> t = Test() >> print t >>> >>> >>> __str__ >>> >>> Traceback (most

Re: RoR like (was : SPE 0.8.1.b Python IDE...)

2005-12-15 Thread bruno at modulix
Yechezkal Gutfreund wrote: > Are you familiar with any Python efforts that parrallel Ruby on Rails > (integrated Ajax compliant IDE?). "integrated" and "IDE" in the same sentence ? A bit redundant, isn't it ?-) RoR is not an IDE, it's a web framework. The closest things in Python are TurboGears (

Re: Tuples

2005-12-15 Thread bruno at modulix
Tuvas wrote: > Let's say I make a program something like follows: > > x=[] > x.append([1,2,3]) > x.append([4,5,6]) > print x > print x[0] > print x[0][1] > x[0][1]=5 Where are the tuples ? > Okay, everything works here as expected except the last line. Why won't > this work? Because you forgot

Re: definition of 'polymorphism' and python

2005-12-15 Thread bruno at modulix
Gabriel Zachmann wrote: > I understand the Wikipedia article on Polymorphism > ( http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29 ) > that it doesn't make sense to talk about polymorphism in a fully > dynamically typed language "a single polymorphic operator can act in expressions

Re: RoR like (was : SPE 0.8.1.b Python IDE...)

2005-12-16 Thread bruno at modulix
Adrian Holovaty wrote: > bruno at modulix wrote: > >>RoR is not an IDE, it's a web framework. The closest things in Python >>are TurboGears (good Ajax/js support via Mochikit), Subway (never >>tested), and Django (no Ajax support AFAIK). > > > Note th

Re: Template language with XPath support for source code generation?

2006-01-12 Thread bruno at modulix
Stefan Behnel wrote: > Hi! > > I need to generate source code (mainly Java) from a domain specific XML > language, preferably from within a Python environment (since that's where the > XML is generated). > > I tried using XSLT, but I found that I need a template system that supports > Python inte

Re: Help me in this please--is Python the answer?

2006-01-12 Thread bruno at modulix
Ray wrote: (snip) > But then on the other hand, there is a manpower problem--it's damn easy > to find a Java programmer (although the quality that you get is a > different matter). Python programmers are more difficult. Possibly - but if a programmer is not able to pick on Python in a matter of d

Re: how do "real" python programmers work?

2006-01-13 Thread bruno at modulix
Barbier de Reuille Pierre wrote: > On 12 Jan 2006 12:20:50 -0800 > "bblais" <[EMAIL PROTECTED]> wrote: > > >>Hello, >> (snip) > > > Well, I think it will depend on your project ... > If you're developing GUI application, you will have trouble using the > python shell. At least you will need a s

Re: how do "real" python programmers work?

2006-01-13 Thread bruno at modulix
bblais wrote: > Hello, > (snip) > > In C++, I open up an editor in one window, a Unix shell in another. (snip) > In Matlab, I do much the same thing, except there is no compile phase. (snip) > In Python, there seems to be a couple ways of doing things. I could > write it in one window, and fro

Re: [OT] how do "real" python programmers work?

2006-01-13 Thread bruno at modulix
Mike Meyer wrote: (snip) > Maybe > some of the people who IDEs (instead of - well, we need a term for > development environment built out of Unix tools) "Extegrated Development environment" ?-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p

Re: Web application design question (long)

2006-01-17 Thread bruno at modulix
Fried Egg wrote: > I must not express myself very clearly. > > I don't need any help with the disassociated text algorithm. What I > need is a framework for data processing web apps, If that's your main need, and you want to use a RDBMS, then you may want to have a look at turbogears http://turb

Re: TIming

2006-05-30 Thread bruno at modulix
WIdgeteye wrote: > HI, > I am trying to write a little program that will run a program on > scedule. There are usually existing programs to do so on most platforms (cron on *n*x, the Windows scheduler, etc). -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('

Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional

2006-05-30 Thread bruno at modulix
Moneyhere wrote: > Good :) > Can someone provide this ebook? . > I'm looking forwards it. > http://www.amazon.com/gp/product/0130410659/002-1715230-0496030?v=glance&n=283155 -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.

Re: Best Python Editor

2006-05-31 Thread bruno at modulix
Manoj Kumar P wrote: > Hi, > > Can anyone tell me a good python editor/IDE? > It would be great if you can provide the download link also. I hate to be the one answering this, but this is *really* a FAQ - as you would have known if you had google'd this group for this. -- bruno desthuilliers py

Re: How do you practice Python?

2006-06-01 Thread bruno at modulix
Ray wrote: > In our field, we don't always get to program in the language we'd like > to program. So... how do you practice Python in this case? Say you're > doing J2EE right now. Hopefully not ! > How do you practice Python to keep your skills > sharp? How *would* I do ? Well, perhaps I'd use J

Re: How do you practice programming?

2006-06-01 Thread bruno at modulix
Ray wrote: > OK, maybe I shoot a more general question to the group since there are > so many great programmers here: how do you practice your craft? I'm certainly not one of them, but... (snip) > How do you do your practice? > 1/ programming 2/ programming 3/ lurking here, reading posts and so

Re: Best way to do data source abstraction

2006-06-01 Thread bruno at modulix
Arthur Pemberton wrote: > What is the best way to do data source abtraction? For example have > different classes with the same interface, but different > implementations. > > I was thinking of almost having classA as my main class, and have > classA dynamically "absorb" classFood into to based on

Re: How do you practice Python?

2006-06-01 Thread bruno at modulix
Ray wrote: > bruno at modulix wrote: > >>>In our field, we don't always get to program in the language we'd like >>>to program. So... how do you practice Python in this case? Say you're >>>doing J2EE right now. >> >>Hopefully not ! >

Re: How do you practice programming?

2006-06-01 Thread bruno at modulix
Ray wrote: > bruno at modulix wrote: > >>1/ programming >>2/ programming >>3/ lurking here, reading posts and sometimes trying to answer, reading >>source code of the oss apps/frameworks I'm working with, searching >>practical solutions in the cookbo

Re: Function mistaken for a method

2006-06-01 Thread bruno at modulix
Peter Otten wrote: > Eric Brunel wrote: > > >>My actual question is: why does it work in one case and not in the other? >>As I see it, int is just a function with one parameter, and the lambda is >>just another one. So why does the first work, and not the second? What >>'black magic' takes place

Re: Function mistaken for a method

2006-06-01 Thread bruno at modulix
Eric Brunel wrote: > Hi all, > > I just stepped on a thing that I can't explain. Here is some code > showing the problem: > > - > class C: Do yourself a favour : use new-style classes. class C(object) > f = None > def __init__(self): > if self.f is not None:

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread bruno at modulix
A.M wrote: > Hi, > > > > I am using Python 2.4. I read the PEP 308 at: > > http://www.python.org/dev/peps/pep-0308/ > > I tried the statement: > > a= "Yes" if 1==1 else "No" > > but the interpreter doesn't accept it. > > Do we have the conditional expressions in Python 2.4? No, AFAIK they'

Re: Inheritance structure less important in dynamic languages?

2006-06-02 Thread bruno at modulix
Marvin wrote: > Hi, > > It's been claimed s/claimed/observed/ In Python and Ruby, class hierarchies tends to be *really* flat when compared to Java or C++. > that inheritance structures are less important in dynamic > languages like Python. Why is that Don't you guess ?-) A very obvious poin

Re: how to define a static field of a given class

2006-06-02 Thread bruno at modulix
feel_energetic wrote: > Hi, > > I already knew how to define a static method of a class( using > staticmethod() ), FWIW, it's probably one of the most useless construct in Python IMHO. classmethod are really much more useful to me. > but I find there isn't a built-in func to build a > static

Re: Package

2006-06-02 Thread bruno at modulix
Matthieu Pichaud wrote: > I have a problem organizing my programs in packages and subpackages. > > I use python.2.3.3 > I built a test structure to try to understand how it worked: > > /test > /test/__init__.py(containing: __all__=['test1']) > /test/test1/ > /test/test1/__init__.py(contai

Re: Writing to a certain line?

2006-06-06 Thread bruno at modulix
Tommy B wrote: > I was wondering if there was a way to take a txt file and, while > keeping most of it, replace only one line. This is a FAQ (while I don't know if it's in the FAQ !-), and is in no way a Python problem. FWIW, this is also CS101... You can't do this in place with a text file (wo

Re: the most efficient method of adding elements to the list

2006-06-06 Thread bruno at modulix
alf wrote: > Hi, > > Would it be .append()? Does it reallocate te list with each apend? > > l=[] > for i in xrange(n): > l.append(i) > FWIW, you'd have the same result with: l = range(n) More seriously (and in addition to other anwsers): you can also construct a list in one path: l

Re: check for dictionary keys

2006-06-06 Thread bruno at modulix
John Machin wrote: > On 5/06/2006 10:46 PM, Bruno Desthuilliers wrote: > >> [EMAIL PROTECTED] a écrit : >> >>> hi >>> in my code, i use dict(a) to make to "a" into a dictionary , "a" comes >>> from user input, so my program does not know in the first place. Then >>> say , it becomes >>> >>> a = {

Re: Writing to a certain line?

2006-06-06 Thread bruno at modulix
Rene Pijlman wrote: > bruno at modulix: > >>You can't do this in place with a text file (would be possible with a >>fixed-length binary format). > > > More precise: it's possible with any fixed-length change, in both binary > and text files, with both fix

Re: what are you using python language for?

2006-06-06 Thread bruno at modulix
hacker1017 wrote: > im just asking out of curiosity. > Err... Programming ?-) Sorry... Actually, mostly web applications (CMS, groupware, small/medium business apps etc), and admin utilities. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in

Re: Writing to a certain line?

2006-06-07 Thread bruno at modulix
Tommy B wrote: > bruno at modulix wrote: (snip) >>import os >>old = open("/path/to/file.txt", "r") >>new = open("/path/to/new.txt", "w") >>for line in old: >> if line.strip() == "Bob 62" >>line = line.

Re: Writing to a certain line?

2006-06-07 Thread bruno at modulix
Christophe wrote: > bruno at modulix a écrit : (snip) >> Wrong guess - unless, as Fredrik suggested, you have an infinite disk >> with an infinite file on it. If so, please share with, we would be >> *very* interested !-) > > > Use /dev/zero as source and /d

Re: creating and naming objects

2006-06-07 Thread bruno at modulix
Brian wrote: > Thank you all for your response. I think that I am getting it. Based > on those responses, would I be correct in thinking that this would be > the way to initialize my Student object and return the values? > > class Student: Do yourself a favour: use new-style classes class Stud

Re: [0T]Use of Python in .NET

2006-06-07 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hi, > I am developing a code which has MVC (Model - View - Controler) > architecture.My view is in .NET. And my controller is in Python.So can > i call Python script from .NET? This is a question that I would have asked myself before actually trying to do anything el

Re: language-x-isms

2006-06-08 Thread bruno at modulix
Bryan wrote: > does anyone know if there is a collection somewhere of common python > mistakes or inefficiencies or unpythonic code that java developers make > when first starting out writing python code? Try googling for "python is not java" !-) -- bruno desthuilliers python -c "print '@'.joi

Re: Instead of saving text files i need as html

2006-06-08 Thread bruno at modulix
Shani wrote: > I have the following code which takes a list of urls > "http://google.com";, without the quotes ofcourse, and then saves there > source code as a text file. I wan to alter the code so that for the > list of URLs an html file is saved. What you write in a text file is up to you - an

Re: follow-up to FieldStorage

2006-06-08 Thread bruno at modulix
Tim Roberts wrote: > John Salerno <[EMAIL PROTECTED]> wrote: > > >>Bruno Desthuilliers wrote: >> >>>John Salerno a écrit : >>> If I want to get all the values that are entered into an HTML form and write them to a file, is there some way to handle them all at the same time, or must

Re: dynamic inheritance

2006-06-09 Thread bruno at modulix
alf wrote: > is there any way to tell the class the base class during runtime? > Technically, yes - the solution depending on your definition of "during runtime" FWIW, the class statement is evaled at import/load time, which is "during runtime" So if you want to use one or other (compatible)

Re: Error in Chain of Function calls

2006-06-09 Thread bruno at modulix
Girish Sahani wrote: > Hi, > > There is a code in my main function which is something like: > > while prunedFinal != []: > prunedNew = genColocations(prunedK) *** > tableInstancesNew = genTableInstances(prunedNew,tableInstancesK) > tiCountDict = tiCount

Re: what are you using python language for?

2006-06-09 Thread bruno at modulix
baalbek wrote: > To score with the chicks! > > A Python script roams the nightclubs for beautiful women, finds an > appropriate woman based on my preferances, charms her with its sleek > Pythonic manners, calls for a cab and brings the lady to my recidency. > > Works like a charm! Is that OSS ?-

Re: Error in Chain of Function calls

2006-06-09 Thread bruno at modulix
Girish Sahani wrote: >>Girish Sahani wrote: >> >> >>>However i am getting an error at the line marked with ***. >> >>what error ? > > ...line 266, in colocationMiner Great. We now know at which line of an unknown file an unknown error happens. Will use my PythonPsychicPowers(tm) now to see waht's

Re: removing dictionary key-pair

2006-06-09 Thread bruno at modulix
JD wrote: > Hello, > > I try to remove a dictionary key-pair (remove an entry), > but I'm unsuccessful. Does anyone know how to achieve this? > > Thanks mydict = {"key" : "value"} del mydict(key) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p

  1   2   3   4   5   6   >