python / cpython

The Python programming language
https://www.python.org
Other
63.03k stars 30.19k forks source link

Malfunctioning of '\r' #84886

Closed 76b3c9a6-8ed5-4e3a-9515-8cd0aa8c2ad8 closed 4 years ago

76b3c9a6-8ed5-4e3a-9515-8cd0aa8c2ad8 commented 4 years ago
BPO 40709
Nosy @terryjreedy, @ezio-melotti, @Dora
Superseder
  • bpo-23220: IDLE: Document how Shell displays user code output
  • Files
  • error: The description is given in the comment.
  • error: The description is given in the comment.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/ezio-melotti' closed_at = created_at = labels = ['expert-IDLE', 'type-bug', '3.10'] title = "Malfunctioning of '\\r'" updated_at = user = 'https://github.com/Dora' ``` bugs.python.org fields: ```python activity = actor = 'terry.reedy' assignee = 'ezio.melotti' closed = True closed_date = closer = 'ezio.melotti' components = ['IDLE'] creation = creator = 'Dora' dependencies = [] files = ['49174', '49175'] hgrepos = [] issue_num = 40709 keywords = [] message_count = 4.0 messages = ['369508', '369509', '369516', '369568'] nosy_count = 3.0 nosy_names = ['terry.reedy', 'ezio.melotti', 'Dora'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = 'resolved' status = 'closed' superseder = '23220' type = 'behavior' url = 'https://bugs.python.org/issue40709' versions = ['Python 3.10'] ```

    76b3c9a6-8ed5-4e3a-9515-8cd0aa8c2ad8 commented 4 years ago

    The escape sequence '\r' (carriage return) doesn't function in 3.x and 2.x versions. Eg: print("computer\rscience") Expected output : sciencer But, it displays computerscience without the functioning of'\r'

    76b3c9a6-8ed5-4e3a-9515-8cd0aa8c2ad8 commented 4 years ago

    The escape sequence '\r' (carriage return) doesn't function in 3.x and 2.x versions. Eg: print("computer\rscience") Expected output : sciencer But, it displays computerscience without the functioning of'\r'

    ezio-melotti commented 4 years ago

    The behavior of \r depends on the operating system and terminal you are using, and not on Python itself.

    terryjreedy commented 4 years ago

    Discussed on bpo-23220. Note that 'sciencecomputer' is a different possible result if \r does not switch the simulated terminal from the normal insert mode to overwrite mode. I am considering terminal simulation as an option, but there is not exactly a standard to emulate.