Jump to content

Python and it's struggles


Metin2 Dev

Recommended Posts

  • Bot

Hello developers, especially Python ones!

Here am I to create a discussion about Python. I would like to hear your thoughts on this programming language. Why do you like it and why don't?
Through working with M2 I spent the most time in C++, C# and LUA. Now I decided to do some stuffs in my client but I'm really disgusted with it's syntax.
Why did Ymir choose this language? Are there any better scripting language alternatives?

Here are a few examples that making me want to drive up a wall:

  • no data types
  • no semicolons
  • import command does not distinguish python includes and my includes (like C do by "" and <>)
Correct:

if (ASSEMBLY and ARPA):
	return 1


Incorrect:

if (ASSEMBLY && ARPA):
	return 1
Correct:

JesusHere = {
    "WHY"	: Locale.WHY,
    "SO"	: Locale.SO,
    "SERIOUS"	: Locale.SERIOUS,
}
  
  
Incorrect:

JesusHere =
{
    "WHY"	: Locale.WHY,
    "SO"	: Locale.SO,
    "SERIOUS"	: Locale.SERIOUS,
}
Correct:

def printme(str):
   "This prints a passed string into this function."
   print str
   return


Incorrect:

def printme(str)
{
   "This prints a passed string into this function."
   print str
   return
}

 

  • Love 1

english_banner.gif

Link to comment
Share on other sites

 

  • no data types

In every language exist data types, but in Python the declaration happens automatically when you assign a value to a variable not need to specify which type to be like int, float, string etc..and you can do assignation with another data type just with operator '=', without killing language like C++ assignation between std::vector & std::map, here is more easy.

  • no semicolons

The semicolon here does not do anything, but exist and can be used with no problems, does let you use to denote the end of a statement if you are including more than one statement on a line.

  • import command does not distinguish python includes and my includes (like C do by "" and <>)

#include and import are quite different, C/C++ is a compiled language, C++ you do #include <library> and in Python you have this syntax for import the content of another program file in your own. (i can't explain it very good the difference because have no-sense)

  • Spoiler

    a5x8gab.png

    Two or more physical lines may be joined into logical lines using backslash characters (\)backslash .

    JesusHere =\
    {
    	[....]
    }

As i said don't try to search difference between 2 languages which both are amazing in them way, Python was choosed by YMIR for write the GUI Engine because is a easy language and flexible instead of C++ or any variants, if you are good at C/C++, you can easily learn Python in some weeks because that is more easy than it..

Some difference between them are:

  • Python uses Garbage Collection whereas C++ does not.
  • C++ is a statically typed language, while Python is a dynamically typed language.
  • Python is easier to use than C++.
  • Python is run through an interpreter, whilst C++ is pre-compiled.
  • Hence, C++ is faster than Python.
  • C++ supports pointers and incredible memory management.
  • Python supports very fast development and rapid, continuous language development.
  • Python has less backwards compatibility.
  • Majority of all applications are built from C++.
  • Majority of all 3D applications offer Python access to their API's.
  • Python code tends to be 5 to 10 times shorter than that written in C++.
  • In Python, there is no need to declare types explicitly.
  • Smaller code size in Python leads to leads to "rapid prototyping", which offers speed of development.
  • Python requires an engine to run.
  • Python is interpreted each time it runs.
  • Python is hard to install on a Windows box and thus makes distribution of the program problematic.
  • C++ is a pure binary that links to existing libraries to assist the coding.
  • In Python, variables are in scope even outside the loops in which they are first instantiated.
  • In Python, a function may accept an argument of any type, and return a value of any type, without any kind of declaration beforehand.
  • Python provides flexibility in calling functions and returning values.
  • Python looks cleaner, is object oriented, and still maintains a little strictness about types.

@difference-between-cplusplus-and-python

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.