Skip to content

Commit 39aed8d

Browse files
committed
Reindexing Python stuff with category "Python"
This closes #2355. It so happens you didn't need to special-code a new category; as a matter of fact, there's a simple (if obscure) way of doing it, which I have used. Also correcting some accidental indexing somewhere else.
1 parent bf57d08 commit 39aed8d

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

doc/Language/grammars.pod6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ This comes in handy when you're already differentiating the proto regexes with
264264
the strings you're going to match, as using C«<sym>» token prevents repetition
265265
of those strings.
266266
267-
=head3 X«"Always succeed" assertion|<?>»
267+
X<|<?>>
268+
=head3 "Always succeed" assertion
268269
269270
The C«<?>» is the I<always succeed> assertion. When used as a grammar
270271
token, it can be used to trigger an Action class method. In the following

doc/Language/py-nutshell.pod6

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,11 @@ Many of the other unicode operators work as you would expect
263263
(exponents, fractions, π), but every unicode operator
264264
or symbol that can be used in Perl 6 has an ASCII equivalent.
265265
266-
=head2 Control flow
266+
=head2 X<Control flow|Python>
267267
268268
Python has C<for> loops and C<while> loops:
269269
270-
=for code :lang<python>
270+
=for code :lang<Python>
271271
for i in 1, 2:
272272
print i
273273
j = 1
@@ -346,7 +346,7 @@ Perl 6
346346
}
347347
348348
349-
=head2 Lambdas, functions and subroutines
349+
=head2 X<Lambdas, functions and subroutines|Python>
350350
351351
Declaring a function (subroutine) with C<def> in Python is accomplished
352352
with C<sub> in Perl 6.
@@ -452,9 +452,10 @@ i.e. these are the same:
452452
my $power = { $^x ** $^y };
453453
my $power = -> $x, $y { $x ** $y };
454454
455-
=head2 List comprehensions
455+
=head2 X<List comprehensions|Python>
456456
457-
Postfix statement modifiers and blocks can be combined to make list comprehensions.
457+
Postfix statement modifiers and blocks can be combined to make list
458+
comprehensions.
458459
459460
Python
460461
@@ -491,9 +492,10 @@ becomes either of these:
491492
Using C<map> (which is just like Python's C<map>) and
492493
C<grep> (which is like Python's C<filter>) is an alternative.
493494
494-
=head2 Classes and objects
495+
=head2 X<Classes and objects|Python>
495496
496-
Here's an example from the Python L<docs|https://docs.python.org/3/tutorial/classes.html#class-and-instance-variables>.
497+
Here's an example from the Python
498+
L<docs|https://docs.python.org/3/tutorial/classes.html#class-and-instance-variables>.
497499
First, "instance variables", aka attributes in Perl 6:
498500
499501
Python:
@@ -512,7 +514,7 @@ Perl 6:
512514
Constructors by default take named arguments in Perl 6,
513515
and use the method C<new>.
514516
515-
Python
517+
Python:
516518
517519
=for code :lang<python>
518520
d = Dog('Fido')
@@ -633,9 +635,7 @@ or
633635
...
634636
}
635637
636-
=head2 Decorators
637-
X<|Decorators (Python)>
638-
X<|@decorator (Python)>
638+
=head2 X<Decorators|Python>
639639
640640
Decorators in Python are a way of wrapping a function
641641
in another one. In Perl 6, this is done with C<wrap>.
@@ -685,15 +685,13 @@ An alternative would be to use a trait:
685685
686686
world;
687687
688-
=head2 Context managers
689-
X<|Context Managers (Python)>
690-
X<|with (Python)>
688+
=head2 X<Context managers|Python>
691689
692690
Context managers in Python declare actions that happen when entering
693691
or exiting a scope.
694692
695-
Here's a python context manager that prints the strings
696-
'hello', 'world', and 'bye':
693+
Here's a Python context manager that prints the strings
694+
'hello', 'world', and 'bye'.
697695
698696
=begin code :lang<python>
699697
class hello:
@@ -706,7 +704,7 @@ with hello():
706704
print 'world'
707705
=end code
708706
709-
For enter and exit events, passing a block as
707+
For "enter" and "exit" events, passing a block as
710708
an argument would be one option:
711709
712710
sub hello(Block $b) {
@@ -728,8 +726,7 @@ run on entering or leaving a block.
728726
say 'world';
729727
}
730728
731-
X<|input (Python)>
732-
=head2 Input
729+
=head2 X<C<input>|Python>
733730
734731
In Python 3, the C<input> keyword is used to prompt the user:
735732

0 commit comments

Comments
 (0)