Re: [Tutor] Where am I mistaken? (exec not working as I expect)

2017-03-15 Thread Francesco Loffredo via Tutor
On 14/03/2017, Steven D'Aprano wrote: But you do not need exec here at all. exec is a very powerful command, but you should treat it as for experts only. Instead of writing: exec("qqq = inspect.getmembers(xModel.%s)" % x) a much safer way is: qqq = inspect.getmembers(getattr(xModel,

[Tutor] Where am I mistaken? (exec not working as I expect)

2017-03-12 Thread Francesco Loffredo via Tutor
Hello everybody! I'm stuck in the effort to access some data fields in a LibreOffice Base form from a Python macro. I did only find a way to access the current document, but that's all. Armed with that, and hoping to find some field names, I wrote a small routine to inspect the types of all eleme

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-10 Thread Francesco Loffredo via Tutor
On 09/09/2015 19:45, Francesco Loffredo via Tutor wrote: On 09/09/2015 18:59, Oscar Benjamin wrote: I don't think the code above works. For n=27 it should count 117 (according to the formula I showed) but instead it comes up with 101. I tried it with a smaller n by setting pool to range(1

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-09 Thread Francesco Loffredo via Tutor
On 09/09/2015 18:59, Oscar Benjamin wrote: On 9 September 2015 at 12:05, Francesco Loffredo via Tutor wrote: A quick solution is to add one "dummy" letter to the pool of the OP's golfers. I used "!" as the dummy one. This way, you end up with 101 triples, 11 of which

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-09 Thread Francesco Loffredo via Tutor
Oscar Benjamin wrote: The problem is that there are 26 people and they are divided into groups of 3 each day. We would like to know if it is possible to arrange it so that each player plays each other player exactly once over some period of days. It is not exactly possible to