Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2004, 07:22 AM
Tkinter_Bell Tkinter_Bell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Isle of dogs
Posts: 68 Tkinter_Bell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Need stronger typed language then Python

I am currently developing an html editor- its going to be the worlds best of course. I am liking Python but it is a little to weak-typed for my likings. I want typed checking and interfaces so I can kill those nasty runtime errors. I would like to port some of the code to a stronger typed language like such as C or Java or something but keep TK (Tkinter) as the user interface. Converting the code does not need to be done all at once but I would like to possibly interface the 2 languages together.

Any ideas dudes

Reply With Quote
  #2  
Old October 19th, 2004, 07:56 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
C isn't an OO language, so if you want OOP constructs/concepts like interfaces then you'll be looking at Java. In which case you might want to check out Jython:

http://www.jython.org/

Or maybe you could use C++ but I've only heard of extending CPython with C, though it should be possible to use C++? You should read though the Extending and Embedding section in the Python docs:

http://www.python.org/doc/2.3.4/ext/ext.html

I hope this helps. Good luck with the project ,

Mark.
__________________
programming language development: www.netytan.com Hula


Last edited by netytan : October 19th, 2004 at 08:38 AM. Reason: Spelling

Reply With Quote
  #3  
Old October 19th, 2004, 08:55 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Tkinter is a wrapper for Tk/TCL which is another language altogether.

Some Tkinter objects are combinations of Tk widgets written in Python so unless you are very lucky you will still need to include Python in your program. (or re-write them in your chosen langauge )

If you want to look at TCL/C integration
http://www.humbug.org.au/talks/tcl/tclintegrate.html

Here's something worth reading:
Strong versus Weak


grim
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
  #4  
Old October 19th, 2004, 03:03 PM
Tkinter_Bell Tkinter_Bell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Isle of dogs
Posts: 68 Tkinter_Bell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
C isn't an OO language, so if you want OOP constructs/concepts like interfaces then you'll be looking at Java. In which case you might want to check out Jython:

http://www.jython.org/

Or maybe you could use C++ but I've only heard of extending CPython with C, though it should be possible to use C++? You should read though the Extending and Embedding section in the Python docs:

http://www.python.org/doc/2.3.4/ext/ext.html

I hope this helps. Good luck with the project ,

Mark.


C not Object Oriented? I bet I can find a crazy nut out there to disagree with you. I am sure there are elegent workarounds. I just don't like C++ it just adds complication and ugly dependencies. There so many foo-langeuge-to-c converters out there and c is so standerd also.

J

Reply With Quote
  #5  
Old October 19th, 2004, 03:13 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,254 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 8 h 9 m
Reputation Power: 265
It is a common misconception that Python is weakly typed - it is strongly typed, but the type checking happens are runtime rather than at compile time as in C++. The correct distinction is between static typing (at compile time) and dynamic typing (at run time).

The advantages of static typing for writing correct programs are debatable at best, and illusory at worst. There has been a definite move away from them over the last few years. With the rise of Test Driven Development dynamically typed languages can be used as safely as statically typed ones.

Here is an article by Bruce Eckel (author of "Thinking in C++" and "Thinking in Java") on the subject, and another by Robert Martin, former editor-in-chief of "The C++ Report".

The real advantage to static typing is that the compiler can produce more efficient code, since it does not have to do work at runtime to look up methods and attributes.

Take a look at Pyrex - it is the python language with additional type information, that allows the code to be translated into C and compiled. It can result in code that is orders of magnitude faster than pure python. Since it creates Python modules in C, Pyrex can also be used to interface with existing C libraries.

Dave - The Developers' Coach

Last edited by DevCoach : October 19th, 2004 at 03:16 PM.

Reply With Quote
  #6  
Old October 19th, 2004, 05:16 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally Posted by Tkinter_Bell
C not Object Oriented? I bet I can find a crazy nut out there to disagree with you.


Nope, C is not object oriented language. Why is why C was extended to become C++ (static) and Objective-C (more dynamic). I'm sure you could find somone to argue this but as you said, they'd probably be a crazy nut .

Reply With Quote
  #7  
Old October 19th, 2004, 05:17 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,553 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110977 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 3 h 36 m 8 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
Quote:
Originally Posted by netytan
Nope, C is not object oriented language. Why is why C was extended to become C++ (static) and Objective-C (more dynamic). I'm sure you could find somone to argue this but as you said, they'd probably be a crazy nut .

Agreed C is not object oriented, C++ is

Reply With Quote
  #8  
Old October 19th, 2004, 06:20 PM
deltacoder's Avatar
deltacoder deltacoder is offline
slightly insane code guru
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2004
Location: Indianapolis, IN
Posts: 871 deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 h 8 m 36 sec
Reputation Power: 12
Send a message via AIM to deltacoder Send a message via MSN to deltacoder
find me a native way to handle inheritance et cetera in C and I'll tell you it's object oriented. until then, it's definitely not.
__________________

deltacoder.com :: W3C Standards :: PHP.net :: Google

Reply With Quote
  #9  
Old October 20th, 2004, 04:44 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,717 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 12 h 29 m 35 sec
Reputation Power: 1179
Think you just found your crazy nut . You don't need an object oriented language to implement an object oriented design. If you're going to use C++ features as the standard for object orientation, heck even python doesn't have quite a few features that C++ does (not that they can't be simulated though), and Smalltalk or ruby fans claim that C++ isn't object oriented enough. IIRC the python book even mentions that no one seems to agree what "object oriented" really means. With that in mind, it is perfectly feasible to implement an object oriented model in a non-object oriented language like C. It can be done, just going to be a bit more verbose.

Examples:
http://www.tux.org/lkml/index.html#s15-3 - Note that it says the VFS file system and Xt are written using object oriented techniques (objects with public and private data, inheritance, methods etc.).
http://www.accu.org/acornsig/public/articles/oop_c.html
http://ldeniau.home.cern.ch/ldeniau/html/oopc/oopc.html <--- deltacoder, this one is for you . Also note that Stroustrup's original C++ compiler was called cfront and actually translated C++ code to C code before compiling it with a C compiler!
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #10  
Old October 20th, 2004, 04:57 PM
deltacoder's Avatar
deltacoder deltacoder is offline
slightly insane code guru
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2004
Location: Indianapolis, IN
Posts: 871 deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level)deltacoder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 h 8 m 36 sec
Reputation Power: 12
Send a message via AIM to deltacoder Send a message via MSN to deltacoder
I don't think the question was "can you do object-oriented stuff in C", it was "is the language itself designed to be object-oriented". Notice the "natively" in my post. But you raise a valid point.

Reply With Quote
  #11  
Old October 22nd, 2004, 07:37 AM
Tkinter_Bell Tkinter_Bell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Isle of dogs
Posts: 68 Tkinter_Bell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
Nope, C is not object oriented language. Why is why C was extended to become C++ (static) and Objective-C (more dynamic). I'm sure you could find somone to argue this but as you said, they'd probably be a crazy nut .


It looks like my Spidy senses were correct after all, I did find a article about object orientation in ANSI-C (not C++ or Object C) by Axel-Tobias Schreiner in PDF

A quote “If it is impossible, what are you waiting for ,go do it”

Reply With Quote
  #12  
Old October 22nd, 2004, 04:03 PM
Tkinter_Bell Tkinter_Bell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Isle of dogs
Posts: 68 Tkinter_Bell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally Posted by Scorpions4ever
Think you just found your crazy nut . You don't need an object oriented language to implement an object oriented design. If you're going to use C++ features as the standard for object orientation, heck even python doesn't have quite a few features that C++ does (not that they can't be simulated though), and Smalltalk or ruby fans claim that C++ isn't object oriented enough. IIRC the python book even mentions that no one seems to agree what "object oriented" really means. With that in mind, it is perfectly feasible to implement an object oriented model in a non-object oriented language like C. It can be done, just going to be a bit more verbose.

Examples:
http://www.tux.org/lkml/index.html#s15-3 - Note that it says the VFS file system and Xt are written using object oriented techniques (objects with public and private data, inheritance, methods etc.).
http://www.accu.org/acornsig/public/articles/oop_c.html
http://ldeniau.home.cern.ch/ldeniau/html/oopc/oopc.html <--- deltacoder, this one is for you . Also note that Stroustrup's original C++ compiler was called cfront and actually translated C++ code to C code before compiling it with a C compiler!


The problem with C++ is that it is so complicated that it negates the any object oriented abilities it implements, I am smelling and hoping that C is a better alternative to C++ with the speed I need too.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Need stronger typed language then Python


Thread Tools  Search this Thread