Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72994 > unrolled thread

Re: Decorating one method of a class C with another method of class C?

Started byBen Finney <ben@benfinney.id.au>
First post2014-06-09 07:19 +1000
Last post2014-06-09 07:19 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Decorating one method of a class C with another method of class C? Ben Finney <ben@benfinney.id.au> - 2014-06-09 07:19 +1000

#72994 — Re: Decorating one method of a class C with another method of class C?

FromBen Finney <ben@benfinney.id.au>
Date2014-06-09 07:19 +1000
SubjectRe: Decorating one method of a class C with another method of class C?
Message-ID<mailman.10901.1402262405.18130.python-list@python.org>
Dan Stromberg <drsalists@gmail.com> writes:

> I'd like to have simple operations on that socket like "list
> configured hosts", "allow connection to host", etc. And I'd like them
> to be decorated with "reconnected_to_server_if_needed".

The ‘reconnected_to_server_if_needed’ method, if I understand
your original post correctly, does not need the class nor the class
instance. So you can define that function outside the class, and use it
for decorating methods within the class.

-- 
 \     “Teach a man to make fire, and he will be warm for a day. Set a |
  `\       man on fire, and he will be warm for the rest of his life.” |
_o__)                                                 —John A. Hrastar |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web