473,786 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set, Mark, and Apply Decoration

Set, Mark, and Apply Decoration

Provide a means to set the decoration that will be applied to all
marked functions (and maybe classes) within a scope (module, class,
or function).

For example purposes, I will use a decor object that would presumably
be made available in each scope (via locals, perhaps). I'll say that
it has (atleast[*]) a method set() with the following signature:

def set(self, *decorators, **attributes):
...

This method could be used to set/reset the decor, 0 to n times, within a
given scope. The decor of one scope would only be applicable within itself
and, perhaps, within its nested scopes. In this way, you could define a
region(s) wherein the same decoration(s) could be applied to marked
functions - there would be no need to repeat the decoration declarations
for functions that share the same decor.

The functions to be decorated (using the current decor) would be marked.
This demarcation could be done by a symbol or by a keyword. E.g.,

'<MARK> def foo():' OR 'def <MARK> foo():' OR 'def foo() <MARK>:'
Where <MARK> can be replaced by whatever is deemed the least objectionable
symbol or keyword. For example purposes, I'll use 'def *foo():'.

I'll give an example, now, showing this proposal side by side with the
current decoration scheme:

# current scheme # proposed scheme
class A(object): class A(object):
# static methods # static methods
@staticmethod decor.set(stati cmethod)
def f(): def *f():
pass pass
@staticmethod def *g():
def g(): pass
pass ...
... ...
# undecorated # undecorated
def h(): def h():
pass pass

# class methods # class methods
@classmethod decor.set(class method)
def i(): def *i():
pass pass
@classmethod def *j():
def j(): pass
pass ...
... ...
# garish # garish
D = compose(A,B,C, decor.set(A,B,C ,
funcattrs(d='d' , d='d',e='e',f=' f'
e='e',f='f')) def *k():
@D pass
def k(): def *l():
pass pass
@D ...
def l(): ...
pass ...
NOTE: That garish one is *much* worse if you don't use function composition.
[*]
You might want a way to clear the decor, or a way to add or remove
decorations without resetting the entire decor, or a way to ask what
the current decor is, if any.

Jul 18 '05 #1
0 1186

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
6374
by: Andrew Tang | last post by:
Hi, I need some help with understanding this piece of css. <u>This is a <a href="#" style="text-decoration:none;">hyperlink</a> with surrounding underlining</u> From what I understand of css, the styling in <a> should override its parent. But it doesnt seem to work in this case, the whole sentence is still underlined even though I have specifically specified no text-decoration. I'm not saying its wrong but I really cant get my head...
3
4506
by: Christian Roth | last post by:
What I want: <p style="text-decoration: line-through"> Stricken <span style="text-decoration: none">not stricken</span> </p> , where "Stricken " should be the only thing that is lined through. According to CSS2.1, this does not work (and all browsers I tested draw
6
14969
by: Big Bill | last post by:
Doesn't seem to work as I still get an underline. Is there a reason for this? Is this normal? You can see examples on my site. BB -- www.kruse.co.uk/ seo@kruse.demon.co.uk seo that watches the river flow... --
8
2583
by: Bern | last post by:
hi all, what is the rule for decorating a symbol in c++?
2
6018
by: mike | last post by:
I am looking for the javascript equivalent of: style="text-decoration:underline;" in a span tag created dynamically. I was thinking it was: mySPAN.style.text-decoration="underline"; but that should fail because "text-decoration" is not going to be recognized.
2
7545
by: chandy | last post by:
Hi, I am trying to access the text-decoration property for an element's style. I know that this works: Object.style.color = 'blue'; but this doesn't:
2
16179
by: Francesco Moi | last post by:
Hi. I want to create a link within a H1 text: --- <h1><a href=foo>text</a></h1> --- And I've got (in my CSS) --- h1
2
7068
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so the entire block is clickable, not just the text. I've sorta got it so it's clickable, just some parts of the button I still can't click on. The website is http://pdhtdev.johnabbott.qc.ca/students/2010/james_mann/portfolio/index.htm The css...
1
3109
by: webster5u | last post by:
Hi, i need apply two different hyperlink:hover style cause by different background color. what i do is, i put css external link as a:hover.paging { color: #cc0000; text-decoration: none; }
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.