Most voted "decorator-pattern" questions
Decorator or wrapper, is a software design standard that allows you to add behavior to an already existing object at runtime, that is, dynamically aggregates additional responsibilities to an object. If the question is not about "Decorator", do not use this tag, even if you are using "Decorator" in your project.
Learn more…15 questions
Sort by count of
-
33
votes1
answer2909
viewsHow do Python decorators work?
The @Elizeu Santos asked in the group Python in facebook Portuguese the following: "Talk guys, I’m studying python and something I don’t understand are the decorators. I faced them making the flask…
-
7
votes1
answer492
viewsUnderstanding the pythonic way of dealing with properties
I am on time trying to understand how this issue of python properties works. But the problem is that in all the tutorials net out only find the damn example with only one attribute. I’m looking for…
python python-3.x getters-setters property decorator-patternasked 9 years, 5 months ago Devel Silva 73 -
7
votes1
answer102
viewsWhat are the differences between Decorators and Attributes?
I asked a question recently about the use of attributes that was introduced in PHP 8. Attributes to me end up not sounding like novelty, because I remember seeing something like that when I worked…
-
6
votes2
answers153
viewsHow to apply decorators that are classes in other class instance methods?
I’m trying to implement a class that’s a method Decorator python. The idea is to apply it to the methods of other classes. However, it is getting lost in the reference self of the annotated class…
-
3
votes1
answer858
viewsHow to use Ngmodule modules and decorator?
I have doubts about how to use the decorators of NgModule. What they are and what they’re for? How to create a separate module to load one or more libraries and components? For example, one to load…
-
2
votes0
answers93
viewsDecorator Pattern with Repository Pattern
Guys I have a need here and I’m having some difficulty to implement i have an application with Decorator Pattern and would like to update the data of my Components picking up the information…
-
2
votes1
answer700
viewsModel field processing before writing to the database (Python + Django)
I am trying to perform a password encryption using Python 3.7 and Django 2.1. Looking at the documentation of Python, Django and some answers here in Stackoverflow, I arrived at the code as follows,…
-
1
votes0
answers83
viewsReflection with Property Developer in typescript does not work
I am trying to create a developer (Nonexportable) to inform which fields of a class should not be exported. Follow code: nonexportable-decorators.ts const NON_EXPORTABLE_KEY =…
-
1
votes0
answers34
viewsAccessing private property with typescript Decorator
In Typescript, is it possible to access a private property from the developer? An example of the code I’ve already made class A { @dec private _teste: string = 'teste' constructor(){} public get…
-
0
votes1
answer64
viewsHow to share methods between presenters in Ruby on Rails 4
I would like to add methods to my model through a Presenter, but some methods are shared among other presenters. Ex: os métodos 'pode_ser_mostrado?', 'pode_ser_editado?', 'pode_ser_excluido?' What…
-
0
votes1
answer34
viewsRecursions in closures
# -*- coding: utf-8 -*- def memoize(limit, *, message = 'Limit exceded'): count = 0 def inner(func): cache = {} def wrapped(number): nonlocal count if count < limit: if number not in cache:…
-
0
votes1
answer20
viewsHow to use two API in Developer in Appweb Flask
I’m new in the world of programming and I’m wanting to delve into web application I would take a doubt. I made a resquests of a json dictionary of two different api. I want to put this data scraping…
-
0
votes1
answer119
views2 decorators in a Python method
Well, I have a very simple class called Task, where I want to store my tasks and then save in a bank. However, I want to go through the types of my attributes, I would like the task_name attribute…
-
0
votes0
answers37
viewsHow to implement python decorators to reuse code from a function?
Guys I’m trying to learn about decorators to help automate some repetitive routines. Initially, I have several functions that read files and transform each line of them into a Pyhton list depending…
-
-3
votes1
answer55
viewsError using Decorator in a Setter method
I’m trying to implement a simple Python code to practice using decorators in conjunction with advisory methods (Getters and Setters), but I’m getting an error. The code is as follows:: class…