diff --git a/src/doc/doc/about/expressions.xml b/src/doc/doc/about/expressions.xml
index 939f07040..f7e405c48 100644
--- a/src/doc/doc/about/expressions.xml
+++ b/src/doc/doc/about/expressions.xml
@@ -4,9 +4,11 @@
- Beside a ruby programming API, KLayout provides support for simple expressions in some places.
+ Beside a ruby and Python programming API, KLayout provides support for simple expressions in some places.
In particular this feature is employed to generate dynamic strings, for example when deriving the
label text for a ruler.
-shape.box_width = 20 -+
shape.box_width = 20-
Boolean predicates (like "is_box?") are used without the question mark because that is reserved +
+ Boolean predicates (like "is_box?") are used without the question mark because that is reserved for the decision operator (".. ? .. : .."):
--shape.is_box -+
shape.is_box
+ Most methods support keyword arguments similar to Python. For example you can write: +
+ +CplxTrans.new(rot = 45.0)+ +
+ This is more explicit than writing the individual arguments and allows giving + one argument without having to insert the default values for the previous ones. +
+ ++ Keyword arguments are not supported for the built-in functions such as "sqrt" and + a few built-in methods. +
+diff --git a/src/doc/doc/programming/python.xml b/src/doc/doc/programming/python.xml index 6eb8449d6..9389c848b 100644 --- a/src/doc/doc/programming/python.xml +++ b/src/doc/doc/programming/python.xml @@ -217,6 +217,21 @@ for edge in edges: +
Most methods support keyword arguments, for example:
+ +# a 45 degree rotation +t = pya.CplxTrans(rot = 45)+ +
+ Exceptions are some built-in methods like "assign". Keyword arguments can be used + when the non-optional arguments are specified either as positional or other keyword + arguments. +
+ +"x.to_s()" is available as "str(x)" too.
diff --git a/src/doc/doc/programming/ruby_binding.xml b/src/doc/doc/programming/ruby_binding.xml index 655f395de..8a6cb782c 100644 --- a/src/doc/doc/programming/ruby_binding.xml +++ b/src/doc/doc/programming/ruby_binding.xml @@ -408,6 +408,22 @@ A::new.f(x) omitted, the default value is used instead. ++ Starting with version 3, Ruby supports "real" keyword arguments. + Keyword arguments are supported for most methods with the exception of a few built-in ones such as "assign". + Keyword arguments can be used when the other, non-optional arguments are given either by + positional arguments or other keyword arguments. +
+ ++ Keyword arguments are somewhat more expressive and allow a shorter notation. For example, + to instantiate a 45 degree rotation, you can write: +
+ +t = RBA::CplxTrans::new(rot: 45)+