Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change required in python 3.4 interpretor . #62908

Closed
madanram mannequin opened this issue Aug 11, 2013 · 2 comments
Closed

Change required in python 3.4 interpretor . #62908

madanram mannequin opened this issue Aug 11, 2013 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@madanram
Copy link
Mannequin

madanram mannequin commented Aug 11, 2013

BPO 18708
Nosy @rhettinger, @mdickinson

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:

assignee = None
closed_at = <Date 2013-08-11.12:04:35.658>
created_at = <Date 2013-08-11.06:47:16.263>
labels = ['interpreter-core', 'type-feature']
title = 'Change required in python 3.4 interpretor .'
updated_at = <Date 2013-08-11.12:04:35.656>
user = 'https://bugs.python.org/madanram'

bugs.python.org fields:

activity = <Date 2013-08-11.12:04:35.656>
actor = 'mark.dickinson'
assignee = 'none'
closed = True
closed_date = <Date 2013-08-11.12:04:35.658>
closer = 'mark.dickinson'
components = ['Interpreter Core']
creation = <Date 2013-08-11.06:47:16.263>
creator = 'madan.ram'
dependencies = []
files = []
hgrepos = []
issue_num = 18708
keywords = []
message_count = 2.0
messages = ['194867', '194890']
nosy_count = 3.0
nosy_names = ['rhettinger', 'mark.dickinson', 'madan.ram']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue18708'
versions = ['Python 3.4']

@madanram
Copy link
Mannequin Author

madanram mannequin commented Aug 11, 2013

As I observed when using python 3.4 Interpretor is that it would be able to distinguish between char by '' and string by ""

>>> input()    
a
'a'

and

>>> input()
aa
'aa'

it would be better if output was
"aa"

but if i want to fix this which file to edit.

@madanram madanram mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Aug 11, 2013
@mdickinson
Copy link
Member

Unlike C, Python doesn't have any 'character' type: the elements of a string are simply 1-character strings. The two quote styles are mostly interchangeable: again, unlike C, there's no particular meaning attached to the use of single quotes or double quotes.

So you'd be asking for 1-character strings to be represented using single quotes and multi-character strings to be representing using double quotes. That doesn't seem like a particularly useful distinction. Worse, it might even be misleading, since it would suggest a C-like distinction between characters and strings.

As to which file: you're looking for the implementation of str.__repr__, which is in the unicode_repr function in Objects/unicodeobject.c. The logic for choosing which style of quote to use is about 50 lines into that function (line 12128 at revision eeda59e08c83).

Closing this as rejected.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant