Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl...id=126&tid=156
It is about automatic code generation.
I got interrested in the subject, did a web search, and it seems kind of
powerfull.
My main interrest is web development in Zope/CMF/Plone, where there is a
lot of repeated code in the products. So automated code generation seems
like a natural fit.
But every time I think of a use case, I immediately think of a way to do
it with encapsulation instead.
Does anybody have any experience using Python and automated code
generation where it actually make sense?
Or os it useless in a language as dynamic as Python?
regards max M 8 3699
"Max M" <ma**@mxm.dk> wrote in message
news:3f***********************@dread12.news.tele.d k... Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl...id=126&tid=156 It is about automatic code generation.
I got interrested in the subject, did a web search, and it seems kind of powerfull.
My main interrest is web development in Zope/CMF/Plone, where there is a lot of repeated code in the products. So automated code generation seems like a natural fit.
But every time I think of a use case, I immediately think of a way to do it with encapsulation instead.
Does anybody have any experience using Python and automated code generation where it actually make sense?
Or os it useless in a language as dynamic as Python?
There are a few places where automated code generation makes sense,
but these are mostly trivial time savers. For example, the propery()
function
could be extended to automatically generate trivial getters, setters and
deleters, saving some coding and making things clearer in the majority
of cases.
John Roth
regards max M
Max M <ma**@mxm.dk> writes: Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl...id=126&tid=156
It is about automatic code generation.
I got interrested in the subject, did a web search, and it seems kind of powerfull.
My main interrest is web development in Zope/CMF/Plone, where there is a lot of repeated code in the products. So automated code generation seems like a natural fit.
But every time I think of a use case, I immediately think of a way to do it with encapsulation instead.
Does anybody have any experience using Python and automated code generation where it actually make sense?
Or os it useless in a language as dynamic as Python?
The target language doesn't have to be the same as the implementation
language. A short while ago I created a small code generation program that
created snippets of C code which were woven into a hand optimised C program.
The result was an extremely fast program (which it needed to be) which still
seemed to have some capabilities of the HLL I used to create it (Scheme in
this case). I wouldn't even have attempted doing the analysis of the user
input in C but it was so trivial in Scheme I was able to add lots of extras.
It would have been a reasonable project in Python too. I did in fact use
Python as a front end to hide what was happening.
However I would suspect there would be a lot less scope for generating Python
code. Its dynamic and reflexive nature make it unnecessary.
Eddie
Cameron Laird wrote:
Yes, it's largely useless in a language as dynamic as Python.
Isn't SWIG a code generator?
Al
In article <3F***************@easystreet.com>, <ac*****@easystreet.com> wrote: Cameron Laird wrote: >
Yes, it's largely useless in a language as dynamic as Python.
Isn't SWIG a code generator?
Al
I'm regarding SWIG as not about writing in Python; it's
about writing in a combination of Python and C (or C++,
or Fortran, or ...).
--
Cameron Laird <Ca*****@Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html ac*****@easystreet.com wrote in message news:<3F***************@easystreet.com>... Cameron Laird wrote: Yes, it's largely useless in a language as dynamic as Python.
Isn't SWIG a code generator?
Most of what it generates is C++, Python is special in that there is
some optional wrapper code generated to use Python 2.2's features like
properties. No code, for example, is generated for Ruby (or Perl
AFAIK).
Eugene Pervago
Kahakai (Python scripted window manager) http://kahakai.sf.net/
My classes often have a __str__/__repr__ that generates a
bit of python code that when eval'd will reproduce (a clone of) the instance.
Simon.
On Fri, 05 Sep 2003 18:30:19 +0200, Max M wrote:
.... Does anybody have any experience using Python and automated code generation where it actually make sense?
Or os it useless in a language as dynamic as Python?
regards max M
I write tools for testing embedded systems.
They parse the .h files and doc files to associate names with hex
values... This produces meg's of .py files which then support writing
tools and test scripts.
Everything from structure layout to:
EMERGENCY_STOP_CMD=0x1234567L
....
SOME_STRUCT=(["f1","f2","f3"],">fI10s")
....
ERROR_100="Somethig bad"
Does this qualify as code generation?
When the project wants to change something like how we "log".
Python is used to parse the entire source tree making changes.
Not Python code generation but it's more complicated than
search/replace. And could be applied to a Python code base as well
Is this code generation?
--Darrell
Max M wrote: Yesterday there was an article on Slashdot: http://books.slashdot.org/article.pl...id=126&tid=156
It is about automatic code generation.
I got interrested in the subject, did a web search, and it seems kind of powerfull.
My main interrest is web development in Zope/CMF/Plone, where there is a lot of repeated code in the products. So automated code generation seems like a natural fit.
But every time I think of a use case, I immediately think of a way to do it with encapsulation instead.
Does anybody have any experience using Python and automated code generation where it actually make sense?
Or os it useless in a language as dynamic as Python?
regards max M This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mudge |
last post by:
Please, someone, tell me why OO in PHP is better than procedural.
|
by: Stefan Richter |
last post by:
Hi, after coding for days on stupid form validations -
Like:
strings (min / max length), numbers(min / max value), money(min / max
value), postcodes(min / max value), telefon numbers,
email...
|
by: Rasmus Fogh |
last post by:
Someone raised the question of automatic code generation a few weeks back.
And yes, we (CCPN) are using automatic Python code generation in a major
way. Basically we are making data models in...
|
by: Matthias |
last post by:
Hello,
I have a Canvas-Widget and will use as a "array of pixel". At Positon
x,y I print a rectangle with a special color. I give the rectangle no
objectname. Then I will ask the...
|
by: Konstantin Zakharenko |
last post by:
Hello,
Our QA team have running a lot of test scripts (for automated regression
testing), they run them on the different databases (Oracle/MS SQL).
Several of those tests are dependent on the...
|
by: Gina |
last post by:
I need to add the cell generation to a templated program. I am using
graphics magician, but my problem is with the math. I cannot figure
out my cell generations. I do know that I need two...
|
by: Rob Richardson |
last post by:
Greetings!
It seems to me that there is room for a lot of improvement in automatic
generation of database objects. If I create a data adapter from a table
shown in the Server Explorer, I get...
|
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= |
last post by:
I am using Excel automation for a report.
Dim objExcel As New Excel.Application
objExcel.DisplayAlerts = False
Dim objWorkbooks As Excel.Workbooks = objExcel.Workbooks
Dim objWorkbook As...
|
by: eliben |
last post by:
Hello,
In a Python program I'm writing I need to dynamically generate
functions and store them in a dict. eval() can't work for me
because a function definition is a statement and not an...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |