On Sep 23, 5:57 pm, exar...@twistedmatrix.com wrote:
> On 06:08 am, jacopo.pe...@gmail.com wrote:
>
> >I am diving into Twisted and Perspective Broker (PB) in particular and
> >I would like to understand more about what happens behind the
> >curtains.
> >Say I have a client and a server on two diff
On 06:08 am, jacopo.pe...@gmail.com wrote:
I am diving into Twisted and Perspective Broker (PB) in particular and
I would like to understand more about what happens behind the
curtains.
Say I have a client and a server on two different machines, the server
gets callRemote() 19s in an asynchronous
them in a queue? To me it looks like
there should be at least 2 processes, one for the reactor and on for
the rest.
In the documentation they keep stressing how one of the peculiarity of
the reactor pattern is the single thread, but I can not figure out
how.
Any suggestion would be welcome.
For the
a...@pythoncraft.com (Aahz) writes:
> Guess what? Prior to DejaNews, discussions on Usenet *were* ephemeral,
> and it all worked.
Not really, Usenet was archived before DejaNews arrived on the scene.
I can find plenty of my posts from before then. Regardless, Usenet
works better now that searcha
In article <024d7a38$0$20654$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>Dennis Lee Bieber wrote:
>> On Sat, 20 Jun 2009 13:47:24 -0700 (PDT), Bearophile
>> declaimed the following in
>> gmane.comp.python.general:
>>>
>>> Dennis Lee Bieber, may I ask why most or all your posts are set t
Dennis Lee Bieber wrote:
> On Sat, 20 Jun 2009 13:47:24 -0700 (PDT), Bearophile
> declaimed the following in
> gmane.comp.python.general:
>
>> This is a small OT post, sorry.
>>
>> Dennis Lee Bieber, may I ask why most or all your posts are set to "No-
>> Archive"?
>>
> Taking into account som
This is a small OT post, sorry.
Dennis Lee Bieber, may I ask why most or all your posts are set to "No-
Archive"?
> HTTP://www.bestiaria.com/
I think there are other furries beside you around here.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> On Fri, 19 Jun 2009 17:52:05 -0700 (PDT), Terminator
> declaimed the following in
> gmane.comp.python.general:
>
>> Hello,
>> My requierment is to get the "Stick Tag" value from the below o/p and
>> based on tag take different actions. What is the best way to implement
Hello,
My requierment is to get the "Stick Tag" value from the below o/p and
based on tag take different actions. What is the best way to implement
it. I am new to Python, so appreciate any input.
Command o/p:
===
File: Packet.tcl
Peter Otten wrote:
Terry Reedy wrote:
>>> a,b,*rest = list(range(10))
The list() call is superfluous.
Agreed, even in Py3 when range() returns a range object rather than a list.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, May 28, 2009 at 3:57 PM, Terry Reedy wrote:
> guthrie wrote:
>>
>> I want to do a functional like pattern match to get teh first two
>> elements, and then the rest of an array return value.
>>
>> For example, assume that perms(x) returns a list of
Terry Reedy wrote:
> >>> a,b,*rest = list(range(10))
The list() call is superfluous.
--
http://mail.python.org/mailman/listinfo/python-list
Many thanks to all; perfect solution!
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 28 May 2009 18:57:42 -0400, Terry Reedy wrote:
> >>> a,b,*rest = list(range(10))
That fails in Python 2.5 and 2.6.
>>> a,b,*rest = list(range(10))
File "", line 1
a,b,*rest = list(range(10))
^
SyntaxError: invalid syntax
--
Steven
--
http://mail.python.org/mailman/li
Terry Reedy:
> >>> a,b,*rest = list(range(10))
> >>> a,b,rest
> (0, 1, [2, 3, 4, 5, 6, 7, 8, 9])
> >>> a,*rest,b = 'abcdefgh'
> >>> a,rest,b
> ('a', ['b', 'c', 'd', 'e', 'f', 'g'], 'h')
For the next few years I generally suggest to specify the Python
version too (if it's 2.x or 3.x).
This is P
On May 28, 5:43 pm, guthrie wrote:
> I want to do a functional like pattern match to get teh first two
> elements, and then the rest of an array return value.
>
> For example, assume that perms(x) returns a list of values, and I want
> to do this:
> seq=perms(x)
>
>
guthrie wrote:
I want to do a functional like pattern match to get teh first two
elements, and then the rest of an array return value.
For example, assume that perms(x) returns a list of values, and I want
to do this:
seq=perms(x)
a = seq[0]
b = seq[1]
rest = seq[2:]
Of course
I want to do a functional like pattern match to get teh first two
elements, and then the rest of an array return value.
For example, assume that perms(x) returns a list of values, and I want
to do this:
seq=perms(x)
a = seq[0]
b = seq[1]
rest = seq[2:]
Of course I can shorten to
):
for root, dirs, files in os.walk(src_dir):
for file in files:
# feedback for the CLI
LOG.info("scanning %s %s", root, file)
# check for file pattern here
if os.path.exists(file2):
# feedback f
(src_dir):
for file in files:
# feedback for the CLI
LOG.info("scanning %s %s", root, file)
# check for file pattern here
if os.path.exists(file2):
# feedback for the CLI
LOG.info("f
LOG = logging.getLogger()
>
> def find_files(src_dir):
> for root, dirs, files in os.walk(src_dir):
> for file in files:
> # feedback for the CLI
> LOG.info("scanning %s %s", root, file)
> # check for file patter
in files:
# feedback for the CLI
LOG.info("scanning %s %s", root, file)
# check for file pattern here
if os.path.exists(file2):
# feedback for the CLI
LOG.info("f
Thanks for your advice.
I studied python from the tutorial and the library manual, and I think
I am familiar enough with Python's grammar and API. That's why I
never thought I need to read a book of Python.
But if "Programming Python" also explains OO, I would be happy to read
it.
In fact, I am
On Apr 3, 7:34 pm, 一首诗 wrote:
> #
> # Choice 2
> #
>
> class UserManager:
>
> users = []
>
> @classmethod
> def delUser(cls, user):
> cls.users.remove(user)
>
> RoleManager.onUserDel(user)
>
> class RoleManager:
>
> roles = []
>
>
_del_funcs = []
roles = []
def del(self):
user_dict.pop(self.name)
for f in self.on_del_funcs:
f(self)
# Using Observer Pattern to notify this user is deleted.
def addUserDelListener(self, on_del_func):
on_del_funcs.append(on_del_funcs)
def delUserD
Austin Schutz wrote:
>
> I have a fairly simple bit of code, something like:
>
> # This should be importing the subclasses somehow, so that the factory
> # can make them.
> # import Parser.One
> # import Parser.Two
> # or.. from Parser import *?
> class Parser():
>def parse:
> 'Impleme
On Thu, Mar 19, 2009 at 6:52 PM, Austin Schutz wrote:
>
> I have a fairly simple bit of code, something like:
>
> # This should be importing the subclasses somehow, so that the factory
> # can make them.
> # import Parser.One
> # import Parser.Two
> # or.. from Parser import *?
> class Parser():
I have a fairly simple bit of code, something like:
# This should be importing the subclasses somehow, so that the factory
# can make them.
# import Parser.One
# import Parser.Two
# or.. from Parser import *?
class Parser():
def parse:
'Implemented only in subclass'
def make_parser
upto_1st_closed_parenth[i].count('(')
#expand the pattern to get all of the prototype
#ie upto the last closed parenthesis
#saying something like
pattern = re.compile(\
'match_upto_1st_closed_parenth[i]+\
ompile('\w+::\w+\([^)]*\)')
match_upto_1st_closed_parenth=
re.findall(pattern_upto_1st_closed_parenth,txt)
num_of_protos = len(match_upto_1st_closed_parenth)
for i in range (0,num_of_protos-1):
num_of_open_parenths = match_upto_1st_closed_parenth[i].count('(')
#expand the
Antoon Pardon wrote:
> On 2008-12-31, TP wrote:
>> Hi everybody,
>>
>> I would like to change only the nth occurence of a pattern in a
string. The
>> problem with "replace" method of strings, and "re.sub" is that we
can only
>> define t
On 2008-12-31, TP wrote:
> Hi everybody,
>
> I would like to change only the nth occurence of a pattern in a string. The
> problem with "replace" method of strings, and "re.sub" is that we can only
> define the number of occurrences to change from the first on
I would like to change only the nth occurence of a pattern in
a string. The problem with "replace" method of strings, and
"re.sub" is that we can only define the number of occurrences
to change from the first one.
v="coucou"
v.replace("o","i&q
On Wed, 31 Dec 2008 15:40:32 +0100, TP wrote:
> Hi everybody,
>
> I would like to change only the nth occurence of a pattern in a string.
> The problem with "replace" method of strings, and "re.sub" is that we
> can only define the number of occurrences to c
In article <0scs26-7a5@rama.fbx.proxad.net>,
TP wrote:
> Hi everybody,
>
> I would like to change only the nth occurence of a pattern in a string.
It's a little ugly, but the following looks like it works. The gist is to
split the string on your pattern, then re-j
Hi everybody,
I would like to change only the nth occurence of a pattern in a string. The
problem with "replace" method of strings, and "re.sub" is that we can only
define the number of occurrences to change from the first one.
>>> v="coucou"
>>
Slaunger wrote:
Hi Gerard,
This definitely looks like a path to walk along, and I think your code
does the trick, although I have to play a little around with the
groupby method, of which I had no prior knowledge. I think I will
write some unit test cases to stress test you concept (on Monday, wh
Anton Vredegoor wrote:
On Fri, 21 Nov 2008 18:10:02 +0100
Gerard flanagan <[EMAIL PROTECTED]> wrote:
data = '''
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3
So I think you just need to find the first two complete sequences of
1,6,10 and 0,3,9, remove any repetitions and then you're done.
data = '''
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 7 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3
On 21 Nov., 18:10, Gerard flanagan <[EMAIL PROTECTED]> wrote:
> Slaunger wrote:
> > Hi all,
>
> > I am a Python novice, and I have run into a problem in a project I am
> > working on, which boils down to identifying the patterns in a sequence
> > of integers, for example
>
> > 1 6 6 1 6 6 1 6
On 21 Nov., 23:36, Mensanator <[EMAIL PROTECTED]> wrote:
> Your rules appear to be incomplete and inconsistent.
OK. Let me try to clarify then...
> > 3. Pattern A only consists of the numbers 0, 3, and 9. 3, 3 is always
> > followed by 0
>
> But does a 3 always follow a
>
> > I am pretty sure I can figure out how to do that, but I would like to
> > have some guidance on the most pythonic approach to this.
>
> Then it would be a good starting point to write some code. Then you
> could post it and ask how it can be made more 'pythonic'.
>
That is actually a good poi
On Fri, 21 Nov 2008 18:10:02 +0100
Gerard flanagan <[EMAIL PROTECTED]> wrote:
> data = '''
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 1
e incomplete and inconsistent.
>
> The rules for the sequence is:
> 1. The sequence may start in the middle of a pattern
> 2. There are one or two patterns, Pattern A and Pattern B in the
> sequence
> 3. Pattern A only consists of the numbers 0, 3, and 9. 3, 3 is always
> followed by
Slaunger <[EMAIL PROTECTED]> writes:
> I am a Python novice, and I have run into a problem in a project I am
> working on, which boils down to identifying the patterns in a sequence
> of integers, for example
>
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1
Haven't followed the entire thread, so I could be making a silly,
out-of-place remark, and apologies in advance for the same.However, to me it
looks like Slaunger wants to find 2 of the longest repeating patterns, and
not just 2 specific patterns (though from the introductory test, it appears
to be
Slaunger wrote:
Hi all,
I am a Python novice, and I have run into a problem in a project I am
working on, which boils down to identifying the patterns in a sequence
of integers, for example
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6
king for a "solution" to this specific problem, just some
guidance
The rules for the sequence is:
1. The sequence may start in the middle of a pattern
2. There are one or two patterns, Pattern A and Pattern B in the
sequence
3. Pattern A only consists of the numbers 0, 3, and 9. 3, 3 is al
arnestness requesting that None+42 == None, None() == None, and so
on. This Nonesense was wisely rejected
I agree with that decision. However, the behaviour you specify *is*
useful (though I don't think ‘None’ should have that behaviour). It is
the “Null object” design pattern, and may be
Ben Finney wrote:
Terry Reedy <[EMAIL PROTECTED]> writes:
We're not going to add the "feature" back that None compares smaller
than everything. It's a slippery slope that ends with all operations
involving None returning None -- I've seen a proposal made in all
earnestness requesting that None+
earnestness requesting that None+42 == None, None() == None, and so
> on. This Nonesense was wisely rejected
I agree with that decision. However, the behaviour you specify *is*
useful (though I don't think ‘None’ should have that behaviour). It is
the “Null object” design pattern, and may be
Really helpful!
2008/9/28 Mikolai Fajer <[EMAIL PROTECTED]>:
> The following link directly discusses using MVC and pygame.
>
> http://ezide.com/games/writing-games.html
>
> --
>
> -Mikolai Fajer-
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/lis
The following link directly discusses using MVC and pygame.
http://ezide.com/games/writing-games.html
--
-Mikolai Fajer-
--
http://mail.python.org/mailman/listinfo/python-list
Howdy,
I am working on a small PC game by using pygame. Since there are many
graphical objects to display and intensive user interactions, I would
like to employ MVC pattern to keep the system maintainable.
However, I cannot find a good article which discussing the general
knowledge about MVC
In article
<[EMAIL PROTECTED]>,
Jonathan Gardner <[EMAIL PROTECTED]> wrote:
> On Jun 27, 10:32 am, "David C. Ullrich" <[EMAIL PROTECTED]> wrote:
> > (ii) The regexes in languages like Python and Perl include
> > features that are not part of the formal CS notion of
> > "regular expression". Do t
On Jun 27, 10:32 am, "David C. Ullrich" <[EMAIL PROTECTED]> wrote:
> (ii) The regexes in languages like Python and Perl include
> features that are not part of the formal CS notion of
> "regular expression". Do they include something that
> does allow parsing nested delimiters properly?
>
In perl,
In article
<[EMAIL PROTECTED]>,
Dan <[EMAIL PROTECTED]> wrote:
> On Jun 27, 1:32 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote:
> > In article
> > <[EMAIL PROTECTED]>,
> > Jonathan Gardner <[EMAIL PROTECTED]> wrote:
> >
> > > On Jun 26, 3:22 pm, MRAB <[EMAIL PROTECTED]> wrote:
> > > > Try so
Le Monday 30 June 2008 10:52:24 Casey McGinty, vous avez écrit :
> I'm running into a slight problem however that my run-time defined logging
> level is not correctly set until after the module has initialized,
> preventing any log messages from showing up. Is there a pythonic way to get
> around t
On Fri, Jun 27, 2008 at 5:25 PM, Maric Michaud <[EMAIL PROTECTED]> wrote:
> Yes it is, but it's rather unneeded in Python, we prefer simply create a
> module level dictionnary, these tricks are used in language like C++ or
> Java.
>
> In python :
>
> mymodule.py :
>
> ModuleOptions = {}
>
> otherm
Le Saturday 28 June 2008 03:47:43 Casey McGinty, vous avez écrit :
> On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]>
>
> wrote:
> > Hi,
> >
> > I'm trying to implement a simple Borg or Singleton pattern for a class
> > that inherits
On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I'm trying to implement a simple Borg or Singleton pattern for a class that
> inherits from 'dict'. Can someone point out why this code does not work?
>
> class MyDict( dict
Hi,
I'm trying to implement a simple Borg or Singleton pattern for a class that
inherits from 'dict'. Can someone point out why this code does not work?
class MyDict( dict ):
__state = {}
def __init__(self):
self.__dict__ = self.__state
a = MyDict()
a['one'
On Jun 27, 1:32 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote:
> In article
> <[EMAIL PROTECTED]>,
> Jonathan Gardner <[EMAIL PROTECTED]> wrote:
>
> > On Jun 26, 3:22 pm, MRAB <[EMAIL PROTECTED]> wrote:
> > > Try something like:
>
> > > re.compile(r'.*?', re.DOTALL)
>
> > So you would pick up s
In article
<[EMAIL PROTECTED]>,
Jonathan Gardner <[EMAIL PROTECTED]> wrote:
> On Jun 26, 3:22 pm, MRAB <[EMAIL PROTECTED]> wrote:
> > Try something like:
> >
> > re.compile(r'.*?', re.DOTALL)
>
> So you would pick up strings like "foo td>"? I doubt that is what oyster wants.
I asked a question
On Jun 26, 3:22 pm, MRAB <[EMAIL PROTECTED]> wrote:
> Try something like:
>
> re.compile(r'.*?', re.DOTALL)
So you would pick up strings like "foo"? I doubt that is what oyster wants.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 26, 11:07 am, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2008-06-26, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> >
> > Why not use an HTML parser instead?
> >
>
> Stating it differently: in order to correctly recognize HTML
> tags, you must use an HTML parser. Trying to write an HTML
> pa
no TABLE tag between a TABLE, for example
> > > something with out table tag
> > > what is the RE pattern? thanks
>
> > > the following is not right
> > > [^table]*?
>
> > The construct [abc] does not match a whole word but only one char, so
>
In article <[EMAIL PROTECTED]>,
Cédric Lucantis <[EMAIL PROTECTED]> wrote:
> Le Thursday 26 June 2008 15:53:06 oyster, vous avez écrit :
> > that is, there is no TABLE tag between a TABLE, for example
> > something with out table tag
> > what is the RE pattern
On 2008-06-26, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> oyster wrote:
>> that is, there is no TABLE tag between a TABLE, for example
>> something with out table tag
>> what is the RE pattern? thanks
>>
>> the following is not right
>> [^table]*?
>
oyster wrote:
> that is, there is no TABLE tag between a TABLE, for example
> something with out table tag
> what is the RE pattern? thanks
>
> the following is not right
> [^table]*?
Why not use an HTML parser instead? Try lxml.html.
http://codespeak.net/lxml/
Stefan
--
http
Le Thursday 26 June 2008 15:53:06 oyster, vous avez écrit :
> that is, there is no TABLE tag between a TABLE, for example
> something with out table tag
> what is the RE pattern? thanks
>
> the following is not right
> [^table]*?
The construct [abc] does not match a whole word
that is, there is no TABLE tag between a TABLE, for example
something with out table tag
what is the RE pattern? thanks
the following is not right
[^table]*?
--
http://mail.python.org/mailman/listinfo/python-list
> Fair enough. To help you understand the method I used, I'll give you
> this hint. It's true that regex on works on strings. However, is there
> any way to convert arbitrarily complex data structures to string
> representations? You don't need to be an experienced Python user to
> answer to this ;
something like:
>
> > > Another solution is to use a better (different) language, that has
> > > built-in pattern matching, or allows to create one.
>
> > > Bye,
> > > bearophile
>
> > Btw, Python's stdlib includes a regular expression lib
On Jun 20, 1:45 am, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote:
>
> > Kirk Strauser:
>
> > > Hint: recursion. Your general algorithm will be something like:
>
> > Another solution is to use a better (different) language,
On Jun 20, 1:44 am, Chris <[EMAIL PROTECTED]> wrote:
> Thanks for your help. Those weren't quite what I was looking for, but
> I ended up figuring it out on my own. Turns out you can actually
> search nested Python lists using simple regular expressions.
Strange?
How do you match nested '[' ... ']
On Jun 20, 10:45 am, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote:
>
> > Kirk Strauser:
>
> > > Hint: recursion. Your general algorithm will be something like:
>
> > Another solution is to use a better (different) language,
George Sakkis <[EMAIL PROTECTED]> writes:
> For example, consider the container methods __len__, __iter__ and
> __contains__. The obvious choice for a null container is an empty
> one. When taking __getitem__ into account though, the behaviour
> looks inconsistent:
> >>> Null[3]
> Null
>
On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote:
> Kirk Strauser:
>
> > Hint: recursion. Your general algorithm will be something like:
>
> Another solution is to use a better (different) language, that has
> built-in pattern matching, or allows to create one.
>
> Bye,
Thanks for your help. Those weren't quite what I was looking for, but
I ended up figuring it out on my own. Turns out you can actually
search nested Python lists using simple regular expressions.
--
http://mail.python.org/mailman/listinfo/python-list
I'd like to extend the Null pattern from
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205 to
handle special methods (e.g. Null[3], del Null['key'], Null+1) but
it's not always clear how to do it while keeping the behavior
consistent and intuitive.
For example, co
a situation where one class can be customized with several
> > > > orthogonal options. Currently this is implemented with (multiple)
> > > > inheritance but this leads to combinatorial explosion of subclasses as
> > > > more orthogonal features are added. Natu
Kirk Strauser:
> Hint: recursion. Your general algorithm will be something like:
Another solution is to use a better (different) language, that has
built-in pattern matching, or allows to create one.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
At 2008-06-17T05:55:52Z, Chris <[EMAIL PROTECTED]> writes:
> Is anyone aware of any prior work done with searching or matching a
> pattern over nested Python lists? I have this problem where I have a
> list like:
>
> [1, 2, [1, 2, [1, 7], 9, 9], 10]
>
> and I'd l
Maric Michaud wrote:
Le Monday 16 June 2008 20:35:22 George Sakkis, vous avez écrit :
On Jun 16, 1:49 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote:
[...]
variation of your toy code. I was thinking the Strategy pattern,
different classes have different initialisation strategies? But th
Is anyone aware of any prior work done with searching or matching a
pattern over nested Python lists? I have this problem where I have a
list like:
[1, 2, [1, 2, [1, 7], 9, 9], 10]
and I'd like to search for the pattern [1, 2, ANY] so that is returns:
[1, 2, [1, 2, [6, 7], 9, 9], 10]
[1,
Le Tuesday 17 June 2008 05:10:57 Maric Michaud, vous avez écrit :
> The class complextiy problem is actually solved by :
>
> inst_with_alg1 = MyClassUsingStrategies((algo1_strategy,),
> (algo1_strategy,)) inst_with_alg1_alg2 = MyClassUsingStrategies(
>
his is implemented with (multiple)
> > > inheritance but this leads to combinatorial explosion of subclasses as
> > > more orthogonal features are added. Naturally, the decorator pattern
> > > [1] comes to mind (not to be confused with the the Python meaning of
> >
ial explosion of subclasses as
> > more orthogonal features are added. Naturally, the decorator pattern
> > [1] comes to mind (not to be confused with the the Python meaning of
> > the term "decorator").
>
> > However, there is a twist. In the standard decorat
George Sakkis wrote:
I have a situation where one class can be customized with several
orthogonal options. Currently this is implemented with (multiple)
inheritance but this leads to combinatorial explosion of subclasses as
more orthogonal features are added. Naturally, the decorator pattern
[1
> Ok, I see how this would work (and it's trivial to make it cache the
> generated classes for future use) but I guess I was looking for a more
> "mainstream" approach, something that even a primitive statically
> typed language could run :) Even in Python though, I think of Runtime
> Type Generati
ultiple)
> >> inheritance but this leads to combinatorial explosion of subclasses as
> >> more orthogonal features are added. Naturally, the decorator pattern
> >> [1] comes to mind (not to be confused with the the Python meaning of
> >> the term "d
ore orthogonal features are added. Naturally, the decorator pattern
>> [1] comes to mind (not to be confused with the the Python meaning of
>> the term "decorator").
>>
>> However, there is a twist. In the standard decorator pattern, the
>> decorator accepts the
lasses as
| more orthogonal features are added. Naturally, the decorator pattern
| [1] comes to mind (not to be confused with the the Python meaning of
| the term "decorator").
|
| [1] http://en.wikipedia.org/wiki/Decorator_pattern
I read the first part of the article. The following
&qu
George Sakkis schrieb:
I have a situation where one class can be customized with several
orthogonal options. Currently this is implemented with (multiple)
inheritance but this leads to combinatorial explosion of subclasses as
more orthogonal features are added. Naturally, the decorator pattern
I have a situation where one class can be customized with several
orthogonal options. Currently this is implemented with (multiple)
inheritance but this leads to combinatorial explosion of subclasses as
more orthogonal features are added. Naturally, the decorator pattern
[1] comes to mind (not to
Alan Isaac <[EMAIL PROTECTED]> writes:
> OK, thanks.
>
> Another approach is to begin with a set of stocks
>
> and remove them as they report. You can then trigger
>
> a report with the empty set instead of repeatedly
>
> calling ``all``. After a report the set can be
>
> "refilled".
Ah, and I
Alan Isaac <[EMAIL PROTECTED]> writes:
> Here is one way:
>
> - for each fund, create a ``reportreceived`` dict that maps stocks to
> booleans (initially False)
> - as each stock notifies its funds, the fund changes False to True and checks
> ``all(reportreceived.values())`` to determine whethe
J. Cliff Dyer wrote:
looks like a good approach to me
OK, thanks.
Another approach is to begin with a set of stocks
and remove them as they report. You can then trigger
a report with the empty set instead of repeatedly
calling ``all``. After a report the set can be
"refilled".
Cheer
heers,
Cliff
On Fri, 2008-05-09 at 13:51 +, Alan Isaac wrote:
> A question related to the observer pattern...
>
> Suppose I have a variant: there are stocks, mutual funds, and investors. Let
> us say that funds are observers for multiple stocks, and investors are
> observer
501 - 600 of 898 matches
Mail list logo