Re: Why do you use python?

2009-11-03 Thread Jaime Buelta
On 1 nov, 08:54, Dennis Lee Bieber  wrote:
> On Sat, 31 Oct 2009 06:54:27 -0700 (PDT), Jaime Buelta
>  declaimed the following in
> gmane.comp.python.general:
>
> > shouldn't be heard. Talks a guy that programmed a GUI on Motif using C
> > (plain old C) in 2003 and takes almost forever (one year and a half),
>
>         Lucky you...
>
>         I emulated a Ramtek 9300 (think that was the model) graphics engine
> using GKS (for display lists, and ability to turn "layers" on/off
> without regenerating all the data) on top of plain DECWindows/Xt
> library, with no layout utility. Around 1990 (I date it by the fact
> that, on return from the 7 week two site deployment of the application,
> I decided my old cameras had gotten too burdensome, and bought a Canon
> EOS 10s, 35-105 & 100-300 lenses, and a photo vest that I could wear
> onto the flights)
>
>         Emulation was needed as the data generation program had to have
> minimal changes -- we replaced the Ramtek library with a package that
> formatted the Ramtek instructions as text strings, sent them via VAX/VMS
> mailboxes to the emulation program... Oh, and the main data generation
> program really was a set of some 50 programs that were invoked in
> "random" order, each drawing certain data elements onto a single window
> -- so there had to be a common graphics application to maintain the
> window...
> --
>         Wulfraed         Dennis Lee Bieber               KD6MOG
>         wlfr...@ix.netcom.com   HTTP://wlfraed.home.netcom.com/

Hahahaha, I souposse that I must consider myself EXTREMELY
lucky... ;-)

Anyway, each tool has its time, and we should try to use more-or-less
adequate and available tools of our time...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why do you use python?

2009-10-31 Thread Jaime Buelta
On Oct 31, 11:31 am, "Alf P. Steinbach"  wrote:
> * sk:
>
> > [title "Why do you use python?]
> > What would be your answer if this question is asked to you in an
> > interview?
>
> > a modified version might be:
> > "Where would you use python over C/C++/Java?"
>
> > (because my resume says I know C/C++/Java)?
>
> The C++ FAQ addresses this question here:
> http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.5>
>
> Cheers & hth.,
>
> - Alf

Mphf

Even I have some agreement that the choice of a language it's more a
business-driven issue I REALLY don't like that the techie weenie
shouldn't be heard. Talks a guy that programmed a GUI on Motif using C
(plain old C) in 2003 and takes almost forever (one year and a half),
instead of using any other graphical toolkit because "we can't afford
to expend time on learning new languages"...
I think time to development (usually related to "mystical" bugs well
hidden in layers and layers of code) it's an important thing to take
into account.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why do you use python?

2009-10-31 Thread Jaime Buelta
On Oct 31, 8:11 am, sk  wrote:
> What would be your answer if this question is asked to you in an
> interview?
>
> a modified version might be:
> "Where would you use python over C/C++/Java?"
>
> (because my resume says I know C/C++/Java)?

I also know C/C++/Java so...

I'd say that I can be much more productive in Python that in those
other languages.
I can do the same with , let's say, 5 lines of Python that with 15 or
20 lines of C/C++/Java (maybe a little less in Java), with much less
errors.
I can produce clear code, so it's easier to understand when other
person will look at it.
I can produce a prototype much faster
I can focus more on the problem and less on the coding...
I can make cross-platform code (well, also with Java)

I would use it as much as possible, but specially for:
* Complicated script-like actions, in spair of bash scripts, which
it's great for simple , OS related operations, but to manage workflow
it's sometimes confusing.
* Rapid prototyping. Check ideas.
* Tests automation

I try to use Python as often as possible, as my "default language", as
I think I can't be more productive, which it's usually the most
important parameter in software development. Of course, if there is a
good reason not to use it, then it's not the adequate tool. But But I
tend to ask myself "Is there a reason for not using Python?" instead
of "Is there a reason for using Python?"
-- 
http://mail.python.org/mailman/listinfo/python-list


Mixing different interpreters in the same program

2009-10-22 Thread Jaime Buelta
Hello:

  I keep thinking from some time ago in how to conect two or more
Python interpreters. This began as interest in calling Java code from
C program, which was solved (at the time) using an intermediate file.

  But having CPython and Jython, I think it would be great to call a
function from, let's say, a CPython interpreter and execute java code.

  I been reading about the multiprocessing module, but doesn't been
able to call the Jython interpreter from CPython. Also, Jython is
still at version 2.5 and doesn't have the multiprocessing, so it won't
probably work either.

  Any way, thinking like a "wish list", I think it will be very
interesting a module with the following behaviour to make python even
more powerful in gluing things up.
  Could make "from MyModule import java" or "from MyModule import
jython", so the module will start a jython interpreter. Then call code
to be executed on the jython interpreter like 'jython.javafunction'

  Of course, it could be also an "import ironpython" to start an
IronPython or any other Python interpreter configured. Or "import
cpython" from jython.

  Regarding performance, which I think won't be never great at it has
some overhead setting interpreters up, sending data, etc, it will be
great to add a MyModule.exec(function) to execute completely a funtion
on the "remote interpreter"

  Well, just thinking about some ideas and sharing with you ;-)

  Best regards,
 Jaime
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How about adding slice notation to iterators/generators?

2009-10-20 Thread Jaime Buelta
El 16/10/2009 3:29, Eloff escribió:
> I was just working with a generator for a tree that I wanted to skip
> the first result (root node.)
>
> And it occurs to me, why do we need to do:
>
> import sys
> from itertools import islice
>
> my_iter = islice(my_iter, 1, sys.maxint)
>
> When we could simply add slice operations to generators?
>
> for x in my_iter[1:]:
>  pass
>
> The way I figure it, only if there is no __getitem__ defined, and the
> object has an __iter__ (i.e. not a list, but a iter(list) would be
> ok), then there should be a default __getitem__ that is really just
> islice, with similar limitations (no negative indices.)
>
> The idea might need a bit of polish, but fundamentally it seems like
> it could make it easier to deal with slicing generators?
>
> At the least, stop=sys.maxint, step=1, and islice needs to accept
> kwargs. So you could do islice(my_iter, start=1), that's an oversight
> imho.

I think the only way not to complicate more the design of iterators
will be to make equivalent

my_iter[start:n:end]

to an iterator more or less this way (just syntactic sugar)

iter = my_iter()
for i in range(start):
  next(iter)

for i in range(start,end):
  value = next(iter)
  if i % n == 0:
yield value

Unfortunatelly, to get the last one you have to iterate completely the
iterator, but these are the rules of the game...

Adding a __getitem__ seems pointless to me. Iterators are enough
complicated the way they are, it's not so simple when you see them the
first time.

Also, I think that the language must somehow difference between
iterators and container, as they are different concepts. You can
always do something like

for i in list(iterator)[5:10]:
   do things

while it can be less efficient and less clean.

I don't know, could be worth discussing it... ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The rap against "while True:" loops

2009-10-19 Thread Jaime Buelta
For me, it's more a question of clarity than anything else. I don't
like very much using break, continue or more than one return per
function on C/C++, but sometimes it's much clearer to use them.
Also, in Python I use them often, as usually the code is cleaner this
way.

for example, I will wrote that code in C/C++

for (i=0;(ihttp://mail.python.org/mailman/listinfo/python-list