Am 26.04.2017 um 18:45 schrieb Simon Albrecht:
> Am 26.04.2017 um 18:36 schrieb Noeck:
>> Hi,
>>
>> in python you can add code under this condition:
>> if __name__ == "__main__"
>> This way it is only executed if this file is the main file that is
>> executed. If the file is only imported ("included"), this code is
>> skipped.
>>
>> There is nothing similar in LilyPond, is there?
>
> I’m pretty sure there isn’t. The parser doesn’t make any difference
> between whether code comes from an \include or not.
>
>>
>> I am asking because it would be handy to have a file soprano.ly with the
>> soprano notes which can be included to use them. And if it is run on its
>> own, it produces a score containing only the soprano voice.
>>
>> I know that I can do that with multiple files.
>
> Which is why there won’t probably be great need for such a feature. Is
> there anything about your setup that absolutely necessitates it?

I don't know about Joram's use case, but for openLilyLib this is pretty
crucial. Each package includes the oll-core package, but it should of
course be actually read/parsed only once. The same with modules. If a
package/module is already loaded explicitly or implicitly I don't want
it to be parsed again.

Urs

>
> Best, Simon
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user

-- 
[email protected]
https://openlilylib.org
http://lilypondblog.org


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to