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

sys.stdout.write printing length of string #60663

Closed
firatozgul mannequin opened this issue Nov 12, 2012 · 4 comments
Closed

sys.stdout.write printing length of string #60663

firatozgul mannequin opened this issue Nov 12, 2012 · 4 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@firatozgul
Copy link
Mannequin

firatozgul mannequin commented Nov 12, 2012

BPO 16459
Nosy @kushaldas

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 2012-11-12.07:23:10.317>
created_at = <Date 2012-11-12.06:51:28.108>
labels = ['type-bug', 'invalid']
title = 'sys.stdout.write printing length of string'
updated_at = <Date 2012-11-12.07:44:42.311>
user = 'https://bugs.python.org/firatozgul'

bugs.python.org fields:

activity = <Date 2012-11-12.07:44:42.311>
actor = 'ezio.melotti'
assignee = 'none'
closed = True
closed_date = <Date 2012-11-12.07:23:10.317>
closer = 'firatozgul'
components = []
creation = <Date 2012-11-12.06:51:28.108>
creator = 'firatozgul'
dependencies = []
files = []
hgrepos = []
issue_num = 16459
keywords = []
message_count = 4.0
messages = ['175419', '175420', '175421', '175422']
nosy_count = 2.0
nosy_names = ['firatozgul', 'kushal.das']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue16459'
versions = ['Python 3.3']

@firatozgul
Copy link
Mannequin Author

firatozgul mannequin commented Nov 12, 2012

On Python 3.3 under Windows and GNU/Linux, sys.stdout.write prints the length of string along with the string itself:

>> sys.stdout.write("a_string")

a_string8

Note the '8' at the end of 'a_string'.

Is it expected behavior?

@firatozgul
Copy link
Mannequin Author

firatozgul mannequin commented Nov 12, 2012

Although I do not know the reason for change, it seems that this is expected behavior as of Python 3.0 in interactive shell. Closing the record as 'invalid'.

@firatozgul firatozgul mannequin added the invalid label Nov 12, 2012
@firatozgul firatozgul mannequin closed this as completed Nov 12, 2012
@kushaldas
Copy link
Member

sys.stdout.write returns the length of the string it printed.
try these:

x = sys.stdout.write("abc")
print x

or from console
python -c 'import sys ; sys.stdout.write("abc")'

@firatozgul
Copy link
Mannequin Author

firatozgul mannequin commented Nov 12, 2012

Thank you for the explanation, kushaldas.

@ezio-melotti ezio-melotti added the type-bug An unexpected behavior, bug, or error label Nov 12, 2012
@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
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants