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
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
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
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([
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
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
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
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
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
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 '@
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
>> 'im_func', 'im_self']
>>>>> b.__class__
>>
>>>>> b.__class__.__name__
>> 'instancemethod'
>>
>> I was sort of hoping that it would print 'Foo'.
>
> But... you've just
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
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
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
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
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
[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
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
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
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
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
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
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
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
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
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
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 &
.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
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
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
> |
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
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
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
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
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
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
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
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()
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
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
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:/
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
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
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
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
[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
[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
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
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
>
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
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
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
[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
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
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
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
that?
Thanks,
Bruno
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
(snip)
>> class Exposing(object):
>> @classmethod
>> def get_exposed_methods(cls):
>> try:
>> exposeds = cls._exposed_methods
>> except AttributeError:
>> exposeds = []
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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(['
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
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
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. (
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
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[:
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
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
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
501 - 600 of 4404 matches
Mail list logo