Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Juan Pablo Romero Méndez
2016-08-28 0:04 GMT-07:00 Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info>: > On Sunday 28 August 2016 15:56, Juan Pablo Romero Méndez wrote: > > > 2016-08-27 21:30 GMT-07:00 Steve D'Aprano : > [...] > >> Now it is true that speaking in full

Re: What's the best way to minimize the need of run time checks?

2016-08-27 Thread Juan Pablo Romero Méndez
2016-08-27 21:30 GMT-07:00 Steve D'Aprano : > On Sun, 28 Aug 2016 12:31 pm, Juan Pablo Romero Méndez wrote: > > > 2016-08-14 7:29 GMT-07:00 Steven D'Aprano : > > > >> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote: > >> > >>

Re: What's the best way to minimize the need of run time checks?

2016-08-27 Thread Juan Pablo Romero Méndez
2016-08-27 21:30 GMT-07:00 Steve D'Aprano : > On Sun, 28 Aug 2016 12:31 pm, Juan Pablo Romero Méndez wrote: > > > 2016-08-14 7:29 GMT-07:00 Steven D'Aprano : > > > >> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote: > >> > >>

Re: What's the best way to minimize the need of run time checks?

2016-08-27 Thread Juan Pablo Romero Méndez
2016-08-14 7:29 GMT-07:00 Steven D'Aprano : > On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote: > > > I've been trying to find (without success so far) an example of a > > situation where the dynamic features of a language like Python provides a > > c

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread Juan Pablo Romero Méndez
2016-08-12 1:10 GMT-07:00 Lawrence D’Oliveiro : > On Thursday, August 11, 2016 at 8:33:41 AM UTC+12, Juan Pablo Romero > Méndez wrote: > > > I've been trying to find (without success so far) an example of a > situation > > where the dynamic features of a language

Re: What's the best way to minimize the need of run time checks?

2016-08-10 Thread Juan Pablo Romero Méndez
atures of some language are a better solution than static typing. This is of course more useful in languages that support both paradigms. Juan Pablo 2016-08-10 13:50 GMT-07:00 Michael Selik : > > > On Wed, Aug 10, 2016, 4:34 PM Juan Pablo Romero Méndez < > jpablo.rom...@gmail.com>

Re: What's the best way to minimize the need of run time checks?

2016-08-10 Thread Juan Pablo Romero Méndez
2016-08-09 18:28 GMT-07:00 Steven D'Aprano : > On Wed, 10 Aug 2016 04:29 am, Juan Pablo Romero Méndez wrote: > > > Hello, > > > > In online forums sometimes people complain that they end up having to > test > > constantly for None, > > Then don'

Re: What's the best way to minimize the need of run time checks?

2016-08-10 Thread Juan Pablo Romero Méndez
2016-08-09 23:16 GMT-07:00 Gregory Ewing : > Juan Pablo Romero Méndez wrote: > > This is interesting. You are Ok having runtime errors? >> > > You're going to have runtime errors in any case, whether > they come from code you've put there yourself to check >

Re: What's the best way to minimize the need of run time checks?

2016-08-10 Thread Juan Pablo Romero Méndez
2016-08-09 23:47 GMT-07:00 Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info>: > On Wednesday 10 August 2016 15:20, Juan Pablo Romero Méndez wrote: > > > Ok, so you suggested 1) catching exceptions at the point where you care, > 2) > > preemptively check f

Re: What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
2016-08-09 18:28 GMT-07:00 Steven D'Aprano : > On Wed, 10 Aug 2016 04:29 am, Juan Pablo Romero Méndez wrote: > > > Hello, > > > > In online forums sometimes people complain that they end up having to > test > > constantly for None, > > Then don'

Re: What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
2016-08-09 14:01 GMT-07:00 Michael Selik : > On Tue, Aug 9, 2016 at 3:22 PM Juan Pablo Romero Méndez < > jpablo.rom...@gmail.com> wrote: > >> I'm actually looking for ways to minimize run time errors, so that would >> include TypeError and AttributeError. >>

Re: What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
2016-08-09 13:18 GMT-07:00 Rob Gaddi : > Juan Pablo Romero Méndez wrote: > > > 2016-08-09 12:06 GMT-07:00 Paul Rubin : > > > >> Juan Pablo Romero Méndez writes: > >> > In online forums sometimes people complain that they end up having to > >> >

Re: What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
What static checking can actually guarantee varies depending on the specific type system at hand (C# vs Haskell vs Idris for example). But most of them can guarantee simple stuff like: "I'm I allowed to invoke this function at this point?" If you don't have that, well you can rely on tests to show

Re: What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
2016-08-09 12:06 GMT-07:00 Paul Rubin : > Juan Pablo Romero Méndez writes: > > In online forums sometimes people complain that they end up having to > > test constantly for None > > That's something of a style issue. You can code in a way that avoids a > lot of

What's the best way to minimize the need of run time checks?

2016-08-09 Thread Juan Pablo Romero Méndez
Hello, In online forums sometimes people complain that they end up having to test constantly for None, or that a function's argument has a specific type / shape (which immediately brings the following aphorism to mind: "Any sufficiently large test suite contains an ad hoc, bug-ridden, slow impleme

What do you guys think about adding a method "to_json"

2011-09-11 Thread Juan Pablo Romero Méndez
Hello, What do you guys think about adding a method "to_json" to dictionaries and sequence types? Perhaps through a module import? Regards, Juan Pablo -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt GUI

2009-07-08 Thread Juan Pablo Romero Méndez
I use OpenInventor (Coin3d) which have a python binding called "pivy". It works great. http://pivy.coin3d.org/ Juan Pablo 2009/7/8 Helvin : > Hi experts! > > I'm developing a GUI for a software using PyQT, and need 3D > visualization. Should I use PyOpenGL or VTK? > I understand that the PyQt pa

Re: Developing GUI applications

2009-06-20 Thread Juan Pablo Romero Méndez
PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/intro All the benefits of Qt: multiplataform, excellent documentation, great API, visual widget designer, etc, etc. For the coding itself, I use netbeans + python plugin. Regards, Juan Pablo 2009/6/21 Chris Rebert : > On Sat, Jun 20, 20

Re: eval() and global variables

2008-12-18 Thread Juan Pablo Romero Méndez
t;", line 1, in File "", line 4, in TypeError: arg 5 (closure) must be tuple >>> Strange... 2008/12/17 Peter Otten <__pete...@web.de>: > Juan Pablo Romero Méndez wrote: > >> Suppose this function is given: >> >> def f(x,y): >

Re: eval() and global variables

2008-12-16 Thread Juan Pablo Romero Méndez
P 2008/12/16 : > Quoth "=?ISO-8859-1?Q?Juan_Pablo_Romero_M=E9ndez?=" : >> Hello, >> >> Suppose this function is given: >> >> def f(x,y): >> return x+y+k >> >> Is it possible to somehow assign a value to k without resorting to >> making k global? >> >> I'm thinking something like this: >> >> eva

eval() and global variables

2008-12-16 Thread Juan Pablo Romero Méndez
Hello, Suppose this function is given: def f(x,y): return x+y+k Is it possible to somehow assign a value to k without resorting to making k global? I'm thinking something like this: eval("f(1,1)", {"f":f, "k":1}) Or even better, something like: def g(k): return f g(1)(1,1) ==> 3 Rega

Re: Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-10 Thread Juan Pablo Romero Méndez
Finally installed Python 2.6, which is compiled with visual C++ 2008, and all my problems went away. Thanks to all, Juan Pablo 2008/12/10 "Martin v. Löwis" <[EMAIL PROTECTED]>: >> - >> ... >> error: Python was built with Visual Studio

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Juan Pablo Romero Méndez
In R: norm = function(v) v/sqrt(sum(v^2)) :) Juan Pablo 2008/12/10 Arnaud Delobelle <[EMAIL PROTECTED]>: > "Dotan Cohen" <[EMAIL PROTECTED]> writes: > >> 2008/12/10 <[EMAIL PROTECTED]>: >>> On Dec 5, 9:51 am, Xah Lee <[EMAIL PROTECTED]> wrote: For those of you who don't know l

Re: Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-09 Thread Juan Pablo Romero Méndez
I've been compiling everything needed by pivy (Coin, Qt, SoQt, PyQt) with visual c++ 8, I decided to recompile python itself. Juan Pablo 2008/12/9 Gabriel Genellina <[EMAIL PROTECTED]>: > En Tue, 09 Dec 2008 11:32:46 -0200, Juan Pablo Romero Méndez > <[EMAIL PROTECTED]&

Compiling and installing python 2.5.2 with Visual C++ 2008

2008-12-09 Thread Juan Pablo Romero Méndez
Hello all, I need to compile python myself because of a module (pivy). So I downloaded MS Visual C++ 2008 express edition. It apparently compiled fine but I don't know how to install it to recreate the standard distribution. In linux i'd take "make install", but on windows? Regards, Juan Pablo

Re: fun with lambdas

2005-10-21 Thread Juan Pablo Romero
Thanks to all I settled with this: def partial1(f,b): return lambda a:f(a,b) def partial2(f,a): return lambda b:f(a,b) Juan Pablo 2005/10/20, Mike Meyer <[EMAIL PROTECTED]>: > Robert Kern <[EMAIL PROTECTED]> writes: > > Juan Pablo Romero wrote: > >&

fun with lambdas

2005-10-20 Thread Juan Pablo Romero
Hello! given the definition def f(a,b): return a+b With this code: fs = [ lambda x: f(x,o) for o in [0,1,2]] or this fs = [] for o in [0,1,2]: fs.append( lambda x: f(x,o) ) I'd expect that fs contains partial evaluated functions, i.e. fs[0](0) == 0 fs[1](0) == 1 fs[2](0) == 2 But this