Ciao Luca,
non ho controllato, ma "a naso" direi che un generatore, anche se definito
in line è un oggetto function, e come tale ha il suo namespace chiuso che
non può accedere all'esterno.
per usare un generatore in un contesto simile potresti fare una cosa così:
def iter_orari(self):
for s in sorted(self.orario.settimane):
yield self.orario.settimane[s]
for o in iter_orari(self):
print o
Il giorno 18 gennaio 2018 16:29, Luca <[email protected]> ha scritto:
> Il giorno 18 gennaio 2018 16:27, Luca <[email protected]> ha scritto:
>
>>
>> for o in (self.orario.settimane[s] for s in sorted(self.orario.settimane)]):
>>
>> print o
>>
>
>
> scusate era:
>
> for o in (self.orario.settimane[s] for s in sorted(self.orario.settimane)):
>
> print o
>
> --
> Luca
>
> _______________________________________________
> Python mailing list
> [email protected]
> https://lists.python.it/mailman/listinfo/python
>
>
_______________________________________________
Python mailing list
[email protected]
https://lists.python.it/mailman/listinfo/python