Re: Newbie Q: Class Privacy (or lack of)

2006-07-28 Thread Bruno Desthuilliers
Steve Jobless wrote: > Bruno Desthuilliers wrote: >> Steve Jobless wrote: >>> Sybren Stuvel wrote: >>> >>>> Steve Jobless enlightened us with: >>>> >>>>> The first case can be just a typo, like: >>>>> >>>&g

Re: Newbie Q: Class Privacy (or lack of)

2006-07-28 Thread Bruno Desthuilliers
Ray wrote: > Bruno Desthuilliers wrote: >>> I'd rather let a machine to do that. Wasn't computer created for tasks >>> like this? (No, not really. But...) >> There's obviously a trade-off between 'security' and flexibility. As I >> said, I

Re: Need a compelling argument to use Django instead of Rails

2006-07-28 Thread Bruno Desthuilliers
ropping at eyesight. -- 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: [OT]Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
ttp://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/DTML.stx/ScriptingZope.stx The mechanism is based on 'decorating' forms fields names with type annotation. In you case, this would look like: HTH -- bruno desthuilliers python -c "print '@'.join([

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
then the control is not successful and it's name should not appear in the request. This is defined in the html spec (sections 17.2 and 17.13.2 of html 4.01 spec). -- 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: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
ment passed in the list the function works correctly >> but >> if it is passed as a string nothing happens. > > You need the isinstance() function. Not in Zope. -- 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: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
on is selecteddeptcodes. > > You can use isinstance or function like that: > Zope has a better solution builtin. -- 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 variables

2006-07-31 Thread Bruno Desthuilliers
42 >>> Foo._v 42 >>> >> All seems to work fine (case 4), but when a custom object is >> assigned, an instance variable is created instead of using theproerty >> (case 5). >> >> What goes wrong here? I'm afraid there are too much problems wit

Re: Nested function scope problem

2006-07-31 Thread Bruno Desthuilliers
righthand. >> Yes, I think I got it now :) >> >> It seems that, in essence, Bruno is right in that Python doesn't really >> have variables. Everything that seems variable doesn't really change; what >> changes is that an element of what seems to change

Re: how to safely extract dict values

2006-07-31 Thread Bruno Desthuilliers
vals.append(mydict[key]) Too much useless lookup IMHO... vals = [] for k, v in mydict.items(): if isinstance(v, list): vals.extend(v) else: vals.append(v) !-) But this is not that different from what the OP found so ugly... -- bruno desthuilliers python -c "print '@

Re: how to safely extract dict values

2006-07-31 Thread Bruno Desthuilliers
away !-) Else, you can shorten the code a bit (NB : ignoring the 'None' case...): v = d[k] v = ([v], v)[isinstance(v, list)] And this can be hidden away in a function: def get_as_list(d, k): v = d[k] return ([v], v)[isinstance(v, list)] vals = get_as_list(mydict, mykey) I don&#

Re: how to safely extract dict values

2006-07-31 Thread Bruno Desthuilliers
terate through acts >> for val in vals: >> . > > how about: > > vals = [] > for val in mydict.values(): > try: vals.extend(val) > except: vals.append(val) >>> l = [] >>> l.extend((1, 2)) >>> l

Re: how to safely extract dict values

2006-07-31 Thread Bruno Desthuilliers
Paul Rubin wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> Too much useless lookup IMHO... > > Actually, you, me, and Amit all mis-read David's original exapmle. Actually, I plea not guilty - cf my answer to the OP !-) -- bruno desthuilliers python -c &q

Re: how to safely extract dict values

2006-07-31 Thread Bruno Desthuilliers
e key at all in this case. > using a try/exception case to switch between append and extend will not > work. Nope. > the scalar, coming back as a string, can certainly be iterated > and i'll end up with a bunch of characters in my list. Yes. > i like what's posted below

Re: Using Python for my web site

2006-07-31 Thread Bruno Desthuilliers
ww.sqlalchemy.org/ Now I can't tell if either one or the other beats PSP when it comes to raw perfs... 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: Need a compelling argument to use Django instead of Rails

2006-07-31 Thread Bruno Desthuilliers
what long-running application servers try to solve. mod_python is at once lower-level and a bit more powerful than PHP. It really exposes most of Apache's API to Python - which BTW doesn't make it that well-suited for shared hosting... (most of the time, updating a mod_python based app

Re: Using Python for my web site

2006-07-31 Thread Bruno Desthuilliers
our experiences with it is that it breaks down way too easily and is a king-size PITA to maintain and upgrade. In fact, the real question IMHO is: what would MySQL advantage over PostgreSQL be ?-) > I will look into Django. I can't tell if it'll meets your needs, but I really thinks i

Re: Nested function scope problem

2006-07-31 Thread Bruno Desthuilliers
s ? Talk about stubborness :( -- 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: Static Variables in Python?

2006-07-31 Thread Bruno Desthuilliers
Roel Schroeven a écrit : > Michael Yanowitz schreef: > >> Is it possible to have a static variable in Python - a local >> variable in a function that retains its value. >> (snip) > > You could do it by defining static_bits as a keyword parameter with a > default value: > (snip) > It might be

Re: Static Variables in Python?

2006-07-31 Thread Bruno Desthuilliers
Michael Yanowitz a écrit : > Is it possible to have a static variable in Python - > a local variable in a function that retains its value. > > For example, suppose I have: > > def set_bit (bit_index, bit_value): >static bits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >bits [bi

Re: Using Python for my web site

2006-07-31 Thread Bruno Desthuilliers
Gerhard Fiedler a écrit : > On 2006-07-31 15:00:15, Bruno Desthuilliers wrote: > > >>In fact, the real question IMHO is: what would MySQL advantage over >>PostgreSQL be ?-) > > > A few years ago I did some research, and the result was that while > PostgreSQL

Re: Using Python for my web site

2006-07-31 Thread Bruno Desthuilliers
northband a écrit : > So seems the best approach would be a MVC model rather than server > scripting? This is still "server-scripting" - at least since on the server-side and is done with something frequently labelled as a "script language" !-) > Currently our site is built with a closed sourc

Re: Using Python for my web site

2006-07-31 Thread Bruno Desthuilliers
northband a écrit : > Just spoke with my department and looks like we still want to go with a > server scripting method. Although MVC may be better fit, for the sake > of the learning curve, we want to use a PSP style method. I really don't think the learning curve will be a problem. We learned

Re: Finding the name of a class

2006-08-01 Thread Bruno Desthuilliers
cope. Module object: the module attributes. Type or class object: its attributes, and recursively the attributes of its bases. Otherwise: its attributes, its class's attributes, and recursively the attributes of its class's base classes. >>> -- 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: Finding the name of a class

2006-08-01 Thread bruno desthuilliers
Tim Chase a écrit : > class Foo(object): >> >> ... pass >> ... >> > b = Foo > b.__name__ >> >> 'Foo' > > > While this is surely true, would somebody explain why I had such trouble > finding this? Mmm... Documentation needs update ? > help(dir) > > Help on built-in functi

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
Kirk Strauser wrote: > Bruno Desthuilliers wrote: > >> Kirk Strauser wrote: > >>>>>> class foo(object): >>>>>> pass >>> how can I find its name, such as: >>> >>>>>> b = foo > >> I suppose you

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
>> 'im_func', 'im_self'] >>>>> b.__class__ >> >>>>> b.__class__.__name__ >> 'instancemethod' >> >> I was sort of hoping that it would print 'Foo'. > > But... you've just

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
int b.__class__.__name__ gives what you want Actually it should be b.__name__, since b refers to *class* foo. b.__class__ is the metaclass (usually 'type' unless there's a custom metaclass). -- 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: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
es, idioms and gotchas, and are seldom as complex and complete as "real" programs. > Any other tips for getting up to speed with Python fairly quickly will > be greatly appreciated. Lurking here may be a good idea... -- 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: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
27;) reversed_words = [] for word in words: # word[::-1] reverse the word, # ie "abc"[::-1] == "cba". reversed_words.append(word[::-1]) reversed_parts.append('.'.join(reversed_words)) reversed_sig = "@".join(reversed_parts) print re

Re: Using Python for my web site

2006-08-02 Thread Bruno Desthuilliers
Conrad a écrit : > On Mon, 31 Jul 2006 19:14:03 +0200, Bruno Desthuilliers wrote: > > >>northband wrote: >> >>>Hi, I am interested in re-writing my website in Python vs PHP but have a >>>few questions. Here are my specs, please advise as to which >&g

Re: Using Python for my web site

2006-08-02 Thread Bruno Desthuilliers
Luis M. González a écrit : (snip). > I guess that the reason for not having used a framework already is > laziness... Strange enough, laziness is my first reason for using frameworks ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > thanks very much for all the comments, links to articles and other > help.The Ruby crowd says you guys are no where near as friendly as > them! Yes. Python bashing sadly appears to be the national sport amongst Rubyists. Looks like a puberty crisis to me, and I gues

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
BartlebyScrivener a écrit : > [EMAIL PROTECTED] wrote: > > >>>The Ruby crowd says you guys are no where >>> near as friendly as them! > > > Slander! Defamation! > I'd rather say cluelessness and jealousy !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there an obvious way to do this in python?

2006-08-02 Thread Bruno Desthuilliers
H J van Rooyen a écrit : > Hi, > > I want to write a small system that is transaction based. > > I want to split the GUI front end data entry away from the file handling and > record keeping. > > Now it seems almost trivially easy using the sockets module to communicate > between machines on the

Re: Is there an obvious way to do this in python?

2006-08-03 Thread Bruno Desthuilliers
H J van Rooyen wrote: > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote: > > > |H J van Rooyen a écrit : > |> Hi, > |> > |> I want to write a small system that is transaction based. > |> > |> I want to split the GUI front end data en

Re: Can Your Programming Language Do This? Joel on functional programming and briefly on anonymous functions!

2006-08-03 Thread Bruno Desthuilliers
Casey Hawthorne wrote: > Can Your Programming Language Do This? And the answer is "yes, of course" !-) > Joel on functional programming and briefly on anonymous functions! > > http://www.joelonsoftware.com/items/2006/08/01.html > > -- > Regards, > Casey

Re: Is there an obvious way to do this in python?

2006-08-03 Thread Bruno Desthuilliers
H J van Rooyen wrote: > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote: (snip) > |> If my original post was unclear I am sorry - the point I want answered, if > |> possible, is how to make the client code effectively updateable on the fly > - > |> becau

Re: What is the best way to print the usage string ?

2006-08-03 Thread Bruno Desthuilliers
r/bin/python """ Concat: concatenates the arguments with a colon (:) between them Usage: concat arg1 [arg2...] Example: concat a b c prints \"a:b:c/\ """ import sys args = sys.argv[1:] if not args: sys.exit(globals()['__doc__'].strip()) print reduce(la

Re: Is there an obvious way to do this in python?

2006-08-03 Thread Bruno Desthuilliers
kind of fat client whatever the language, and one of the key reason for the growing demand for web applications - reducing deployment problems to the minimum... -- 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: Nested function scope problem

2006-08-03 Thread Bruno Desthuilliers
Antoon Pardon a écrit : > On 2006-07-31, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >>(snip) >> >>>Sure it is usefull. It may be not 100% formally correct, but often >>>things that are not 100% formally correct can be

Re: threads, file access and stuff

2006-08-04 Thread Bruno Desthuilliers
simplest solution, ie an ini file (ConfigParser is your friend here). HTH -- 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 there an obvious way to do this in python?

2006-08-04 Thread Bruno Desthuilliers
H J van Rooyen wrote: > "Bruno Desthuilliers" <[EMAIL PROTECTED]>wrote: > | H J van Rooyen wrote: (snip) > | > so if Pyro is for 'moving the scripts around' - Then that is what I must > look at > | > very hard... > | > | It's not for &

Re: Need a compelling argument to use Django instead of Rails

2006-08-04 Thread Bruno Desthuilliers
.modpython.org/live/current/doc-html/dir-other-ipd.html http://www.modpython.org/live/current/doc-html/dir-other-ipdv.html -- 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: Using Python for my web site

2006-08-06 Thread Bruno Desthuilliers
Paul Boddie a écrit : > Bruno Desthuilliers wrote: > >>To make a long story short, my opinion is that the only sensible thing >>to do with Windows is to wipe it out and install an OS instead. > > > If you're convinced you won't be running Windows, why deal w

Re: Is there an obvious way to do this in python?

2006-08-06 Thread Bruno Desthuilliers
H J van Rooyen a écrit : > "Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote: > (snip) > | If you go the web application route, each "login" would use a cookie > | to control session, so the application server can determine what > | functions to present to the user. You might even be able to use > |

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Bruno Desthuilliers
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. Technically, yes - but in a somewhat hackish way. But you *really* should not have such a need at first. Smells like a design (or co

Re: Newbie - How to iterate list or scalar ?

2006-08-08 Thread Bruno Desthuilliers
Andy Dingley wrote: > I seem to be writing the following fragment an awful lot, and I'm sure > it's not the best and Pythonic way to do things. Any advice on better > coding style? > > pluginVersionNeeded is a parameter passed into a method and it can > either be a simple scalar variable, or it ca

Re: do people really complain about significant whitespace?

2006-08-08 Thread Bruno Desthuilliers
infidel wrote: > Where are they-who-hate-us-for-our-whitespace? You may find some on comp.lang.ruby... -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - How to iterate list or scalar ?

2006-08-08 Thread Bruno Desthuilliers
Andy Dingley wrote: > Bruno Desthuilliers wrote: > >> there's really no reason to >> assume it should be a list - any iterable could - and IMHO should - be >> accepted... expect of course for strings (royal PITA case, duh). > > >> 2/ test for pluginVers

Re: Newbie question: what's with "self"?

2006-08-08 Thread Bruno Desthuilliers
donkeyboy wrote: > This is probably a really basic question, > but anyway ... > > I'm new to both Python and OO programming. From looking at a number of > code examples, the word "self" is used a lot when referring to classes. Actually, it's used as the first parameter for methods of the classes

Re: Newbie question: what's with "self"?

2006-08-08 Thread Bruno Desthuilliers
Miki wrote: (snip) > If you know C++/Java then "self" is like "this". But in Python, it's mandatory and must be the first arg for instance methods. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - How to iterate list or scalar ?

2006-08-09 Thread Bruno Desthuilliers
Terry Reedy wrote: > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> FWIW, the iterator protocol appeared with Python 2.2. Before this >> version, the above solution was the only one that allowed iteration over >> a

Re: Class data being zapped by method

2006-08-09 Thread Bruno Desthuilliers
Simon Forman wrote: (snip) > Not that this has anything to do with your actual question, but there > are a number of small details that I noticed while reading your code: > > > 2.) Reading lines from a file is better done like so: > > arrLines = open('datafiles/'+filename+'.tabdata').readlines()

Re: Session implementation for Python

2006-08-09 Thread Bruno Desthuilliers
Vlad Dogaru wrote: > Hello, > > is there any PHP-like implementation for sessions in Python? I fear > that writing my own would be seriously insecure, besides I could > actually learn a lot by inspecting the code. > > The reason I am asking is that I would like to implement simple scripts > wh

Re: Class data being zapped by method

2006-08-09 Thread Bruno Desthuilliers
Sion Arrowsmith wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> fpath = os.path.join('datafiles', filename + ".tabdata") > > fpath = os.path.join('datafiles', filename + os.path.extsep + "tabdata") > 8-) I'm a bit b

Re: __contains__ vs. __getitem__

2006-08-09 Thread Bruno Desthuilliers
David Isaac wrote: > I have a subclass of dict where __getitem__ returns None rather than > raising KeyError for missing keys. (The why of that is not important for > this question.) Well, actually it may be important... What's so wrong with d.get('key') that you need this behaviour ? -- http:/

Re: converting a nested try/except statement into try/except/else

2006-08-09 Thread Bruno Desthuilliers
John Salerno a écrit : > I'm starting out with this: > > try: > if int(text) > 0: > return True > else: > self.error_message() > return False > except ValueError: > self.error_message() > return False > > I rewrote it as this: > > try: > int(text) > ex

Re: converting a nested try/except statement into try/except/else

2006-08-09 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > John Salerno a écrit : > (snip) or of course the dead simple: try: if int(text) <= 0: raise ValueError except ValueError: self.error_message() return False else: return True BTW, you really shou

Re: __contains__ vs. __getitem__

2006-08-10 Thread Bruno Desthuilliers
David Isaac wrote: >> Alan Isaac wrote: >>> I have a subclass of dict where __getitem__ returns None rather than >>> raising KeyError for missing keys. (The why of that is not important > for >>> this question.) > > "Bruno Desthuilliers" &l

Re: Make Object Oriented?

2006-08-10 Thread Bruno Desthuilliers
Michael Yanowitz wrote: > Hello: > >Are there any tools to convert non-object-oriented code > into object-oriented code? Yes, of course. That's what we call a "programmer". Why ? >If not, perhaps something that I can pass in two (or more) > classes and will create a base-class and simpli

Re: Absolute beginner - is this feasible?

2006-08-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > I am by no means a serious programmer (which will become evident as you > read this very message), except that I use VBA almost daily to automate > Excel spreadsheets. > > I do enjoy programming however and the only thing that prevented me > from learning a language othe

Re: Make Object Oriented?

2006-08-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > It would be ease to create such a tool Hmmm ? May I express some very huge doubts here ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - How to iterate list or scalar ?

2006-08-10 Thread Bruno Desthuilliers
Delaney, Timothy (Tim) wrote: > Bruno Desthuilliers wrote: > >> What I wonder here is why __iter__ has been added to lists and tuples >> but not to strings (not that I'm complaining, it's just curiousity...) > > Because someone got around to doing it. Ok, so i

Re: do people really complain about significant whitespace?

2006-08-10 Thread Bruno Desthuilliers
Stephen Kellett wrote: > In message <[EMAIL PROTECTED]>, Carl > Banks <[EMAIL PROTECTED]> writes >> Stephen Kellett wrote: >> I don't really understand how a closing brace helps here. Care to >> explain why it helps you? > >> (Deeply nested long functions are evil anyways. If you have such a >

Re: Make Object Oriented?

2006-08-10 Thread Bruno Desthuilliers
John Salerno wrote: > Bruno Desthuilliers wrote: >> [EMAIL PROTECTED] wrote: >>> It would be ease to create such a tool >> >> Hmmm ? May I express some very huge doubts here ? > > But the link he gave also says this: > > "Perfect Java programs can

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Bruno Desthuilliers
John Salerno a écrit : > Bruno Desthuilliers wrote: > >> try: >> if int(text) <= 0: raise ValueError > > > Hmm, I'm actually not so sure about this line now. It doesn't seem right > to raise a ValueError when the result of the expression

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Bruno Desthuilliers
Boris Borcic a écrit : > Slawomir Nowaczyk wrote: > >> >> try: >> if int(text) > 0: >>return True >> except ValueError: >> pass >> self.error_message() >> return False >> > > Nicely DRY. To make it even more compact, it may be noticed that the > default return value None is false

Re: How to write a Installer for a Python App in Linux

2006-08-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > > I have known python for about 3-4 months now. My knowledge is still > very limited. > > I wrote a small app using wxPython. Now, I want to create an installer > for it (on Linux platform.) for the people I developed this small > utility. > > These people use

Re: "running" code on client side with cherrypy?

2006-08-11 Thread Bruno Desthuilliers
Mr BigSmoke wrote: > Tnx Jay... as i supposed there's no easy solution... I just thought > that, maybe, being on an intranet there was a possible solution... > About pysvn a tortoise... i do use tortoiseSVN and t works really > really fine.. we (developers) use it, but i'm writting server for > "no

Re: hide python code !

2006-08-11 Thread Bruno Desthuilliers
Bayazee wrote: > hi > can we hide a python code ? > if i want to write a commercial software can i hide my source code from > users access ? > we can conver it to pyc but this file can decompiled ... so ...!! It's just the same with java byte-code or machine code. FWIW, I had a cracked (and locali

Re: hide python code !

2006-08-11 Thread Bruno Desthuilliers
Steven D'Aprano wrote: (snip) > If you really want something which compiles to machine code, then Python > is not the language for you. Use another language. > But that won't protect your software from piracy anyway. -- http://mail.python.org/mailman/listinfo/python-list

Http client to POST using multipart/form-data

2006-08-17 Thread Bruno Dilly
that? Thanks, Bruno -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for EXIF-info-additions ?

2006-08-21 Thread Bruno Dilly
I think you can find what do you need into this repository, it's a creative commons tool: https://svn.berlios.de/svnroot/repos/cctools/publisher/branches/flickr-storage-branch/ take a look in the follow directory: ccpublisher/jpeg/ I'm not sure if it's what you want, let me know. See you, Dilly

Re: Where is Python in the scheme of things?

2006-10-05 Thread Bruno Desthuilliers
thon). > Please discuss where Python shines. Application programming and admin scripts. Note that application programming doesn't imply GUI - I'm mostly doing web development FWIW. Now if you're doing Windows-only, Python is quite good with COM/ActiveX etc AFAIK. -- bruno desthui

Re: Access to static members from inside a method decorator?

2006-10-05 Thread Bruno Desthuilliers
oseds = cls._exposed_methods except AttributeError: exposeds = [] for name in dir(cls): obj = getattr(cls, name) if exposed(obj): exposeds.append(obj) cls._exposed_methods = exposeds return exposeds class Parrot(Exposing): @expose def p

Re: Access to static members from inside a method decorator?

2006-10-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: (snip) >> class Exposing(object): >> @classmethod >> def get_exposed_methods(cls): >> try: >> exposeds = cls._exposed_methods >> except AttributeError: >> exposeds = []

Re: Access to static members from inside a method decorator?

2006-10-05 Thread Bruno Desthuilliers
classes... >...: if getattr(meth, '_exposed', False) : > ...: print 'exposed :', name >...: >...: > (snip) -- 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: Bug in re module?

2006-10-06 Thread Bruno Desthuilliers
Ant wrote: > John Machin wrote: > >> Now quick kill your post before the effbot spots it :-) > > Too late - the post was 3 minutes ago you know ;-) > Must be your lucky day - he did spot it, and you're still alive !-) -- bruno desthuilliers python -c "print &#

Re: Bug in re module?

2006-10-06 Thread Bruno Desthuilliers
Ant wrote: > John Machin wrote: > >> Now quick kill your post before the effbot spots it :-) > > Too late - the post was 3 minutes ago you know ;-) > +1 QOTW, BTW -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.s

Re: WSGI - How Does It Affect Me?

2006-10-09 Thread Bruno Desthuilliers
ory, you'll find answers to most (if not all) of your questions in the availables articles/tutorials on WSGI. You should really read them first. FWIW, going from "what's this stuff" to "run my first WSGI app" took me a couple hours. And porting your CGI apps t

Re: WSGI - How Does It Affect Me?

2006-10-09 Thread Bruno Desthuilliers
start_response): start_response('200 OK', [('Content-type', 'text/plain')]) return ['Hello WSGI World'] The WSGI spec is really dead-simple. It shouldn't take much more than 10 to 15 minutes to read and understand for anyone having some basic knowle

Re: SqlAlchemy how and where it can be used?

2006-10-09 Thread Bruno Desthuilliers
guage can i code to use it? (only Python)? Err... I don't know how and why you would use a Python package in another language ??? SQLAlchemy is an interface between your Python program and a SQL DBMS. It's *not* the SQL DBMS itself. Given your questions, I think you'd better f

Re: Bizzare lst length problem

2006-10-09 Thread Bruno Desthuilliers
th the same name, that will shadow the class attribute. > self.matrix=matrix > > > abve mops is a list, yet when I access it it is a string... the class attribute 'mops' is a list. The instance attribute 'mops' is whatever you passed when instanciating panel

Re: Bizzare lst length problem

2006-10-09 Thread Bruno Desthuilliers
Ben wrote: > Using Fredericks advice I managed to track down the problem - it was > really very stupid. I had accidentally cast the list to a string There's nothing like "type casting" in Python. You did not "cast the list to a string", you created a string from a

Re: Bizzare lst length problem

2006-10-09 Thread Bruno Desthuilliers
stopgap measure that I then forgot > about. Now the problem is fixed after this group told me how to pass a > list by value (by slicing the entire list) It's still not "passing by value". It's just passing a *copy* of the original list. -- bruno desthuilliers python -c

Re: operator overloading + - / * = etc...

2006-10-09 Thread Bruno Desthuilliers
ot; to the object 1, and then rebind the name "x" > to the object []. Which object's hypothetical __assign__ method should get > called? The current namespace object, of course. -- 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: problem with split

2006-10-09 Thread Bruno Desthuilliers
hanumizzle wrote: (snip) > Regexes are usually passed as literals directly to re.compile(). For which definition of "usually" ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: Python component model

2006-10-10 Thread Bruno Desthuilliers
Marc 'BlackJack' Rintsch wrote: (snip) Python itself is a RAD tool. +1 QOTW -- 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: can regular ol' python do a php include?

2006-10-10 Thread Bruno Desthuilliers
gt; Thanks, pretty good idea! But my guess is that I can't just use it this > way within an HTML file. As the effbeot kindly mentionned, you cannot do any include in a HTML file - the HTML spec doesn't mention such a beast. -- bruno desthuilliers python -c "print '@'.j

Re: sufficiently pythonic code for testing type of function

2006-10-11 Thread Bruno Desthuilliers
s): if not isinstance(obj, types): raise ValueError('object is not an instance of %s' % str(types)) Now the real question : what if the object is not an instance of any of the types, but still support the expected interface ? > -- Theerasak -- bruno desthuilliers python -c &qu

Re: How to write Smart Python programs?

2006-10-11 Thread Bruno Desthuilliers
enumerate(seq): do_something_with(i, item) 2/ functions that returns a status code and modify their arguments. The pythonic way is to have the function return multiple args and raise an exception if something went wrong -- bruno desthuilliers python -c "print '@'.join(['

Re: Python component model

2006-10-11 Thread Bruno Desthuilliers
Peter Maas wrote: > Bruno Desthuilliers schrieb: >> Marc 'BlackJack' Rintsch wrote: >> (snip) >> Python itself is a RAD tool. >> >> +1 QOTW > > No, please stop self-assuring, self-pleasing QOTWs! Certainly not !-) (snip) > I for my p

Re: sufficiently pythonic code for testing type of function

2006-10-11 Thread Bruno Desthuilliers
gt; I'll do that as soon as my green noggin figures out what 'idempotent' > means. idempotent -> no side effects. -- 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 to write Smart Python programs?

2006-10-11 Thread Bruno Desthuilliers
Theerasak Photha wrote: > On 10/11/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >> 2/ functions that returns a status code and modify their arguments. > > Argument modification for lists with one item is *sometimes* used to > emulate full lexical closure. (

Re: How to write Smart Python programs?

2006-10-11 Thread Bruno Desthuilliers
en either marked as implementation (the _leading_underscore convention) or deleted from the class's dict once the property is created or 'masked' one way or another so they don't pollute the class's namespace. Also and FWIW, properties are just one possible application of the descriptor protocol. If you want to grasp Python's object model, I'd recommand that you read about descriptors and metaclasses. -- 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: Alternative constructors naming convention

2006-10-11 Thread Bruno Desthuilliers
tinguish them from methods... Well... They are still methods, aren't they ?-) I don't remember any specific guideline, but FWIW, dict.from_keys() is an "alternative constructor". My 2 cents. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[:

Re: sufficiently pythonic code for testing type of function

2006-10-11 Thread Bruno Desthuilliers
A.T.Hofkamp wrote: > On 2006-10-11, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> Now the real question : what if the object is not an instance of any of >> the types, but still support the expected interface ? >> > > one possible answer: Use ZopeInte

Re: How to write Smart Python programs?

2006-10-11 Thread Bruno Desthuilliers
Antoine De Groote wrote: > Bruno Desthuilliers wrote: >>> And what does property mean anyway? >> >> See above. A property is a computed attribute : you access it like a >> 'data' attribute, but it really uses getters/setters. The point here is >> tha

Re: How to write Smart Python programs?

2006-10-11 Thread Bruno Desthuilliers
John Salerno wrote: > Bruno Desthuilliers wrote: > >> Googling for "python is not java" may be a good start. > > I have a question about this section of a blog with that title. I'll ask > the question first so it doesn't get lost at the bottom: does the

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