Alex wrote:
> On 5/15/06, bruno at modulix <[EMAIL PROTECTED]> wrote:
>
(snip)
>
> Thanks for taking your time to help me out. :) You have cleared out
> many of my doubts. BTW, should I post "thank you" stuff here
Ain't that what you just did ?-)
> or
[EMAIL PROTECTED] wrote:
>>ssh [EMAIL PROTECTED] shutdown -s
>
>
> Than indeed workedThanks
>
> > use the subprocess module or shellutils to execute the above.
>
> I am a python newbie and how easy or difficult it is using the sub
> process module and shell utils.
It's as difficult as :
1
John Salerno wrote:
> Bruno Desthuilliers wrote:
>
>> At least someone reading this may learn about the max_split param of
>> str.split() !-)
>
>
> LOL. The first thing I did was scramble to the docs to see what that
> second parameter meant! :)
>
> But I
egbert wrote:
> What does a gui_event_loop know ?
>
> My gui is based on pygtk,
> but i suppose the mechanism is the same everywhere.
>
> The gui is created within a class-instance within a function.
> Normally, ie without a gui, everything that happens within
> a function is forgotten as soon t
infidel wrote:
>>is there any typical usage that shows their difference?
>
>
> I think the general idea is to use lists for homogenous collections and
> tuples for heterogenous structures.
>
> I think the database API provides a good usage that shows their
> differences. When you do cursor.fetc
regular "read-like-a-book" help and context
> sensitive help that can be launched from the application.
>
> Is there an existing system in Python that would support this, or would
> I need to start from scratch?
This depends on the system and UI, so their can be no one-size-fit
[EMAIL PROTECTED] wrote:
> I'm currently trying to get access to the Python source code, however
> whenever I try to extract the files
from what ?
> using the latest version of WinZip
> (version 10) I get the following error "error reading header after
> processing 0 entries"
> I was under the im
Edward Elliott wrote:
> Bruno Desthuilliers wrote:
>
>
>>Then it would be better to just alias it:
>>
>># def convert_quote(quote):
>># return make_code(quote)
>>convert_quote = make_code
>
>
> The former makes sense if you're planning to do more with the calling
> function later.
Then it
MackS wrote:
(snip)
>>What's preventing the use of list comprehensions?
>>
>>new_list = [x+1 for x in old_list]
>
> Suppose I want to do anything as trivial as modify the values of the
> list members _and_ print their new values.
Then it's a sure design smell IMHO. Don't mix presentation wi
BartlebyScrivener wrote:
> At the commandline, run:
>
> pydoc -g
>
> In the interpreter:
>
> help("modulename")
>
> or help ()
>
> for interactive.
This is developper doc. I think the OP's talking about end-user doc.
--
bruno desthuilliers
py
Andrew Robert wrote:
> Hi everyone,
>
>
> I have a python program that will need to interact with an MQSeries
> trigger monitor.
>
> It does this fine but it hogs the trigger monitor while it executes.
>
> I'd like to fork the program off and terminate the parent process so
> that the trigger m
Alex Pavluck wrote:
> I am just learning Python and I am using the book, "Thinking like a
> Computer Scientist". There is an exercise that I am not able to get
> working and it is really easy so I thought I would ask for help here.
>
>
> Q: As an exercise, write a single string that:
> Procu
Pierre wrote:
> Hi,
>
> Sorry in advance, english is not my main language :/
>
> I'd like to customize the result obtained by getattr on an object : if
> the object has the requested property then return it BUT if the object
> doesn't has actually this property return something else.
So implemen
SamFeltus wrote:
> I am trying to figure out why so little web development in Python uses
> Flash as a display technology. It seems most Python applications
> choose HTML/CSS/JS as the display technology, yet Flash is a far more
> powerful and elegant display technology. On the other hand, HTML/J
glomde wrote:
> i I would like to extend python so that you could create hiercical
> tree structures (XML, HTML etc) easier and that resulting code would be
> more readable than how you write today with packages like elementtree
> and xist.
> I dont want to replace the packages but the packages cou
Andrew Robert wrote:
> bruno at modulix wrote:
>
>>Andrew Robert wrote:
>>
>>>Hi everyone,
>>>
>>>
>>>I have a python program that will need to interact with an MQSeries
>>>trigger monitor.
>>>
>>>It does this fi
ake action when first, 5th, etc message arrives.
>
> The state of queues and their linked processes are controlled by the
> trigger monitor.
>
> The trigger monitor can only deal with one running process at a time.
>
> In this situation, it is possible for a process(my pyt
Pierre wrote:
> I don't want to use getattr(object, property, default_value) because
> I'm using external code and I don't want to modify or patch it. In this
> code, the call is getattr(object, property).
Seems like a perfectly valid reason !-)
> On my objects, I must provide default values depe
glomde wrote:
>>What about using data for nodes and '=' for attributes ?
>>Would look like:
>>
>>
>>
>>Page Title
>>
>>
>>Hello World
>>
>>
>>
>>>I think that with the added syntax you get better view of the html
>>>page.
>>
>>indeed !-)
>
>
> I dont think it is very pythonic :-).
[EMAIL PROTECTED] wrote:
> Hi
>
> I have been looking for a active Python community website. Something
> like www.codeproject.com (contains code articles and guide, by
> developers, for developers) for Python users.
>
> Does something like this exist?
- this newsgroup - which is very active, fri
glomde wrote:
>>Adding ugly and unintuitive "operators" to try to turn a general purpose
>>programming language into a half-backed unusable HTML templating
>>language is of course *much* more pythonic...
>
>
> IT is not only for HTML. I do think html and xml are the biggest
> creators of
> hierar
glomde wrote:
>>What about writing a mini-language that gets translated to Python? Think of
>>Cheetah, which does exactly this (albeit not being limited to templating HTML
>>data).
>
> I have implemented my proposal as preprocessor. And it works fine. But
> my
> proposal in not only for HTML
Nor
SamFeltus wrote:
> I guess there isn't much to understand. If you are satisfied with a
> text based, static image web, that is light on artistic possabilities,
> all that HTML stuff is acceptable.
1. artistic != animated.
2. the web has mostly been designed for text-based content.
> Perhaps the
[EMAIL PROTECTED] wrote:
> Evaluation of default values seems to have nothing to do with the case
> I described.
It does. Please *read* the faq:
http://pyfaq.infogami.com/why-are-default-values-shared-between-objects
> The default values are both tags = {}, and still inside mysearch() I
> sometim
glomde wrote:
> I'm answering two of you posts here...
>
>
>>Sweet Lord, have mercy !
>>
>> > Which should create myList = [[0..9], {0:0, ... 9:9}]
>>
>>myList = [
>> range(10),
>> dict((i, i) for i in range(10))
>>]
>
>
>>Let's talk about readability
>
>
> My code was just to show that
ifying a proper semantic interpretation of your syntax (and use "magic"
>>markers, which is even more a NoNo).
>
> I used 'magic' markers, since I am lousy at coming up with new
> keywords
This is an understatement.
(snip)
> But I'll try to for
Ben Finney wrote:
> Peter Otten <[EMAIL PROTECTED]> writes:
(snip)
>>
>>You want
>>getattr(commands, VARIABLE)()
>
> You'll also need to anticipate the situation where the value bound to
> VARIABLE is not the name of an attribute in 'commands'.
>
> Either deal with the resulting NameError excepti
softwindow wrote:
> the re module is too large and difficult to study
Too bad.
> i need a detaild introduction.
That's fine. Then write it. Or pay someone to do so.
Just for the record : that's the only answers you would have get on most
usenet groups. Hopefully, c.l.py is a very friendly and t
Hari Sekhon wrote:
> I do
>
> import zipfile
> zip=zipfile.ZipFile('d:\somepath\cdimage.zip')
> zip.namelist()
> ['someimage.iso']
>
> then either of the two:
>
> A) file('someimage.iso','w').write(zip.read('someimage.iso'))
> or
> B) content=zip.read('someimage.iso')
>
> but both result in
Brian Blazer wrote:
> OK, I have a very simple class here:
>
> class Student:
class Student(object):
> """Defines the student class"""
>
> def __init__(self, lName, fName, mi):
> self.lName = lName
> self.fName = fName
> self.mi = mi
Do yourself a favour: use me
Brian Blazer wrote:
please, dont top-post, and edit out irrelevant material
> You are right, I do come from a Java background.
Then you may want to read this:
http://dirtsimple.org/2004/12/python-is-not-java.html
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w
PA wrote:
>
> On May 19, 2006, at 15:33, Diez B. Roggisch wrote:
>
>> And it seems as if you have some JAVA-background, putting one class in
>> one
>> file called the same as the class. Don't do that, it's a stupid
>> restriction
>> in JAVA and
[EMAIL PROTECTED] wrote:
> Take a look at the pywin32 extension, which I believe has some lower
> level memory allocation and file capabilities that might help you in
> this situation.
But then the solution would not be portable, which would be a shame
since the zlib module (on whic
nd settings\username\desktop\cicciobello.html")
take care of the meaning of the antislash in strings... What do you
thing "c:\toto" or "c:\nothing" will expand to ?-)
import os.path
help(os.path)
Or at least, and IIRC, "c:/something/" should work.
> the pyt
Sion Arrowsmith wrote:
> Hari Sekhon <[EMAIL PROTECTED]> wrote:
(snip)
>>The python zipfile module is obviously broken...
>
> This isn't at all obvious to me.
zipfile.read() does not seem to take full advantage of zlib's
decompressobj's features. This c
Fredrik Lundh wrote:
> Cameron Laird wrote:
>
>
>>Guys, I try--I try *hard*--to accept the BetterToAskForgiveness
>>gospel, but this situation illustrates the discomfort I consistently
>>feel: how do I know that the NameError means VARIABLE didn't resolve,
>>rather than that it did, but that eva
.
>>I dont want to replace the packages but the packages could be used with
>>the
>>new operators and the resulting IMHO is much more readable.
>
>
> You might want to look at PEP 359 for ideas:
> http://www.python.org/dev/peps/pep-0359/
>
And more specifically here
Edward C. Jones wrote:
> #! /usr/bin/env python
> """
> When I run the following program I get the error message:
>
> UnboundLocalError: local variable 'x' referenced before assignment
>
> Can "inner" change the value of a variable defined in "outer"?
Not this way
> Where
> is this explained i
John Salerno wrote:
> What is the best way of altering something (in my case, a file) while
> you are iterating over it? I've tried this before by accident and got an
> error, naturally.
>
> I'm trying to read the lines of a file and remove all the blank ones.
> One solution I tried is to open the
Paul McGuire wrote:
> "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>
>>bruno at modulix a écrit :
>>(snip)
>>
>>(responding to myself)
>>(but under another identity - now that's a bit schizophrenic
Ralf Muschall wrote:
> Jeffrey Barish wrote:
>
> [overriding of base class member functions by subclass]
>
(snip)
>
> In Python, a function not intended to be overriden should be either
> have a name starting with an underscore
actually with *two* underscores. The single-leading-underscore nami
>>if not node.haschildren():
>>>continue
>>>
>
> [snip]
>
>>2) "There should be one and preferably only one way to do it."
>
>
> You mean like this:
>
> s = "foo" + "bar"
> s = 'foo' + '
e "number of substring", I mean, overlapping or
not. FWIW, I agree that this may be somewhat unintuitive, and would at
least require a little bit more precision in the docstring.
> Can someone explain me this?
It seems obvious that str.count counts non-overlapping substrings.
[EMAIL PROTECTED] wrote:
> ello there. i am having a problem getting a module to work right.
>
> i wrote a class that is going to be used in a few different scripts in
> the same directory.
>
> it looks like this:
>
> #!/usr/bin/python
This is not needed for a module.
(snip code)
> the file is
does the _ before the variables mean?
It's a convention for implementation attributes (not part of the class
public interface).
> Why are you defining _format and _data here?
Since the data object is passed at instanciation time (at least this was
the case in your code), this is the onl
NetKev wrote:
(snip)
> def process_log(self, logfile, offset):
> if new_denied_hosts:
> info("new denied hosts: %s", str(new_denied_hosts))
> [warn_Admin(ip) for ip in new_denied_hosts]
This uselessly builds a list. List comprehension is meant to create
lists, n
modify it like you'd do for any other list.
Else, you may want to look at the PYTHON_PATH environnement variable.
--
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
Scott David Daniels wrote:
> bruno at modulix wrote:
>
>> Ralf Muschall wrote:
>>
>>> Jeffrey Barish wrote:
>>>
>>> [overriding of base class member functions by subclass]
>>> In Python, a function not intended to be overriden should
Ben Finney wrote:
> "SamFeltus" <[EMAIL PROTECTED]> writes:
>
>
>>I keep trying to understand why people like HTML/JS, I don't think I
>>am gonna understand.
>
>
> It's fairly simple: HTML, CSS and JavaScript have all been
> standardised independent of any single corporation, and are freely
> i
sa ?
>>
>>using dict literals means that you'll always have a builtin dict - you
>>cannot dynamically select another dict-like class. OTHO, you can only
>>use valid python identifiers as keys with dict(**kw).
>
>
> This is all good but doesn't answer my orig
Carl J. Van Arsdall wrote:
(snip)
Not an answer to your question, just a few comments on your code:
> class Shared:
class Shared(object):
>def __init__(self):
>self.__userData= {}
>self.__mutex = threading.Lock() #lock object
Don't use __names unless yo
[EMAIL PROTECTED] wrote:
(snip)
> So now i'm hear to use all of your collective expertise for the ideal
> book for a beginning programming who want's to start with python.
'ideal' greatly depends on the reader !-)
But FWIW, this is a FAQ (well : 2):
http://www.python.org/doc/faq/general/#i-ve-ne
defcon8 wrote:
> 1. Does it matter?
> 2. Is it affecting your productivity.
> 3. Are you not trying to programme?
> 4. It is open source, change it and stop whining.
>
What about trying emacs +x doctor ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]
Sounds like this might do exactly what you need...
http://xoomer.alice.it/infinity77/main/FourWaySplitter.html
Cheers,
John
On Thu, Mar 13, 2008 at 1:45 AM, moonrie <[EMAIL PROTECTED]> wrote:
> On Mar 13, 12:47 pm, "Andrew Rekdal" <@comcast.net> wrote:
> > T
Hi, your friendly neighborhood n00b here, just wondering why on earth
the Py3K folks want to mess with a simple thing like the "print"
"command" (is that what it's called, a command?), turning it into
"print()"...I mean, what's the point, exactly?? To look like a more
"traditional" computer-langu
On May 25, 8:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
> See http://www.python.org/dev/peps/pep-3105/
> That should answer all your questions.
Hey, thanks, I missed that one!
Not that I understand the rationale given (iman00b), but oh well, so
it looks like a real function now.
On Jul 20, 6:50 pm, [EMAIL PROTECTED] wrote:
> So I was suspecting the Python compiler or interpreter is written in a
> REAL language like C#. So, Wiki says it's written in C! It's almost as
> if it were an intentional trick...write your own, new language in an
> OLD, real world language that is pa
a call to doupdate to force those changes to take effect
> >> > visually.
> >> > --
> >> > Tim Roberts, [EMAIL PROTECTED]
> >> > Providenza & Boekelheide, Inc.
>
> >> I added it and it still doesn't work. This is what I'm doing wh
Sullivan WxPyQtKinter wrote:
> Guess what would be the result of these functions:
s/functions/method calls/
>
str.lower('ASFA')
=> 'ASFA'.lower() => 'asfa'
str.join(str(),['1','1','1'])
=> ''.join(['1','1','1']) => '111'
str.join('a','b')
=> 'a'.join('b') => 'b'
>
> If you gue
James Stroud wrote:
(snip)
> Since python is "weakly typed",
s/weakly/dynamically/
(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
sophie_newbie wrote:
> OK this might seem like a retarded question,
Better to look like an ignorant than to stay one !-)
> but what is the difference
> between a library and a module?
Python only defines 'modules' and 'packages'. A module can technically
be any python source file, but usually re
there a simpler
> way to do something with all instances of a given type?
Depends on your program. But there are at least ways to make this a bit
more transparent, see below.
> 3: Why canøt I say and get the maximum of instance attributes and a
> list of them?
> y_max=max(y[].x) and
Brian Elmegaard wrote:
> bruno at modulix <[EMAIL PROTECTED]> writes:
>
>
>>Now how you could do it the OO way (Q&D, not really tested):
>
>
> Something goes wrong in my 2.3
So it's time to move to 2.4x !-)
What is "going wrong" exactly
Steven D'Aprano wrote:
(snip)
> I say "think you want" because I don't know what problem you are trying to
> solve with this messy, self-referential, piece of code.
This messy piece of code is mine, thanks !-)
And it's not "self-referential" - it introduces a references cycle
(class object -> in
Brian Elmegaard wrote:
> bruno at modulix <[EMAIL PROTECTED]> writes:
>
>
>>So it's time to move to 2.4x !-)
>
>
> I guess so.
>
>
>
>>What is "going wrong" exactly ?
>
>
> def _add_instance(cls, instance):
>
reinsn wrote:
> Hi,
>
> I am currently working with ZopeX3. Because python doesn't include
> concept of interfaces,
It does, but implicitly. The interface of an object is the set of
messages it understands.
> those were defined by the module zope.interface.
>
> So interfaces were defined like:
Pedro Graca wrote:
> [EMAIL PROTECTED] wrote:
>
>>My version is similar to Just one:
>>
>>from random import shuffle
>>
>>def scramble_text(text):
>>"""Return the words in input text string scrambled
>>except for the first and last letter."""
>>def scramble_word(word):
>
>
> Nice. Yo
Magnus Lycka wrote:
> I want an re that matches strings like "21MAR06 31APR06 1236",
> where the last part is day numbers (1-7), i.e it can contain
> the numbers 1-7, in order, only one of each, and at least one
> digit. I want it as three groups. I was thinking of
>
>
rh0dium wrote:
> Hi all,
>
> I have a dict which looks like this..
>
> dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']},
> '180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
> ['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']},
> '250nm': {'umc': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
> ['1p6m_2.2-3.
Steven D'Aprano wrote:
> On Thu, 09 Mar 2006 13:44:25 +0100, bruno at modulix wrote:
>
>
(snip)
>>And it's not "self-referential" - it introduces a references cycle
>>(class object -> instances -> class object), which may or may not be a
>>
ely not. The only times I use del is when I want to cleanup a
namespace from temp vars no longer used (usually a module's namespace
with some hairy tricks at load time).
--
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
x27;t takes the instance as first parameter, but the
class itself, and does something with the class (NB: in Python, classes
are objects too...).
Note that, as well as class methods, there are class variables (see
below for an example).
> Could somebody please enlighten me (a rtfm/wrong news
ahart wrote:
> Diez, Scott, and Bruno,
>
> I thank you all for your help and suggestions. I wasn't aware that
> default values were considered class (static) values.
These are *not* 'default values'. Defining a name in the body of a class
statement bind that name to the *class*. To bind a name to
[EMAIL PROTECTED] wrote:
> I'm having a scoping problem. I have a module called SpecialFile,
The convention is to use all_lowercase names for modules, and CamelCase
for classes.
> which defines:
>
> def open(fname, mode):
> return SpecialFile(fname, mode)
This shadows the builtin open() func
Steven D'Aprano wrote:
> On Mon, 13 Mar 2006 21:28:06 -0800, garyjefferson123 wrote:
>
>
>>I'm having a scoping problem. I have a module called SpecialFile,
>>which defines:
>>
(snip code)
>>The problem, if it isn't obvioius, is that the open() call in __init__
>>no longer refers to the builtin
Scott David Daniels wrote:
> [EMAIL PROTECTED] wrote:
>
>> ... Is the Python debugger fairly stable?
>
> Yes, but it is not massively featured. The "Pythonic" way is to
> rarely use a debugger (test first and straightforward code should
> lead to "shallow" bugs). Often for most of us judiciousl
[EMAIL PROTECTED] wrote:
> Is there any editor or IDE in Python (either Windows or Linux) which
> has very good debugging facilites like MS VisualStudio has or something
> like that.
>
> I like SPE but couldn't easily use winPDP. I need tips to debug my code
> easily.
pythonic "debugging" in thre
suling state is better done with objects. Once you'll
get a better understanding of Python's object model, you'll find out
that there's not such a need for more powerfull closures (well, that's
MHO at least). Amongst other things, functions and methods are objects,
and a
s a way to make it run in the background 24/7 but how
> do I go about doing this?
>
> At present the application runs from within a wxPython GUI, however
> this is only used to start and stop it. It could be entire faceless and
> the GUI only used to execute it.
>
http://www.
cally typed languages:
>
> 1. If someone releases an interface in Python, how does the user know
> what parameters the function takes/returns?
They read the doc !-)
The minimal documentation effort is to put docstrings in the source:
http://www.python.org/doc/peps/pep-0257/
Then ther
Tim Chase wrote:
> I've set up an object and would like to make certain attributes
> read-only (or at least enforce it without doing extra work, as per
> name-mangling or the like). Ideally, the property would be set in the
> __init__, and then not be allowed to change.
>
Eduardo Biano wrote:
> I am a python newbie and I have a problem with writing
> each record read to a file. The expected output is 10
> rows of records, but the actual output of the code
> below is only one row with a very long record (10
> records are lump into one record). Thank you in
> advance
on the body. This has problems ---
> notably that it only works on functions for which source code can be
> found, also that the parsing is tricky (but I can fix that).
What's your use case exactly ?
Well, I suppose you could either go for bytecode hacks on the function's
c
John Salerno wrote:
> From my brief experience with C#, I learned that it was pretty standard
> practice to put each class in a separate file. I assume this is a
> benefit of a compiled language that the files can then be grouped together.
>
> What I'm wondering is how is this normally handled in
Lonnie Princehouse wrote:
>>What's your use case exactly ?
>
>
> I'm trying to use a function to implicitly update a dictionary.
I think this was pretty obvious. What I wonder is *why* you want/think
you need to do such a thing -I don't mean there can't be no good reason
to do so, but this has
Chason Hayes wrote:
> How can I get a script to pipe data to another program, wait for a
> response, then send more data etc.
>
> For example, from a script, I want to run smbclient then send it the
> username, password, and then some commands. (I know there are better ways
> to achieve this funct
Lonnie Princehouse wrote:
>>Beautiful is better than ugly.
>>Explicit is better than implicit.
>>
>>>Err... I see no contradiction nor conflict here.
>
>
> What to do when explicit is ugly and implicit is beautiful?
Depends on your understanding of explicit/implicit.
Side effects on globals o
Ilias Lazaridis wrote:
> Where can I find practical coding examples for real life coding problems?
Probably in real life code ?-)
> Something like a categorized solution guide?
Look for the Python cookbook (google is your friend).
> -
>
> My current problem:
>
> * create a folder
> * seems
Ministeyr wrote:
> Hello,
>
> os.walk doc: http://www.python.org/doc/2.4/lib/os-file-dir.html#l2h-1625
>
> When walking top to bottom, it allows you to choose the directories you
> want to visit dynamically by changing the second parameter of the tuple
> (a list of directories). However, since it
Rc wrote:
> "DaveM" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
>
>>On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI"
>><[EMAIL PROTECTED]> wrote:
>>
>>
>>>Après, vous pourrez aussi fréquenter le newsgroup :
>>> fr.comp.lang.python
>>>qui a l'avantage d'être en français.
>>
;no bar')
class MyClass1(object):
def __init__(self, bar=None):
if bar is not None:
self.bar = bar
self.baaz = DummyDescriptor()
mc1 = MyClass1(bar='back')
mc1.baaz
-> <__main__.DummyDescriptor object at 0x2bc6c390>
Which is of course what one would expe
[EMAIL PROTECTED] wrote:
> Hi folks,
>
> Of TurboGers & Django WAF candidates, which one would be easier to use
> in an environment where the data/content doesn't come an RDBMS, but
> from other server-side apps...
IMHO, both.
> If these are not good candidates, could
> you suggest appropriate
Ziga Seilnacht wrote:
> bruno at modulix wrote:
>
>>Hi
>>
>>I'm currently playing with some (possibly weird...) code, and I'd have a
>>use for per-instance descriptors, ie (dummy code):
>
>
>
>
>>Now the question: is there
Michael Spencer wrote:
> Bruno Desthuilliers wrote:
>
(snip)
>
>> BTW, there may be other use case for per-instance descriptors...
>
>
> Agreed. Per-instance descriptors could be interesting (that's why the
> subject line caught my attention).
> But your solution involves a custom __getattrib
Steven Bethard wrote:
> bruno at modulix wrote:
>
>> Hi
>>
>> I'm currently playing with some (possibly weird...) code, and I'd have a
>> use for per-instance descriptors,
(snip)
>>
>> class MyClass2(MyClass1):
>> def __getattrib
d
for some attributes, I need an instance per function call.
Duh :(
Well, at least I will have learn some new things...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split(
Steven Bethard wrote:
(snip code)
>
> But that looks pretty nasty to me.
> It sounds like your architecture
> could use some redesigning
Done - in much more sane way. Got rid of some more boilerplate and of
the whole problem of per-instance descriptors BTW !-)
I should probably sleep more
Ronny Mandal wrote:
> Is there a way of checking whether the call to a set-function is
> called from within the class, e.g. the __init__() contra
> .set()?
import inspect
help(inspect.stack)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[E
be of the same type, you cannot apply the
>>myop() operation on b2...
>
>
>
> Try looking at class-based objects as a form of CONTAINER...
ouch, my ears :(
> Two
> containers can be of the same type, but the contents may be different.
>
(snip)
This is mo
ces.
>
> But if you can't get away from it, here is another work-around that might
> help:
(snip)
And another one, that mess less with attributes (but more with lookup
rules - use it at your own risks !-):
class CompoundAttribute(object):
def __init__(self, *names):
self
401 - 500 of 607 matches
Mail list logo