Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:11:50+00:00 2026-05-30T10:11:50+00:00

This question has (for me) no real implication. I just found this out by

  • 0

This question has (for me) no real implication. I just found this out by coincidence and I am curious about the mechanics behind it. I got the folling example script:

#!/usr/bin/env python
"""
just an example
"""

class exampleClass():
    'this is just an example'


if __name__ == '__main__':
    print(__doc__)

Running this in eclipse print “just an example”. However, when I try to run this in the terminal I get the following error:

File "./temp.py", line 6
   class exampleClass():
                       ^
  SyntaxError: invalid syntax

Now, when I change the class in the example script to inherit from dict

class exampleClass(dict):

and run it from the commandline it also prints “just an example”.
So why do classes have to inherit something to work from commandline, but not from eclipse?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:11:52+00:00Added an answer on May 30, 2026 at 10:11 am

    According to the Python 2.7.2 grammar, the following syntax is incorrect:

    class exampleClass():
        'this is just an example'
    

    It should be either

    class exampleClass:
        'this is just an example'
    

    or

    class exampleClass(object): # or `dict' etc
        'this is just an example'
    

    In all probability you’re using two different versions of the Python interpreter, and for some reason one of the interpreters is allowing the invalid syntax and the other isn’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has been asked in a C++ context but I'm curious about Java.
This question has spawned out of this one. Working with lists of structs in
This question has been asked before but with no real answer. I wan't to
I know this question has been asked before, I'm just trying to be absolutely
This question has a relation with my previous question, What is the real memory
I searched the web but haven't found a real good answer for this question..
This question has been asked more than once before, but I have not found
This question has been asked before ( link ) but I have slightly different
This question has been discussed in two blog posts ( http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/ , http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/ ),
This question has been puzzling me for a long time now. I come from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.