Skip to content

Fixed Issue#2190 | Homepage code syntax error #2191

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

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

eshaanmandal
Copy link
Contributor

@eshaanmandal eshaanmandal commented Nov 11, 2022

Fixed issue #2190. Website home page, in the code example 5(Quick & Easy to Learn) has SyntaxError in first line at https://www.python.org/

@eshaanmandal eshaanmandal changed the title Fixed Issue#2190Now the Homepage code sample doesn't have syntax error Fixed Issue#2190 | Homepage code syntax error Nov 11, 2022
@eshaanmandal
Copy link
Contributor Author

Hi,
I think I have fixed all the issues with my last pull request. Please review my changes as a first-time contributor.
Thank you.

@jbw3
Copy link

jbw3 commented Nov 11, 2022

FYI: I noticed that the next line of code in the example also has an extra backslash.
Instead of this...

name = input('What is your name?\\n')

...it should be this...

name = input('What is your name?\n')

Comment on lines +30 to 31
>>> print("Hello, I'm Python!")
<span class=\"output\">Hello, I'm Python!</span>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we put a unicode snake into the code (and HTML)?

Suggested change
>>> print("Hello, I'm Python!")
<span class=\"output\">Hello, I'm Python!</span>
>>> print("Hello, I'm Python \N{SNAKE}")
<span class=\"output\">Hello, I'm Python! &#x1f40d;</span>

image

@jayaddison
Copy link

@ewdurbin apologies to ping directly, but I thought that this might be worth a quick fixup. It relates to a syntax error in one of the python.org homepage code examples.

@eshaanmandal's fix should work as-is. I've added a suggestion that we could additionally use unicode in the example code (to match an existing comment), but I could move my suggestion into a separate follow-up pull request.

(also a quick deployment note/reminder: as you discovered before, these examples are fixture data that are loaded into the db to take effect)

@ewdurbin ewdurbin merged commit b41f5e4 into python:main Jan 17, 2023
@jayaddison
Copy link

🎉 nice - problem solved :)

image

(confirmed within a Python REPL session too)

@jayaddison
Copy link

@ewdurbin ek, sorry - a nitpick about this: although the code syntax for this sample has been fixed on the homepage, some of HTML escaping may have gone a bit wonky, and that results in all of the text appearing in green (instead of a mixture of syntax highlighting colours, as with the other samples)

Expected syntax highlighting in HTML

image

HTML snippet

<span class="comment"># Python 3: Simple arithmetic</span>

Appearance of code sample five

image

HTML snippet

<span class="\&quot;comment\&quot;"># Simple output (with Unicode)</span>

(some kind of HTML-escaping issue?)

@jayaddison
Copy link

That looks much better now - thank you!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants