Skip to content

Commit f846602

Browse files
author
Release Manager
committed
gh-35850: Remove mention of defunct magic command "%bg" from the tutorial Remove the defunct magic command "%bg" from the tutorial <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description The magic command "%bg" has not been part of IPython for some time, so we should remove it from the tutorial. (See https://stackoverflow.com/questions/10819479/missing-background-magic- command-bg-in-ipython and ipython/ipython#844.) This fixes #35836. <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35850 Reported by: John H. Palmieri Reviewer(s):
2 parents f41eb7d + 1db16b8 commit f846602

File tree

4 files changed

+0
-110
lines changed

4 files changed

+0
-110
lines changed

src/doc/en/tutorial/interactive_shell.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -383,33 +383,6 @@ IPython documentation <http://ipython.scipy.org/moin/Documentation>`_.
383383
Meanwhile, here are some fun tricks -- these are called "Magic
384384
commands" in IPython:
385385

386-
- You can use ``%bg`` to run a command in the background, and then use
387-
``jobs`` to access the results, as follows. (The comments ``not
388-
tested`` are here because the ``%bg`` syntax doesn't work well with
389-
Sage's automatic testing facility. If you type this in yourself, it
390-
should work as written. This is of course most useful with commands
391-
which take a while to complete.)
392-
393-
::
394-
395-
sage: def quick(m): return 2*m
396-
sage: %bg quick(20) # not tested
397-
Starting job # 0 in a separate thread.
398-
sage: jobs.status() # not tested
399-
Completed jobs:
400-
0 : quick(20)
401-
sage: jobs[0].result # the actual answer, not tested
402-
40
403-
404-
Note that jobs run in the background don't use the Sage preparser --
405-
see :ref:`section-mathannoy` for more information. One
406-
(perhaps awkward) way to get around this would be to run ::
407-
408-
sage: %bg eval(preparse('quick(20)')) # not tested
409-
410-
It is safer and easier, though, to just use ``%bg`` on commands
411-
which don't require the preparser.
412-
413386
- You can use ``%edit`` (or ``%ed`` or ``ed``) to open an editor, if
414387
you want to type in some complex code. Before you start Sage, make
415388
sure that the :envvar:`EDITOR` environment variable is set to your

src/doc/fr/tutorial/interactive_shell.rst

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -387,34 +387,6 @@ celui-ci. Vous voudrez peut-être consulter la `documentation complète de IPyth
387387
astuces utiles -- qui reposent sur ce que IPython appelle des « commandes
388388
magiques » :
389389

390-
- La commande magique ``%bg`` lance une commande en arrière-plan. Le résultat
391-
sera ensuite accessible à travers l'objet ``jobs``, comme dans l'exemple
392-
ci-dessous. (Les commentaires « not tested » sont là parce que ``%bg`` ne
393-
fonctionne pas correctement dans l'infrastructure de test automatisé de Sage,
394-
mais si vous reproduisez l'exemple, il devrait fonctionner comme indiqué.
395-
Naturellement, ``%bg`` est surtout utile pour les commandes dont l'exécution
396-
prend beaucoup de temps.)
397-
398-
::
399-
400-
sage: def quick(m): return 2*m
401-
sage: %bg quick(20) # not tested
402-
Starting job # 0 in a separate thread.
403-
sage: jobs.status() # not tested
404-
Completed jobs:
405-
0 : quick(20)
406-
sage: jobs[0].result # the actual answer, not tested
407-
40
408-
409-
Attention, les tâches lancées en arrière-plan ignorent le préprocesseur Sage
410-
(voir section :ref:`section-mathannoy`). Une manière (certes pas très
411-
commode) de contourner le problème est la suivante ::
412-
413-
sage: %bg eval(preparse('quick(20)')) # not tested
414-
415-
Mais il est plus simple et plus sûr de réserver ``%bg`` aux commandes en pur
416-
Python, qui ne font pas appel au préprocesseur.
417-
418390
- Lorsque l'on souhaite saisir un morceau de code complexe, on peut utiliser
419391
``%edit`` (ou ``%ed``, ou ``ed``) pour ouvrir un éditeur de texte.
420392
Assurez-vous que la variable d'environnement :envvar:`EDITOR` est réglée à

src/doc/ja/tutorial/interactive_shell.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -353,33 +353,6 @@ IPythonトリック
353353
<http://ipython.scipy.org/moin/Documentation>`_ を読んみてほしい.
354354
そのかわり,ここではIPythonの「マジックコマンド」と呼ばれる,お便利なトリックをいくつか紹介させていただこう:
355355

356-
- ``%bg`` を使えばコマンドをバックグラウンドで実行し, 結果には ``jobs`` でアクセスすることができる.(この機能は ``not tested`` とコメントされている.というのは ``%bg`` 書法がSageの自動テスト機能とは余り相性が良くないからだ.ユーザ各自が入力してやれば,その通り動作するはずである.もちろん,この機能が最も役立つのは実行に時間のかかるコマンドと組み合わせる場合である.)
357-
358-
使用例を以下に示す.
359-
360-
::
361-
362-
sage: def quick(m): return 2*m
363-
sage: %bg quick(20) # not tested
364-
Starting job # 0 in a separate thread.
365-
sage: jobs.status() # not tested
366-
Completed jobs:
367-
0 : quick(20)
368-
sage: jobs[0].result # the actual answer, not tested
369-
40
370-
371-
バックグラウンドに送られるジョブはSageの前処理パーサを経由しないことに注意 -- 詳細は :ref:`section-mathannoy` 節を参照されたい.
372-
パーサを通すための(不器用であるけれども)1つの方法は
373-
374-
::
375-
376-
sage: %bg eval(preparse('quick(20)')) # not tested
377-
378-
とすることだろう.
379-
380-
ただし,より安全で簡単なのは前処理パーサを必要としないコマンドで ``%bg`` を使うことだろう.
381-
382-
383356
- ``%edit`` (``%ed`` や ``ed`` でもいい)を使ってエディタを起動すれば,複雑なコードの入力が楽になる.
384357
Sageの使用前に,環境変数 :envvar:`EDITOR` に好みのエディタ名を設定しておこう(``export EDITOR=/usr/bin/emacs`` または ``export EDITOR=/usr/bin/vim`` とするか, ``.profile`` ファイルなどで同様の設定をする).
385358
するとSageプロンプトで ``%edit`` を実行すれば設定したエディタが起動する.そのエディタで関数

src/doc/pt/tutorial/interactive_shell.rst

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -372,34 +372,6 @@ pode usar quaisquer comandos e recursos do IPython. Você pode ler a
372372
`Documentação completa do IPython
373373
<http://ipython.scipy.org/moin/Documentation>`_ (em inglês).
374374

375-
- Você pode usar ``%bg`` para executar um comando no background, e
376-
então usar ``jobs`` para acessar os resultados, da seguinte forma.
377-
(Os comentários ``not tested`` estão aqui porque a sintaxe ``%bg``
378-
não funciona bem com o sistema de testes automáticos do Sage. Se
379-
você digitar esses comandos, eles devem funcionar. Isso é obviamente
380-
mais útil com comandos que demoram para serem completados.)
381-
382-
::
383-
384-
sage: def quick(m): return 2*m
385-
sage: %bg quick(20) # not tested
386-
Starting job # 0 in a separate thread.
387-
sage: jobs.status() # not tested
388-
Completed jobs:
389-
0 : quick(20)
390-
sage: jobs[0].result # the actual answer, not tested
391-
40
392-
393-
Note que os comandos executados no background não usam o
394-
pre-processador (preparser) do Sage -- veja :ref:`section-mathannoy`
395-
para mais informações. Uma forma (estranha talvez) de contornar esse
396-
problema seria executar ::
397-
398-
sage: %bg eval(preparse('quick(20)')) # not tested
399-
400-
É mais seguro e simples, todavia, usar ``%bg`` apenas em comandos
401-
que não requerem o pre-processador (preparser).
402-
403375
- Você pode usar ``%edit`` (ou ``%ed`` ou ``ed``) para abrir um
404376
editor, se você desejar digitar algum código mais complexo. Antes de
405377
iniciar o Sage, certifique-se de que a variável de ambiente

0 commit comments

Comments
 (0)