Questions tagged [slots]

`__slots__` is a python language feature to reduce size of object instances by dropping the builtin dictionary every python instance normally features in order to support dynamic assignment of attributes and replacing it with a fixed set of attributes (the 'slots').

__slots__ is a python language feature to reduce size of object instances by dropping the builtin dictionary every python instance normally features in order to support dynamic assignment of attributes and replacing it with a fixed set of attributes (the 'slots'). See: https://docs.python.org/2/reference/datamodel.html#slots

306 questions
2
votes
2 answers

Vue 3 cli-service app: "Slot "default" invoked outside of the render function" warning when component with slots is imported from other component

MCVE I have a Tabpane component that takes slots as input. When imported from the template it works as expected.
Div 1
Div 2
However when imported from an…
hyperbotauthor
  • 307
  • 1
  • 4
  • 13
2
votes
1 answer

Jest / Vue test utils - Method coming from subcomponent scoped slot - [Vue warn]: Invalid handler for event "click": got undefined

I'm trying to test one of my component which calls a subcomponent (ie. b-modal). My tested component uses scoped slots from b-modal to grab the close() method from it and attach it to another event listener. Have a look : // My custom parent…
Franck
  • 560
  • 7
  • 20
2
votes
1 answer

What is the canonical way to type empty __slots__ (or empty tuple)?

If I type slots: class Foo: __slots__: Tuple[()] = tuple() Then, in strict mode, mypy (0.812) tells me: Incompatible types in assignment (expression has type "Tuple[, ...]", variable has type "Tuple[]") I can write: __slots__:…
shaunc
  • 5,317
  • 4
  • 43
  • 58
2
votes
1 answer

Python Metaclass defining __slots__ makes __slots__ readonly

In the following example I try to create a python metaclass which init's my class with __slots__ and default values. class Meta(type): def __new__(cls, name, bases, dictionary, defaults): dictionary['__slots__'] = list(defaults.keys()) …
2
votes
1 answer

How to update tree view with VUE

I have a problem on a tree components structure managerment. Like a tree have many nodes, when I delete a node, the render function is run , but the page does not display the correct info according to the tree data. I attached the source code here,…
Chen Hao
  • 23
  • 5
2
votes
1 answer

Vue.js slots - how to retrieve slot content in computed properties

I have a problem with vue.js slots. On one hand I need to display the slot code. On the other hand I need to use it in a textarea to send it to external source. main.vue