Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm interested in creating my own programming language and I would like to use python. My question is, would a language written in Python using the PLY library be considerably slower than CPython or would they be about the same in terms of program execution speed?
Also in terms of performance how much better would it be if I implemented it in C?
Thanks,
Francis
If you are implementing a compiler in PLY, the compilation may take longer - but that's irrelevant the execution speed of your program.
For example, you could use PLY to write a C compiler. The compiler may or may not be faster than your other C compiler, but the resulting executable should run at a similar speed (unless you miss a lot of optimisations etc.)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In most languages, it's safe to assume libraries are written in the same language, ie. a Java library is usually written in Java.
In Python, that doesn't seem to be the case. Many of the high performance libraries such as numpy, pandas and more are written in C/C++, and provide Python bindings for convenience. It seems we could call these C/C++ libraries instead of Python libraries.
Why is this?
Your question had the answer buried in it: "Many of the high performance libraries...are written in C/C++."
There are two reasons for calling a low-level language from a language like Python, and performance is one of them. Numpy, for example, achieves a lot of its performance by carefully managing (and reusing) memory, and calling it from Python avoids the garbage collection overheads of writing the same functions in Python.
The other reason to call libraries written in another language is to do things not possible in the source language, such as taking advantage of non-blocking I/O system calls, or using special features of a platform such as vector processing instructions, or GPGPUs.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
First, to give you a slight bit of background on me:
Perl is technically the first language I was introduced to, but I quickly migrated to Python when I found how clean and easy it is to write. I've now been working in Python for about 8 months, and I feel that I'm reaching an 'intermediate' stage. I have the language syntax, data-structures, and memory usage principles pretty much down, and now I'm starting to get into things such as algorithmic design and some of the slightly deeper topics like function closures.
I'm teaching myself C++ on the side, and I'll be honest, it feels tedious and extremely obtuse to me. It might be how new I am too it still, but I have to force myself to practice C++ whereas I can barely get enough coding in Python. I've heard people say it's good to learn to give you a baseline knowledge about computers and memory management, so my question is if I should "catch-up" in C++ to where I'm at in Python before continuing? I think the convenience of Python is making it hard to learn C++ as a second language.
I feel you should try to fully master one language before advancing to another. If you juggle too many at the same time you will just mix up their syntax and spend a lot of time becoming a jack of all trade and a master of non.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So I've been thinking to make a programming language written in python but I have no idea where to start, and I really don't know the steps creating it.
You would probably start by first planning out your language. That should take a lot of time. Then in Python... you would write a parser that can understand the syntax of your language, and an interpreter that can take the results of the parser and perform the actions of the program.
Your language that is written in Python with Python in-turn being written in C is practically guaranteed to be very slow and will not succeed, but this could be a really fun thing to do as a learning or education experience.
You will likely want to look at Abstract Syntax Trees. This is the underlying structure that python is built on. Take a look here at the documentation: https://docs.python.org/2/library/ast.html
Using ASTs you can at least define the syntax of your language. You will still need to solve the problem of how to interpret it on a platform to get your code to execute.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've written a bunch of VBA code for various things in Excel. I'm looking at migrating to libreOffice. Under Tool->Macros->Organize Macros: the two choices are LibreOffice Basic and Python.
Should I learn one of those, both, or something else. Am I wasting my time altogether? Any suggestions appreciated.
Python is the way to go.
Start here: http://wiki.python.org/moin/BeginnersGuide
And no, you're not wasting time.
You'll look back and say, why didn't I do it sooner.
Python's a great skill to learn - I use it for everything. It's the glue language for virtually every tool out there (you can even use it with .Net).
Documentation for Python + LibreOffice is however a bit sketchy currently, although I don't have much experience with Calc.
There is some work-in-progress documentation at http://documenthacker.wordpress.com (or soon www.documenthacker.com). It has examples for working with Writer, rather than Calc, but you might still find it useful.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to have a flexible templating language that I can customize for a specific use case, and also make it simple enough for non-programmers to use. I looked at Cheetah; does anyone have any others and/or any thoughts on customization? Python would be great, but other language-implementations are also OK.
Jija2 is a templating library that I find easy to use
See: http://jinja.pocoo.org/docs/
See a previous SO question: What is the fastest template system for Python?
I like wheezy.template since it looks very similar to my python code. Its syntax is compact, expressive and clean. I was able to start right after a quick look at example. It amazing how intuitive it is. In addition it is fast.