Re: A friendlier, sugarier lambda -- a proposal for Ruby-like blocks in python

2006-10-16 Thread Bruno Desthuilliers
Kay Schluehr wrote: > Bruno Desthuilliers wrote: > >> Just for the record : Ruby's code-blocks (closures, really) come from >> Smalltalk, which is still the OneTrueObjectLanguage(tm). > > IsTheOneTrueObjectLanguage(tm)ReallyCame

Re: python's OOP question

2006-10-17 Thread Bruno Desthuilliers
Given Python's support for both multiple inheritance and composition/delegation, it's usually a trivial task (unless you already mixed up too many orthogonal concerns in your base class...). -- 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: Book about database application development?

2006-10-17 Thread Bruno Desthuilliers
g thru the result set just to count the number of records in the table (don't laugh, I've actually seens this (and even worse) in production code). But given your concerns, I don't think you'd do such a thing anyway !-) -- 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: Looking for assignement operator

2006-10-17 Thread Bruno Desthuilliers
uld probably be better indeed: class MyInt(object): def __init__(self, val): self.val = int(val) My 2 cents -- 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: Looking for assignement operator

2006-10-17 Thread Bruno Desthuilliers
MyClass(42) m => <__main__.MyClass object at 0x2ae5eaa00410> m.val => 42 m = 42 m => 42 type(m) => -- 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: Tertiary Operation

2006-10-17 Thread Bruno Desthuilliers
se == 0 and True == 1. NB : if you don't want to eval both terms before (which is how it should be with a real ternanry operator), you can rewrite it like this: result = (str, lambda obj:"")[x is None)(x) But this begins to be unreadable enough to be replaced by a good old if/else... -- 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: Looking for assignement operator

2006-10-17 Thread Bruno Desthuilliers
l def setval(self, val): assert(isinstance(val, int)) self._val = val _val = property(self.getval, self.setval) And here's the result: Traceback (most recent call last): File "", line 1, in ? File "/usr/tmp/python-30955cPK.py", line 1, in

Re: A question about list

2006-10-17 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hello: > Variable 'a' has the next values: > [[1,1],[2,2]] > and I want to take a to b as: > [[1,1,'='],[2,2,'=']] > How can I do this with only one line of instruction? b = [item + ['='] for item in a] --

Re: Looking for assignement operator

2006-10-17 Thread Bruno Desthuilliers
getting my brain. Is there > anything else wrong with my code? You mean something I didn't cover in my 2 previous posts ? -- 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: Looking for assignement operator

2006-10-18 Thread Bruno Desthuilliers
tance(val, int)) >> self._val = val >> >> a = MyInt(10) >> >> # Here i need to overwrite the assignement operator >> a = 12 >> > Could the "traits" package be of help? > > http://code.enthought.com/traits/ > How could it help ?

Re: Classes and Functions - General Questions

2006-10-18 Thread Bruno Desthuilliers
Setash a écrit : > I've got a tiny bit of coding background, but its not the most > extensive. > > That said, I'm trying to wrap my head around python and have a couple > questions with classes and functions. > > Two notable questions: > > 1) Classes. How do you extend classes? > > I know its a

Re: proper format for this database table

2006-10-19 Thread Bruno Desthuilliers
John Salerno a écrit : > Hi guys. I was wondering if someone could suggest some possible > structures for an "Education" table in a database. Wrong newsgroup, then. comp.database.* is right next door... -- http://mail.python.org/mailman/listinfo/python-list

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
or, Quote FROM PythonQuoteQuery WHERE ID=?", quote_number ) return c.fetchone() def format_quote(self, quote): # code here return formatted_quote def close(self): try: self._cnx.close() except: pass def main(*args): if len(args) < 2: print >> sys

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
and displays it using textwrap. > """ > c = Connection('DSN=Quotations') > c.execute ("SELECT COUNT(Quote) FROM PythonQuoteQuery") And this will raise an AttributeError, since your (mostly useless) Connection class doesn't define an 'execu

Re: Why the result

2006-10-20 Thread Bruno Desthuilliers
his object behaving somehow like a C 'static' local variable, ie it keeps it value from call to call. The canonical idiom is to use None instead: class PicInfo(object): def __init__(self, intro="", tags="", comments=None): self.picintro = intro self.pictags

Re: Webprogr: Link with automatic submit

2006-10-20 Thread Bruno Desthuilliers
*not* supposed to issue (even if indirectly) a POST request. -- 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: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > Bruno Desthuilliers wrote: > >> First, notice that you *don't* need a class here to avoid globals. >> Learning to use function as *functions* (ie: taking arguments and >> returning values) instead of procedure would help: >> >>

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
lltalk (which is still the reference IMHO). And it's (it->OO) more an evolution/systematisation of concepts that already existed before... FWIW, I don't know if there's any truly Python-specific concept in Python (except perhaps for the descriptor protocol, which is a somewhat advanced to

Re: why does this unpacking work

2006-10-21 Thread Bruno Desthuilliers
John Salerno a écrit : > [EMAIL PROTECTED] wrote: > >> It's just sequence unpacking. Did you know that this works?: >> >> pair = ("California","San Francisco") >> state, city = pair >> print city >> # 'San Francisco' >> print state >> # 'California' > > > Yes, I understand that. What confused m

Re: silent processing with python+modpython+cheetah

2006-10-21 Thread Bruno Desthuilliers
Sai Krishna M a écrit : > Hi, > > I have been working for some time developing web pages using python, > modpython, cheetah. > I find that this method has come inherent difficulties in it like if > we want to generate a single page we have to write two separate files > ( py & tmpl). > Is there any

Re: Inheriting property functions

2006-10-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > The trouble is that get_a and set_a are attributes of the _class > object_ A. Instances of A (and hence, instances of B) will see them, > but the class B will not, Yes it does: >>> class A(object): ... aa = "aa" ... >>> class B(A):pass ... >>> B.aa 'aa

Re: Decorators and how they relate to Python - A little insight please!

2006-10-21 Thread Bruno Desthuilliers
Jerry a écrit : > Thanks to everyone that resonded. I will have to spend some time > reading the information that you've provided. > > To Fredrik, unfortunately yes. I saw the examples, but couldn't get my > head wrapped around their purpose. Perhaps it's due to the fact that > my only experien

Re: Python and CMS

2006-10-22 Thread Bruno Desthuilliers
Echo a écrit : (snip) > As for working with WSGI, I have found > Colubrid(http://wsgiarea.pocoo.org/colubrid/) and > Paste(http://pythonpaste.org/). I was wondering if anyone knew of any > other libraries that make working with WSGI easier. Pylons (www.pylonshq.com). It's a rail-like framework ba

Re: Debugging

2006-10-23 Thread Bruno Desthuilliers
imed saw nothing about this one... but perhaps with > and > camparison conditions. """ condition bpnumber [condition] Condition is an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is rem

Re: HTML Templates (Sitemesh/Tiles concept) in Python

2006-10-23 Thread Bruno Desthuilliers
r to do server-side-includes-like inclusion of common parts. Google for Genshi, Jinja, SimpleTAL, Mighty, Cheetah... > Any other tips to help life easier are appreciated. Have you considered using one of the existing python web development libraries/frameworks? Like Pylons, Turbogears, Django, Spy

Re: pretty basic instantiation question

2006-10-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Why do you need to know the number of instances. I know that Python > does not support Class Variable, Plain wrong. class Class(object): classvar = ["w", "t", "f"] print Class.classvar c = Class() c.classvar.append("???&quo

Re: pytho servlet engine

2006-10-24 Thread Bruno Desthuilliers
makerjoe wrote: > hi, all > i would like to know which is the best PSE "best" according to what metrics ? > i have to choose to use > servlets with mod_python in my HRYDROGEN project > (http://makerjoe.sytes.net/pycrud/query.psp) -- bruno desthuilliers python -c &qu

Re: http call.

2006-10-24 Thread Bruno Desthuilliers
will i need to make a http call to the > php application? > The fact that it's a PHP (or Java or Python or .NET or whatever) application is totally orthogonal as long as you're using HTTP. And you may want to have a look at the urllib and urllib2 modules in the standard lib

Re: can't open word document after string replacements

2006-10-24 Thread Bruno Desthuilliers
counter += 1 seq = list("abcd") for indice, item in enumerate(seq): print "%02d : %s" % (indice, item) > except: > docout.write(line.replace('ABCDEF', '', 1)) > else: > docout.write(line) > > doc.close() > docout.close() > -- 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

[OT] Re: can't open word document after string replacements

2006-10-24 Thread Bruno Desthuilliers
Antoine De Groote wrote: > Bruno Desthuilliers wrote: >> Antoine De Groote wrote: >>> Hi there, >>> >>> I have a word document containing pictures and text. This documents >>> holds several 'ABCDEF' strings which serve as a placeholder for

Re: forcing a definition to be called on attribute change

2006-10-24 Thread Bruno Desthuilliers
f._my_attr def _set_my_attr(self, val): self._my_attr = val self.runThisFunctionWhenMyAttrChanged() my_attr = property(_get_my_attr, _set_my_attr) HTH -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')])

Re: A py2exe like tool for Linux

2006-10-24 Thread Bruno Desthuilliers
nload one file, and not several > libraries. Then google for easy_install + "python-eggs". -- 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: return same type of object

2006-10-24 Thread Bruno Desthuilliers
type(pr2) class Virtual(object): def create(self): return self.__class__() class VirtualChild(Virtual): pass vc1 = VirtualChild() vc2 = vc1.create() print "vc2 is a ", type(vc2) My 2 cents... -- bruno desthuilliers python -c "print '@'.join([

Re: Debugging

2006-10-24 Thread Bruno Desthuilliers
Fulvio a écrit : > > On Monday 23 October 2006 19:10, Bruno Desthuilliers wrote: > > >>condition bpnumber [condition] >> >>Condition is an expression which must evaluate to true before the >>breakpoint is honored. If condition is absent, any existi

Re: forcing a definition to be called on attribute change

2006-10-24 Thread Bruno Desthuilliers
Rob Williscroft a écrit : > Bruno Desthuilliers wrote in news:[EMAIL PROTECTED] in > comp.lang.python: > > >>>class cSphere() : >> >>OT : prefixing classes names with 'c' is totally unpythonic. > > > My understanding of "pythonic"

Re: return same type of object

2006-10-24 Thread Bruno Desthuilliers
David Isaac a écrit : > Bruno wrote: > >>This is usually known as a 'factory method'. You do realise that both > > solutions are *not* strictky equilavent, do you? > > Your point I believe is that after inheritance the factory method > in the subclass will still > return MyClass() > but will ret

[0T] Re: Simple python + html + from --> to python script

2006-10-24 Thread Bruno Desthuilliers
flit a écrit : > Hello All, > > I am trying to get information from a form and send it to a python > script without success.. > Here is my objective: > > User enters data in form --> form send variables to python script --> > script runs and output result. If the script has side-effects (adding

Re: strange problem

2006-10-24 Thread Bruno Desthuilliers
ken a écrit : > This file has 1,000,000+ lines in it, yet when I print the counter 'cin' > at EOF I get around 10,000 less lines. Any ideas? Not without seeing the file. But I'm not sure I want to see it !-) >lineIn = > csv.reader(file("rits_feed\\rits_feed_US.csv",'rb'),delimiter='|') >

Re: Sending Dictionary via Network

2006-10-24 Thread Bruno Desthuilliers
mumebuhi a écrit : > Hi, > > Is it possible to send a non-string object from a Python program to > another? I particularly need to send a dictionary over to the other > program. However, this is not possible using the socket object's send() > function. > > Help? >>> d = dict(one=1, two="three",

Re: Ctypes Error: Why can't it find the DLL.

2006-10-24 Thread Bruno Desthuilliers
Mudcat a écrit : > Hi, > > I can't figure out why ctypes won't load the DLL I need to use. I've > tried everything I can find (and the ctypes website is down at the > moment). Here's what I've seen so far. > > I've added the file arapi51.dll to the system32 directory. However > when I tried to a

Re: return same type of object

2006-10-25 Thread Bruno Desthuilliers
Steve Holden wrote: > Bruno Desthuilliers wrote: >> David Isaac a écrit : > [...] >> >>> But Steve suggests going with the latter. >> >> >> That's what I'd do too a priori. >> > Believe it or not, I wasn't at the priory whe

Re: Looking for assignement operator

2006-10-25 Thread Bruno Desthuilliers
Tommi wrote: > Bruno Desthuilliers wrote: > (about Traits) > >> How could it help ? > > To me they just looked a bit alike: > > --- op's example --- > a = MyInt(10) > # Here i need to overwrite the assignement operator > a = 12 > > --- traits&#

Re: [0T] Re: Simple python + html + from --> to python script

2006-10-25 Thread Bruno Desthuilliers
Bruno Desthuilliers wrote: (snip) > (snip) > Also, the "button" tag doesn't require a end tag. oops ! Sorry, your syntax was ok - button elements actually requires the end tag. my bad :( -- bruno desthuilliers python -c "print '@'.join(['.'.

Re: To remove some lines from a file

2006-10-25 Thread Bruno Desthuilliers
is also appreciated on that. import sys print sys.argv -- 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: class method question

2006-10-25 Thread Bruno Desthuilliers
oing the same", you're doing something that *looks* the same. While they look quite similar at first sight - and indeed share a lot of characteristics (lightweight, highly dynamic, hi-level object languages) -, Python and Ruby are very different beasts under the hood. So bewa

Re: cleaner way to write this?

2006-10-25 Thread Bruno Desthuilliers
John Salerno a écrit : > Paul Rubin wrote: > >> John Salerno <[EMAIL PROTECTED]> writes: >> >>> I just need some advice for how to structure >>> the check of the empty string. >> >> >> How about >> >> return db_name or None >> >> since the empty string taken as a boolean is False. > > > But

Re: What's the best IDE?

2006-10-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Recently I've had some problems with PythonWin when I switched to > Py2.5, tooka long hiatus, and came back. So now I'm without my god sent > helper, and I'm looking for a cool replacement, or some advocation to > reinstall/setup PyWin. But the Python website's list is

Re: Error to be resolved

2006-10-26 Thread Bruno Desthuilliers
thonwin\pywin\framework\scriptutils.py", > line 310, in RunScript > exec codeObject in __main__.__dict__ > File "D:\A2_3.1.py", line 32, in ? > main() > File "D:\A2_3.1.py", line 30, in main > print c > File "D:\A2_3.1.py", line

Re: doesnt seems to work can any help be provided

2006-10-26 Thread Bruno Desthuilliers
Please take a few minutes to read this: http://catb.org/esr/faqs/smart-questions.html with particular attention to the following point: http://catb.org/esr/faqs/smart-questions.html#beprecise HTH -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w

Re: Search & Replace

2006-10-26 Thread Bruno Desthuilliers
DataSmash a écrit : > Hello, > I need to search and replace 4 words in a text file. > Below is my attempt at it, but this code appends > a copy of the text file within itself 4 times. > Can someone help me out. > Thanks! > > # Search & Replace > file = open("text.txt", "r") NB : avoid using 'file'

Re: conditional computation

2006-10-26 Thread Bruno Desthuilliers
robert a écrit : (snip) > class MemoCache(dict): # cache expensive Objects during a session > (memory only) >def memo(self, k, f): >try: return self[k] >except IndexError: >return self.setdefault(k, f()) > cache=MemoCache() > ... > > o = cache.memo( complex-key-exp

Re: conditional computation

2006-10-27 Thread Bruno Desthuilliers
robert wrote: > Bruno Desthuilliers wrote: >> robert a écrit : >> (snip) >>> class MemoCache(dict): # cache expensive Objects during a session >>> (memory only) >>>def memo(self, k, f): >>>try: return self[k] >>&

Re: conditional computation

2006-10-27 Thread Bruno Desthuilliers
robert wrote: > Bruno Desthuilliers wrote: >> robert wrote: >>> Bruno Desthuilliers wrote: >>>> robert a écrit : >>>> (snip) >>>>> class MemoCache(dict): # cache expensive Objects during a session >>>>> (mem

Re: Optional Parameter Requirements

2006-10-30 Thread Bruno Desthuilliers
gt; > def myfunc(a, b, *tup): > ... > > and be done with it? Yes. -- 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: Import if condition is correct

2006-10-30 Thread Bruno Desthuilliers
MindClass wrote: > Is possible import a library according to a condition? > > if Foo = True: > import bar > Did you even try ? Would have been faster than posting here... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p

Re: stripping parts of elements in a list

2006-10-30 Thread Bruno Desthuilliers
t; print map(str.lstrip, mylist) print "with list comprehension :" print [line.lstrip() for line in mylist] print "with a for loop :" strippedlist = [] for line in mylist: strippedlist.append(line.lstrip()) print strippedlist > Is there a way this can be done?? Probably. Rea

Re: Cann't connect zope server

2006-10-31 Thread Bruno Desthuilliers
fective-user directive in > zope.conf) And this has absolutely nothing to do with Python. -- 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: Why can't you assign to a list in a loop without enumerate?

2006-10-31 Thread Bruno Desthuilliers
#x27;, '__invert__', '__long__', '__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__', '__oct__', '__or__', '__pos__', '__pow__', '__radd__', '_

Re: Ctypes Error: Why can't it find the DLL.

2006-10-31 Thread Bruno Desthuilliers
Mudcat a écrit : > That was it. Once I added the other DLLs then it was able to find and > make the call. > > Thanks for all the help, I just googled for "WindowsError: [Errno 126]" and followed the links, you know... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 123 introduction

2006-10-31 Thread Bruno Desthuilliers
Jeremy Sanders a écrit : > Here is a brief simple introduction to Python I wrote for a computing course > for graduate astronomers. It assumes some programming experience. Although > it is not a complete guide, I believe this could be a useful document for > other groups to learn Python, so I'm mak

Re: scared about refrences...

2006-10-31 Thread Bruno Desthuilliers
Nick Vatamaniuc a écrit : (snip) > In Python all the primitives are copied and all other entities are > references. Plain wrong. There's no "primitives" (ie : primitive data types) in Python, only objects. And they all get passed the same way. -- http://mail.python.org/mailman/listinfo/python-l

Re: scared about refrences...

2006-11-02 Thread Bruno Desthuilliers
SpreadTooThin a écrit : > Bruno Desthuilliers wrote: > >>Nick Vatamaniuc a écrit : >>(snip) >> >>>In Python all the primitives are copied and all other entities are >>>references. >> >>Plain wrong. There's no "primitives" (i

Re: is mod_python borked?

2006-11-02 Thread Bruno Desthuilliers
Michael S a écrit : > I used it for various projects. It's alright. > The only problem I had, was that I was unable to get > mod_python and pysqlite to work together. Seems there's a strange bug with pysqlite when you have both mod_python/pysqlite and php5... -- http://mail.python.org/mailman/li

Re: Creating db front end or middleware.

2006-11-06 Thread Bruno Desthuilliers
cast description of the interface? As the name implies, W(eb) S(ervice) D(escription) L(anguage) is meant to describe a given web service - and says nothing about implementation. My 2 cents -- 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: object data member dumper?

2006-11-07 Thread Bruno Desthuilliers
tom arnall a écrit : > does anyone know of a utility to do a recursive dump of object data members? > What are "object data members" ? (hint: in Python, everything is an object - even functions and methods). What is your real use case ? -- http://mail.python.org/mailman/listinfo/python-list

Re: object data member dumper?

2006-11-08 Thread Bruno Desthuilliers
tom arnall wrote: > Bruno Desthuilliers wrote: > >> tom arnall a écrit : >>> does anyone know of a utility to do a recursive dump of object data >>> members? >>> >> What are "object data members" ? (hint: in Python, everything is an >>

Re: is this the right way to do subclasses?

2006-11-08 Thread Bruno Desthuilliers
John Salerno a écrit : > Ok, back to my so-called "game." I'm just curious if I've implemented > the subclasses properly, because it seems like an awful lot of > repetition with the parameters. And again, if I want to add a new > attribute later, I'd have to change a lot of things. I can't help

Re: is this the right way to do subclasses?

2006-11-08 Thread Bruno Desthuilliers
John Salerno a écrit : > Peter Otten wrote: > >> You may need a no-op implementation of fix_attributes() in the Character >> class. > > > What does that mean? Is that in case I use Character directly to create > an object? Most propbably it can be useful for other character classes that don't

Re: substring search without using built in utils

2006-11-09 Thread Bruno Desthuilliers
gt; assignment so: don't cheat and do your homework! > OTHO, looking for existing solutions to a same or similar problem and studying them is usually considerer good practice in real-life programming jobs !-) -- bruno desthuilliers python -c "print '@'.join(['.'.jo

Re: how is python not the same as java?

2006-11-10 Thread Bruno Desthuilliers
plementation works the same. -- 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: how is python not the same as java?

2006-11-10 Thread Bruno Desthuilliers
Jorge Vargas wrote: > On 9 Nov 2006 16:44:40 -0800, gavino <[EMAIL PROTECTED]> wrote: >> both are interpreted oo langauges.. >> > that is not correct java is compiled and the VM interprets the code So are CPython and IronPython. -- bruno desthuilliers python -c &quo

Re: how is python not the same as java?

2006-11-13 Thread Bruno Desthuilliers
files, the interpreter takes care > of this for you. And ? The fact that the Python runtime is smart enough (lol) to silently call the compiler when needed doesn't make Python (well, CPython...) more or less "interpreted" or "compiled". -- 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: substring search without using built in utils

2006-11-13 Thread Bruno Desthuilliers
John Machin wrote: > Bruno Desthuilliers wrote: >> Gabriel Genellina wrote: >>> At Wednesday 8/11/2006 22:29, zeal elite wrote: >>> >>>> I am looking for substring search python program without using the >>>> built in funtions like find, or '

Re: how is python not the same as java?

2006-11-13 Thread Bruno Desthuilliers
e compiler so Python is interpreted". If that was not what you meant, please consider this a typical case of "monday morning, not enough coffein yet". -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for

Re: to setattr or def setProp()

2006-11-14 Thread Bruno Desthuilliers
tors.html * http://users.rcn.com/python/download/Descriptor.htm My 2 cents... -- 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: Is python for me?

2006-11-15 Thread Bruno Desthuilliers
ly on the particular RDBMS. So we're left with the application code itself - the glue between all these componants. There's usually nothing really "intensive" here, and I wouldn't bet using C++ instead of Python would make a huge difference here - wrt/ perceived performances

Re: another newbie question

2006-11-15 Thread Bruno Desthuilliers
Mary Jane Boholst a écrit : > Hello everyone, > I have a question that google couldnt answer for me and thought that the > brains on here might be able to help. > I am trying to upload a file to a database What do you mean "upload a file to a database" ? I know how to uplaod a file (from a web fo

Re: Python v PHP: fair comparison?

2006-11-15 Thread Bruno Desthuilliers
walterbyrd a écrit : > Bjoern Schliessmann wrote: > >>walterbyrd wrote: >> >> >>>- PHP has a lower barrier to entry >> >>Which kind of barrier do you mean -- syntax, availability, ...? > > > Putting php into a web-site is as easy as throwing some php code into a > my html file, and maybe giving

Re: Python v PHP: fair comparison?

2006-11-15 Thread Bruno Desthuilliers
walterbyrd a écrit : > Larry Bates wrote: > > >>I'd be surprised if there was more demand for PHP developers >>than Python developers. > > > Prepare to be surprised. From what I have seen demand for PHP > developers is off-the-scale higher than demand for Python developers. Anyone that knows h

Re: Python v PHP: fair comparison?

2006-11-15 Thread Bruno Desthuilliers
Michael Torrie a écrit : > On Tue, 2006-11-14 at 18:55 -0800, Luis M. González wrote: > >>>- Python is more readable, and more general purpose >> >>Yes, php is only for web. > > > Absolutely false. From a purely technical POV, you're of course right. But PHP has been hacked (nobody in it's o

Re: Python v PHP: fair comparison?

2006-11-15 Thread Bruno Desthuilliers
walterbyrd a écrit : > Michael Torrie wrote: > > >>Absolutely false. Most of my standalone, command-line scripts for >>manipulating my unix users in LDAP are written in PHP, although we're >>rewriting them in python. >> > > > I would say that you are one of very few who use PHP for sys-admin >

Re: Python v PHP: fair comparison?

2006-11-15 Thread Bruno Desthuilliers
walterbyrd a écrit : > Luis M. González wrote: > >>the new crop of web frameworks (Django, Turbo Gears, etc...). >> >> >>>- Newer versions of mod_python require Apache 2.0, which few hosters >>>have >> >>You can also get alder versions of mod_python. What's the problem? > > > The problem is that

Re: Will GPL Java eat into Python marketshare?

2006-11-15 Thread Bruno Desthuilliers
John Bokma a écrit : > Harry George <[EMAIL PROTECTED]> wrote: > > >>Short answer: People use Python instead of Java because people (at >>least intelligent people) tend to avoid pain. > > > Intelligent people don't suffer from fanboy sentiments. They just pick a > language that works best for

Re: Python v PHP: fair comparison?

2006-11-16 Thread Bruno Desthuilliers
the old hard c/c++ world way before web >> apps, Web apps are not where I learned programming... >> i haven't really found much for most general apps (not ui/not threaded >> stuff) that php can't do.. I haven't really found much for most general apps that assemb

Re: dynamic type changing

2006-05-28 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : >>>I'm working on a "TempFile" class that stores the data in memory until >>>it gets larger than a specified threshold (as per PEP 42). Whilst >>>trying to implement it, I've come across some strange behaviour. Can >>>anyone explain this? > > >>>The test case at the

Re: create a text file

2006-05-29 Thread Bruno Desthuilliers
Stan Cook a écrit : > I'm writing a script to list all of my music files' id3 tags to a comma > delimited file. The only part I'm missing seems like it should be the > simplest. I haven't used Python for the last couple of years. My > question is this: > > When I use os.open(,"w"), I get an

Re: interactive programme (voice)

2006-05-30 Thread Bruno Desthuilliers
nigel a écrit : > hi i have wrote an interactive programme,this is a small section of it. > #This is my first programme writing in python > s = raw_input ("hello what's your name? ") > if s=='carmel': >print "Ahh the boss's wife" > if s=='melvyn': > print "your the boss's dad" > if s=='rebe

Re: is a wiki engine based on a cvs/svn a good idea?

2006-05-31 Thread Bruno Desthuilliers
piotr maliski a écrit : > I'm planning to wite a fully featured wiki in Python Then first have a look at both moinmoin and Trac. Good part of the job is already done. > in one of > frameworks. I've seen some notes about wiki/documentation management > scripts that use SVN as a data storage/versi

Re: Function mistaken for a method

2006-06-01 Thread Bruno Desthuilliers
Eric Brunel a écrit : > On Thu, 01 Jun 2006 15:07:26 +0200, bruno at modulix > <[EMAIL PROTECTED]> wrote: > >> Do yourself a favour : use new-style classes. >> class C(object) > > > I would if I could: I'm stuck with Python 2.1 for the moment (I should > have mentionned it; sorry for that).

Re: Using print instead of file.write(str)

2006-06-01 Thread Bruno Desthuilliers
A.M a écrit : > Hi, > > > I found print much more flexible that write method. Can I use print instead > of file.write method? > f = open("/path/to/file") print >> f, "this is my %s message" % "first" f.close() To print to stderr: import sys print >> sys.stderr, "oops" FWIW, you and use stri

Re: if not CGI:

2006-06-01 Thread Bruno Desthuilliers
Max a écrit : (snip) > But now I'm ready to do it in the real world. Nothing complicated, but a > real project. And I have to choose my tools. Zope, Plone, Django, what > are these? Zope -> an application server Plone -> a CMS built upon Zope Django -> a MVC fullstack framework (fullstack : int

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread Bruno Desthuilliers
Steven Bethard a écrit : > A.M wrote: > > Do we have the conditional expressions in Python 2.4? > > bruno at modulix wrote: > (snip) > >> In the meanwhile, there are (sometime trickyà ways to get the same >> result: >> >> a = 1 == 1 and "Yes" or "No" >> a = ("No", "Yes")[1 == 1] > > And just

Re: Using print instead of file.write(str)

2006-06-02 Thread Bruno Desthuilliers
Sion Arrowsmith a écrit : > A.M <[EMAIL PROTECTED]> wrote: > >>I found print much more flexible that write method. > > > "more flexible"? More convenient, yes. More powerful, maybe. But I > don't see more flexible. Everything print can to stdout.write() can > do. The reverse isn't true. eg (this

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > does anyone know a module or something to convert numbers like integer > to binary format ? > > for example I want to convert number 7 to 0111 so I can make some > bitwise operations... You don't need to convert anything. The bitwise ops are &, |, <<, >> 0 | 2 | 4 -

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
Grant Edwards a écrit : > On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>does anyone know a module or something to convert numbers like integer >>to binary format ? > > > They _are_ in binary format. Not really. >>> (7).__class__ >>> dir((7)) ['__abs__', '__add__', '__and_

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Grant Edwards wrote: > >>On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> >>>does anyone know a module or something to convert numbers like integer >>>to binary format ? >> >>They _are_ in binary format. >> >> >>>for example I want to convert number 7

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Bruno Desthuilliers
A.M a écrit : > Well the work is done now. I arrived home at 10:30 PM. > (snip) > > > Now that I finished the 1st part of the application, I have to admit that > choosing Python was an excellent decision. Python is an awesome programming > language with comprehensive library and great commun

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Bruno Desthuilliers
Fredrik Lundh a écrit : > "A.M" wrote: > > >>>are your boss aware of this ? >> >>In fact my boss is quite impressed with my progress so far. > > > *your* progress ? I think this meant "the progress status of the software". -- http://mail.python.org/mailman/listinfo/python-list

Re: after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself?

2006-06-02 Thread Bruno Desthuilliers
python a écrit : > after del list , when I use it again, prompt 'not defined'.how could i > delete its element,but not itself? > except list.remove(val) ,are there other ways to delete list 's > elements? > > and , I wrote: > > list1=[] > def method1(): Why naming a function "method" ? >

Re: after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself?

2006-06-02 Thread Bruno Desthuilliers
python a écrit : > after del list , when I use it again, prompt 'not defined'.how could i > delete its element,but not itself? FWIW, del don't delete an object (not directly at least), it just delete the name<->object association. If (and only if) it was the only name referencing that object, th

<    1   2   3   4   5   6   7   8   9   10   >