Re: Nice solution wanted: Hide internal interfaces

2012-10-30 Thread andrea crotti
2012/10/30 alex23 wuwe...@gmail.com: On Oct 30, 2:33 am, Johannes Bauer dfnsonfsdu...@gmx.de wrote: I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created

Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some private methods of B and vice versa (i.e. what C++ friends

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread andrea crotti
2012/10/29 Johannes Bauer dfnsonfsdu...@gmx.de: Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Benjamin Kaplan
On Mon, Oct 29, 2012 at 9:33 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 3:33 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Grant Edwards
On 2012-10-29, Johannes Bauer dfnsonfsdu...@gmx.de wrote: I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some private

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
On 29.10.2012 17:47, Chris Angelico wrote: The usual convention for private methods is a leading underscore on the name: Yup, that's what I'm using. It's only a convention, though; it doesn't make it hard to call them, it just sends the message this is private, I don't promise that it'll be

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
On 29.10.2012 17:52, Grant Edwards wrote: By decleare them privide do you mean using __ASDF__ name-munging? It sounds to me like you're just making life hard on yourself. Gaah, you are right. I just noticed that using the single underscore (as I do) does not restrict usage in any

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Peter Otten
Johannes Bauer wrote: Now I want A to call some private methods of B and vice versa (i.e. what C++ friends are), but I want to make it hard for the user to call these private methods. Currently my ugly approach is this: I delare the internal methods private (hide from user). Then I have a

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Paul Rubin
Johannes Bauer dfnsonfsdu...@gmx.de writes: This makes the source files largish however (they're currently split up in different files). Can I use the nested class advantage and somehow include the inner class from another file? You could possibly duck-punch class A: import B class A:

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Peter Otten
Johannes Bauer wrote: On 29.10.2012 17:52, Grant Edwards wrote: By decleare them privide do you mean using __ASDF__ name-munging? It sounds to me like you're just making life hard on yourself. Gaah, you are right. I just noticed that using the single underscore (as I do) does not

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Grant Edwards
On 2012-10-29, Johannes Bauer dfnsonfsdu...@gmx.de wrote: On 29.10.2012 17:47, Chris Angelico wrote: The usual convention for private methods is a leading underscore on the name: Yup, that's what I'm using. It's only a convention, though; it doesn't make it hard to call them, it just sends

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 10:58 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Ah, that's nice. I didn't know that nested classes could access their private members naturally (i.e. without using any magic, just with plain old attribute access). There is nothing at all special about nested

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 17:33:24 +0100, Johannes Bauer wrote: Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread alex23
On Oct 30, 2:33 am, Johannes Bauer dfnsonfsdu...@gmx.de wrote: I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some