Re: pairwise combination of two lists

2011-08-17 Thread Luis M . González
This is the easiest and most pythonic way (IMHO):

 l3 = [i+e for i in li1 for e in li2]
 l3
['a1', 'a2', 'b1', 'b2']

Regards,
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread Luis M . González
On Aug 16, 2:11 pm, Seebs usenet-nos...@seebs.net wrote:
 On 2011-08-16, smith jack thinke...@gmail.com wrote:

  what is the advantage of Django over RoR:)

 This question is pretty much... I mean, you're not gonna get useful
 answers.  They're based on such different languages that I think any
 comparison past that is likely going to be uninteresting to a programmer,
 and I'm not sure any non-programmers are going to use either.

 I will say, the things I most value in Rails are pretty much contrary
 to conventional Python design philosophy.  Python's stress on explicit
 over implicit is probably in contradiction with the Rails philosophy of
 convention over configuration.

 So for instance, if all you want of a class that maps to a database table
 in Rails is that it map the fields in the database, the class body is
 empty because that's the default.  If you want to tell it that the database
 column foo_id represents the id of the foo object with which this record
 is associated, and you want to call that item.foo, you write:
         belongs_to :foo
 and the rest is all implicit.

 This is really handy sometimes, but it's not very Pythonic...

 Mostly, I think you'd probably be better off asking in a completely
 different kind of forum, but even then, you're going to get mostly language
 advocacy.

 -s
 --
 Copyright 2011, all wrongs reversed.  Peter Seebach / 
 usenet-nos...@seebs.nethttp://www.seebs.net/log/-- lawsuits, religion, and 
 funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) -- get 
 educated!
 I am not speaking for my employer, although they do rent some of my opinions.

Seebs answer is spot on.
The advantages or disadvantages of both frameworks are subjective.
It all comes down to each person's language of preference, since each
framework reflects its language philosophy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Card alternatives?

2011-06-11 Thread Luis M . González
As you said, desktop apps are losing appeal.
I suggest looking for a web based solution. Perhaps python +
silverlight? (I haven't tried it though).
Unfortunately, the client-side (browser) is the domain of javascript.

What I'm doing is polishing my html/css skills coupled with jquery. I
have lost faith in a python solution for these tasks.
Although there's something close enough that can make your experience
totally different: Coffeescript.

This is an enhanced syntax layer on top of javascript, inspired in
python and ruby, which feels like a breath of fresh air to any python
or ruby programmer. It plays very well with jquery and gives you all
the pythonic goodies you are used to, like list comprehensions (called
array and object comprehensions), slicing, ranges, etc. Coffeescript
pre compiles your code to pure javascript so there's no performance
degradation at all.

If it does not convince you and you still prefer a python solution,
you may want to check pyjamas (a port of GWT to python).
There are also some experiments such as Skulp to have python running
in the browser, although this approach implies a serious performance
hit, since it's a full python implementation in javascript.

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


Re: Would like to add an upload facility to my web site

2011-01-31 Thread Luis M . González
On Jan 31, 1:50 pm, Ramon F Herrera ra...@conexus.net wrote:
 On Jan 31, 10:49 am, Ramon F Herrera ra...@conexus.net wrote:









  (newbie alert)

  This is what I have so far:

 http://patriot.net/~ramon/upload_facility.html

  The code is shown below. It seems I need that actual script that
  performs the file transfer. I would prefer it in Python.

  TIA,

  -Ramon

  ---

  html
  body
  br /
  form action=upload_file.php method=post enctype=multipart/form-
  data
      label for=fileName of file to be uploaded:/label
      input type=file name=file id=file /
      br /
      br /
      input type=submit name=submit value=Upstream like the
  salmons! /
  /form
  /body
  /html

 IMPORTANT Bonus question:

 Where should I post this type of question about writing stuff for the
 web

 -Ramon

I guess this question is framework specific.
Are you using any framework (django, pylons, etc...)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which is the best book to learn python

2011-01-27 Thread Luis M . González
On Jan 27, 3:43 pm, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
 santosh hs wrote:
  I am very new to object oriented concept,  so I need to learn
  everything frm basic, Will the above books fulfill
   My need

 read thishttp://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm

 and stop when they start to talk about VBscript :)

 JM

I strongly second this suggestion.
Alan Gauld's example of a banking application was just what I needed
to finally understand object oriented programming.
This is how my head made the click.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which is the best book to learn python

2011-01-25 Thread Luis M . González
On Jan 24, 2:09 pm, santosh hs santosh.tron...@gmail.com wrote:
 Hi All,
 i am beginner to python please tell me which is the best available
 reference for beginner to start from novice

If you are a complete beginner to programming, I suggest start with a
tutorial such as A Byte of Python (google this).
I learned my first steps with Josh Cogliati's Non-Programmers
Tutorial For Python 
http://www.oopweb.com/Python/Documents/easytut/VolumeFrames.html
.

The suggestions above are very good if you are new to programming en
general (not only to python).
If you have some experience, you may look to something more advanced,
such as Dive into Python.
All these resources are available online for free.

If you want to but a book, I like Beginning Python: From Novice to
Professional.

Hope this helps...
Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.2 beta 2

2010-12-21 Thread Luis M . González
I wonder if Unladen Swallow is still being considered for merger with
Python 3.3.
Is it?


On Dec 21, 4:18 pm, Georg Brandl ge...@python.org wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On behalf of the Python development team, I'm happy to announce the
 second beta preview release of Python 3.2.

 Python 3.2 is a continuation of the efforts to improve and stabilize the
 Python 3.x line.  Since the final release of Python 2.7, the 2.x line
 will only receive bugfixes, and new features are developed for 3.x only.

 Since PEP 3003, the Moratorium on Language Changes, is in effect, there
 are no changes in Python's syntax and built-in types in Python 3.2.
 Development efforts concentrated on the standard library and support for
 porting code to Python 3.  Highlights are:

 * numerous improvements to the unittest module
 * PEP 3147, support for .pyc repository directories
 * PEP 3149, support for version tagged dynamic libraries
 * PEP 3148, a new futures library for concurrent programming
 * PEP 384, a stable ABI for extension modules
 * PEP 391, dictionary-based logging configuration
 * an overhauled GIL implementation that reduces contention
 * an extended email package that handles bytes messages
 * countless fixes regarding bytes/string issues; among them full
   support for a bytes environment (filenames, environment variables)
 * many consistency and behavior fixes for numeric operations
 * a sysconfig module to access configuration information
 * a pure-Python implementation of the datetime module
 * additions to the shutil module, among them archive file support
 * improvements to pdb, the Python debugger

 For a more extensive list of changes in 3.2, see

    http://docs.python.org/3.2/whatsnew/3.2.html

 To download Python 3.2 visit:

    http://www.python.org/download/releases/3.2/

 Please consider trying Python 3.2 with your code and reporting any bugs
 you may notice to:

    http://bugs.python.org/

 Enjoy!

 - --
 Georg Brandl, Release Manager
 georg at python.org
 (on behalf of the entire python-dev team and 3.2's contributors)

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)

 iEYEARECAAYFAk0Q/aAACgkQN9GcIYhpnLDf8gCgkLGAsE+T3R505jZc1RxXDYsa
 NSsAnRGaFjeTm9o2Z5O8FuIzTUG8t1PT
 =hHzz
 -END PGP SIGNATURE-

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lua is faster than Fortran???

2010-07-13 Thread Luis M . González
On Jul 4, 6:09 pm, Stephen Hansen me+list/pyt...@ixokai.io wrote:
 On 7/4/10 9:21 AM, sturlamolden wrote:

  On 4 Jul, 14:29, David Cournapeau courn...@gmail.com wrote:

  Actually, I think the main reason why Lua is much faster than other
  dynamic languages is its size. The language is small. You don't list,
  dict, tuples, etc...

  They have managed to combine list and dict into one type (table) that
  does the job of both.

 You say managed as if it were some technical accomplishment, or that
 the result is able to actually do the job of both: neither of these
 assertions are true.

 Have you actually *used* Lua? I quite like the language in certain
 contexts where its appropriate, but if you've actually used it in real
 code and found tables to be at all a substitute for *either*
 dictionaries *or* lists, then I think somehow you've managed to actually
 miss using either data structure in Python to any real extent, somehow.

 Lua's tables are at very weak dictionary-like and list-like objects,
 which indeed have been folded into one. To the detriment of both, at
 least as far as they are an actual useful data structure.

 You can't even get the equivalent of len(dict) in it: you have to
 actually brute-force iterate the table and count manually. Even for a
 purely array-like table with onlyn umbered indexes, #table can be
 unreliable: its quite possible through normal list-like operations that
 you perform on it, it can end up with holes where #table will fail.
 Since it is *not* an list internally at *all*, but simply an associative
 array with numbered indexes.

 I could go on, and on, and on: but the fundamental *weakness* of Lua'
 data types as data-structures is irrefutable, from its tables to strings
 to numbers: they are incredibly weak on capabilities. You end up writing
 all kinds of library functions to just do the normal things that
 should be really easy to do.

 Now, of course, there's really good reason why Lua is so simple in these
 ways. Its entirely suitable for Lua as an embedded scripting language to
 keep things very light, so it can be simple and fast. Good for Lua to
 fill this niche superbly. But you can't start saying its simple
 alternatives are at all comparable to Python's extremely rich and
 capable data types.

  And yes there are tuples.

 No, there isn't. There's ways to create a tuple-like-thing which kind of
 behaves like a braindead tuple, and functions have a positively bizarre
 capability of returning more then one value (and accepting variable
 values), so there's these points in the language where you have this
 sort of Immutable Sequence, but its opaque until you unwrap it -- and
 then it ceases to be.

 That's not the same thing as having an immutable sequence that you can
 store data in at your discretion, with a rich series of capabilities
 that you can leverage.

  There are no classes, but there are closures and other building blocks
  that can be used to create any object-oriented type system

 Not really.

 Above, I spoke of tables as data structures, things just storing data.
 But you're right, they are capable of more then that-- but you're
 over-selling just how far that capability goes, by a long shot (and
 underselling just how much work it takes to get it there).

 Yes, tables have a limited series of 'hooks' that you can tie into to
 alter their behavior, and through this you can simulate certain higher
 order type systems as defined in other languages. In fact, lots of
 people have done this: there's multiple classy libraries out there to
 bring some kind of Class-or-Object-Oriented-Programming to Lua.

 They work to varying degrees: but the hooks that Lua provides to tables
 is still significantly lacking to really replace Python's
 comprehensively dynamic object model, without a LOT of wasted cycles.

 For example, while you can use __newindex to 'catch' someone setting a
 new 'key' on a table, and and __index to replace or forward the actual
 lookup, you can't actually capture someone trying to set a value to a
 key which already exists. So, you end up having to do a full proxy
 approach, where your table never actually stores anything directly
 (except a reference to another hidden table), and so when someone goes
 to set something you have to set it on the proxied object instead.
 Because you can't let there ever be any real keys on the proxying /
 external table.

 So you're able to work around its lack a bit, to simulate something
 /like/ what it means to have __setattr__.

 But then you run into problems. There's no way now to iterate over the
 table now, because pairs() will only return your internal hidden keys
 that you're using to point to the proxied table (Although you can get
 around this with some more complexity by hiding said key into a
 closure-- but even then, you still can't iterate over the proxied
 table's keys instead).

 So what do you do? Well you go replace the global pairs function,
 that's what you do! So it learns 

Re: Lua is faster than Fortran???

2010-07-08 Thread Luis M . González
On Jul 4, 5:58 pm, John Nagle na...@animats.com wrote:

     TheUnladenSwallowpeople should in theory be able to reach
 that level of performance.  (Both groups are employed at Google.
 So their effectiveness will be compared.)

                                 John Nagle

No. Collin Winter said that they will never be as fast as Chrome's V8
or similar JS engines,
since they were created from scratch to be super fast above all else.
On the other hand, US is a project to enhance an existing interpreter,
carrying a lot of the burden of early design decisions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How is Unladen Swallow coming along?

2010-07-08 Thread Luis M . González
On Jul 8, 1:42 pm, John Nagle na...@animats.com wrote:
     How is Unladen Swallow coming along?  Looking at the site, code is
 being checked in and issues are being reported, but the last quarterly
 release was 2009 Q3.  They missed their January 2010 release date
 for 2009 Q4, so they're now about 6 months behind their project
 plan.

 (http://code.google.com/p/unladen-swallow/wiki/ProjectPlan;)

                                         John Nagle

Don't be shy.
Ask this question in Unladen Swallow's google group. They don't bite!

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How is Unladen Swallow coming along?

2010-07-08 Thread Luis M . González
On Jul 8, 5:44 pm, John Nagle na...@animats.com wrote:
 On 7/8/2010 12:19 PM, Luis M. González wrote:

  On Jul 8, 1:42 pm, John Naglena...@animats.com  wrote:
       How is Unladen Swallow coming along?  Looking at the site, code is
  being checked in and issues are being reported, but the last quarterly
  release was 2009 Q3.  They missed their January 2010 release date
  for 2009 Q4, so they're now about 6 months behind their project
  plan.

  (http://code.google.com/p/unladen-swallow/wiki/ProjectPlan;)

                                           John Nagle

  Don't be shy.
  Ask this question in Unladen Swallow's google group. They don't bite!

     Found this:

 http://www.python.org/dev/peps/pep-3146/#performance-retrospective;

     It's starting to work, but the performance improvement is tiny,
 well under 2x faster than CPython.  Only 1.08x on html5lib.
 That's far less than they expected.  They were going for 5x,
 which is far less than Shed Skin (which restricts Python)
 already achieves.

                                 John Nagle


Shedskin is an heroic effort by Mark Dufour, but comparing it to
Cpython is like comparing oranges to apples.
Shedskin is not an interpreter, it's just a way to compile implicitly
statically typed python code to c++.
So the project is more along the lines of Pyrex/Cython in its goals.
I believe it's a great way to compile extension modules written in
restricted python, although it could compile entire programs provided
they don't rely on non supported libraries or modules. Only a few are
supported to different degrees of completeness.

At this moment, it seems that Pypy is the project holding more
promises.
Although I guess Guido has strong reasons to support Unladen Swallow.
Lets see what happens...

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)

2010-07-06 Thread Luis M . González
On Jul 2, 4:07 pm, John Nagle na...@animats.com wrote:
 David Cournapeau courn...@gmail.com wrote:
  I think one point which needs to be emphasized more is what does
  python 3 bring to people. The what's new in python 3 page gives
  the impression that python 3 is about removing cruft. That's a very
  poor argument to push people to switch.

     That's the real issue, not parentheses on the print statement.
 Where's the business case for moving to Python 3?   It's not faster.
 It doesn't do anything you can't do in Python 2.6.  There's no
 killer app for it. End of life for Python 2.x is many years away;
 most server Linux distros aren't even shipping with 2.6 yet. How can a
 business justify spending money on conversion to Python 3?

     If Python 3 came with Unladen Swallow, and ran several times
 faster than Python 2.x, there'd be a strong business case for
 conversion.  Especially for large sites with racks of servers
 grinding through slow CPython code.  But it looks like Unladen
 Swallow will be available for 2.6 before it's available for 3.x.
 So that's not a selling point for 3.x.

     Python 3 is a nice cleanup of some legacy syntax issues.  But
 that's just not enough.  Perl 6 is a nice cleanup of Perl 5, and
 look how that went.  Ten years on, it's not even mainstream, let
 alone dominant.

     This has all been said before. See Python 3.0: What s The Point?
 from December 2008:

 http://jens.mooseyard.com/2008/12/python-30-whats-the-point/

     Not much has changed since then.

     What I'm not seeing is a deployment plan along these lines:

     1.  Identify key modules which must be converted before Python 3
         can be used in production environments.

     2.  Get those modules converted to Python 3.

     3.  Put together a distribution for the major platforms (at least
         Linux and Windows) with builds of those modules.  This
         could be done on PyPi, which is at present is mostly a link
         farm, not a repository.

     4.  Get some major distros, like Debian and ActiveState, to
         include Python 3, as python3, not as the primary Python,
         so there are no conflicts.  (Debian already has a formal
         policy to keep Python versions separate.)

     5.  Get at least two major hosting services to put up Python 3.

     6.  Get at least two popular end-user programs (not modules) to
         support Python 3.

     7.  Publicize some success stories.

 Unless the Python 3 enthusiasts get their act together and work much
 harder on providing an easy transition experience, it's not going to
 happen.

                                 John Nagle

What's the problem?
Python 2.xx will he around for a long time. It will be supported and
you can use it for your existing projects for as long a you want.
On the other hand, if you have a new project and you plan to make it
successful and usable for many years to come, you should seriously
consider using Python 3.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lua is faster than Fortran???

2010-07-04 Thread Luis M . González
On Jul 4, 12:30 am, sturlamolden sturlamol...@yahoo.no wrote:
 I was just looking at Debian's benchmarks. It seems LuaJIT is now (on
 median) beating Intel Fortran!

 C (gcc) is running the benchmarks faster by less than a factor of two.
 Consider that Lua is a dynamically typed scripting language very
 similar to Python.

 LuaJIT also runs the benchmarks faster than Java 6 server, OCaml, and
 SBCL.

 I know it's just a benchmark but this has to count as insanely
 impressive. Beating Intel Fortran with a dynamic scripting language,
 how is that even possible? And what about all those arguments that
 dynamic languages have to be slow?

 If this keeps up we'll need a Python to Lua bytecode compiler very
 soon. And LuaJIT 2 is rumoured to be much faster than the current...

 Looking at median runtimes, here is what I got:

    gcc               1.10

    LuaJIT            1.96

    Java 6 -server    2.13
    Intel Fortran     2.18
    OCaml             3.41
    SBCL              3.66

    JavaScript V8     7.57

    PyPy             31.5
    CPython          64.6
    Perl             67.2
    Ruby 1.9         71.1

 The only comfort for CPython is that Ruby and Perl did even worse.

You should read this thread: http://lambda-the-ultimate.org/node/3851
There, you'll see this subject discussed and explained at length.
Pay special attention to Mike Pall's comments (he is the creator of
Luajit) and his opinion about python and pypy.
You will read also about other projects, specially new javascript
engines such as Mozila's Tracemonkey (the authors participate in this
thread) and the pypy folks.
It is a very good read for anyone interested in the subject. Very
recommended!
Good luck!

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lua is faster than Fortran???

2010-07-04 Thread Luis M . González
On Jul 4, 4:51 pm, Luis M. González luis...@gmail.com wrote:
 On Jul 4, 12:30 am, sturlamolden sturlamol...@yahoo.no wrote:





  I was just looking at Debian's benchmarks. It seems LuaJIT is now (on
  median) beating Intel Fortran!

  C (gcc) is running the benchmarks faster by less than a factor of two.
  Consider that Lua is a dynamically typed scripting language very
  similar to Python.

  LuaJIT also runs the benchmarks faster than Java 6 server, OCaml, and
  SBCL.

  I know it's just a benchmark but this has to count as insanely
  impressive. Beating Intel Fortran with a dynamic scripting language,
  how is that even possible? And what about all those arguments that
  dynamic languages have to be slow?

  If this keeps up we'll need a Python to Lua bytecode compiler very
  soon. And LuaJIT 2 is rumoured to be much faster than the current...

  Looking at median runtimes, here is what I got:

     gcc               1.10

     LuaJIT            1.96

     Java 6 -server    2.13
     Intel Fortran     2.18
     OCaml             3.41
     SBCL              3.66

     JavaScript V8     7.57

     PyPy             31.5
     CPython          64.6
     Perl             67.2
     Ruby 1.9         71.1

  The only comfort for CPython is that Ruby and Perl did even worse.

 You should read this thread:http://lambda-the-ultimate.org/node/3851
 There, you'll see this subject discussed and explained at length.
 Pay special attention to Mike Pall's comments (he is the creator of
 Luajit) and his opinion about python and pypy.
 You will read also about other projects, specially new javascript
 engines such as Mozila's Tracemonkey (the authors participate in this
 thread) and the pypy folks.
 It is a very good read for anyone interested in the subject. Very
 recommended!
 Good luck!

 Luis

To be more specific, check these comments on the above the above
suggested thread:
http://lambda-the-ultimate.org/node/3851#comment-57804
http://lambda-the-ultimate.org/node/3851#comment-57700

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a functional programming language?

2010-05-10 Thread Luis M . González
On 10 mayo, 09:24, Samuel Williams space.ship.travel...@gmail.com
wrote:
 Dear Friends,

 Is Python a functional programming language?

 Is this a paradigm that is well supported by both the language syntax and the 
 general programming APIs?

 I heard that lambdas were limited to a single expression, and that other 
 functional features were slated for removal in Python 3... is this the case 
 or have I been misinformed?

 Finally, even if Python supports functional features, is this a model that is 
 used often in client/application code?

 Kind regards,
 Samuel

I'm no expert of functional programming at all, but I read many times
(from famous programmers) that Python is very lisp-like, but with a
more conventional syntax.
For example, Paul Graham and others have some interesting views on
this subject: http://www.prescod.net/python/IsPythonLisp.html

That doesn't mean python can compete with other purely functional
languages, but it's probably as functional as it can be for a more
conventional, multiparadigm language.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Write web apps in Python?

2010-04-12 Thread Luis M . González
On 12 abr, 06:57, Gilles Ganault nos...@nospam.com wrote:
 Hello

 I'd like to make sure I understand what the options are to write web
 applications in Python:

 - à la PHP, using Apache's mod_python

 - using eg. Lighttpd and configuring it to load the Python interpreter
 every time a Python script is called (www.jakehilton.com/?q=node/54)

 - long-running process, by compiling the Python script as a
 stand-alone program that will then wait for queries on a port and
 being called by the web server through eg. the WSGI

 As for writing apps, I can either built it from scratch, or use
 frameworks like Pylons, TurboGears, or Django.

 Is this correct?

 Thank you.

You should first investigate the different python web frameworks,
choose one and then use the deployment options supported by your
choice. These frameworks support several ways to deploy your apps,
such as those you mentioned.

If you want an easy way to get started for free, check the Google App
Engine.
It's the google infraestructure to host web apps (written in python or
Java), and it's free as long as you don't surpass the limited quotas
on bandwith and data used (which are quite generous). You don't need
to set up anything. All you need is a google account to get started.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


per-method jit compiler

2010-04-06 Thread Luis M . González
On 4 abr, 00:09, Steven D'Aprano st...@remove-this-

- Ocultar texto de la cita -
cybersource.com.au wrote:
 On Sat, 03 Apr 2010 22:58:43 +, kj wrote:
  Suppose I have a function with the following signature:
  def spam(x, y, z):
  # etc.
  Is there a way to refer, within the function, to all its arguments as a
  single list?  (I.e. I'm looking for Python's equivalent of Perl's @_
  variable.)
 Does this help?
  def spam(a, b, c=3, d=4):
 ... pass
 ... spam.__code__.co_varnames
 ('a', 'b', 'c', 'd')
 The hardest part is having the function know its own name.
 I see that you are already using the inspect module. That almost
 certainly is the correct approach. I'd be surprised if inspect is too
 heavyweight, but if it is, you can pull out the bits you need into your
 own function.
 --
 Steven


The above post gave me an idea (very naive, of couse).
What if I write a simple decorator to figure out the types of every
function, and then we use it as a base for a simple method-jit
compiler for python?
example:
def typer(f):
def wrap(*args):
a = f.func_code.co_varnames
b = [type(i) for i in args]
return dict(zip(a,b))
return wrap
@typer
def spam(a, b, c=3, d=4):
pass
 spam(8,'hello',9.9, 10)

{'a': type 'int', 'c': type 'float', 'b': type 'str', 'd':
type
'int'}
So by using this information, we record all the argument types used
the first time each function/method is executed, and then we generate
optimized code for them.
From this point on, a guard should check if all arguments remain the
same and, if so, the optimized code is run.
Otherwise, just fall back to the interpreter.
He! I have no idea how to implement it...
Any guru out there?
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


per-function jit compiler

2010-04-06 Thread Luis M . González
This post gave me an idea: 
http://groups.google.com/group/comp.lang.python/msg/5d75080707104b76

What if I write a simple decorator to figure out the types of every
function, and then we use it as a base for a simple method-jit
compiler for python?

example:

def typer(f):
def wrap(*args):
a = f.func_code.co_varnames
b = [type(i) for i in args]
return dict(zip(a,b))
return wrap

@typer
def spam(a, b, c=3, d=4):
pass

 spam(8,'hello',9.9, 10)
{'a': type 'int', 'c': type 'float', 'b': type 'str', 'd':type
'int'}

So by using this information, we record all the argument types used
the first time each function/method is executed, and then we generate
optimized code for them.
From this point on, a guard should check if all arguments remain the
same and, if so, the optimized code is run.
Otherwise, just fall back to the interpreter.

He! I have no idea how to implement it...
Any guru out there?
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: per-function jit compiler

2010-04-06 Thread Luis M . González
On 6 abr, 03:40, Chris Rebert c...@rebertia.com wrote:
 2010/4/5 Luis M. González luis...@gmail.com:





  This post gave me an 
  idea:http://groups.google.com/group/comp.lang.python/msg/5d75080707104b76

  What if I write a simple decorator to figure out the types of every
  function, and then we use it as a base for a simple method-jit
  compiler for python?

  example:

  def typer(f):
         def wrap(*args):
             a = f.func_code.co_varnames
             b = [type(i) for i in args]
             return dict(zip(a,b))
         return wrap

  @typer
  def spam(a, b, c=3, d=4):
         pass

  spam(8,'hello',9.9, 10)
  {'a': type 'int', 'c': type 'float', 'b': type 'str', 'd':type
  'int'}

  So by using this information, we record all the argument types used
  the first time each function/method is executed, and then we generate
  optimized code for them.
  From this point on, a guard should check if all arguments remain the
  same and, if so, the optimized code is run.
  Otherwise, just fall back to the interpreter.

  He! I have no idea how to implement it...

 Guido's been lending out his time machine 
 again:http://psyco.sourceforge.net/introduction.html

 Cheers,
 Chris
 --http://blog.rebertia.com

Well, psyco is a complex beast. Actually it's a Just-In-Time
Specializer, not really a compiler at all (Guido's machine told me
so).
It's been superseded by pypy, which is a way more complex beast, and
it's a tracing compiler (and many things more).
What I mean is, why not using python's simple introspection
capabilities (instead of partial evaluation, type inference or other
complex mechanism) to gather type information?
I can imagine that this, coupled with pyrex, cython or shedskin could
give some results perhaps... by selectively compiling some function or
all of them.

But probably someone will throw Guido's time machine again at me. If
it was that easier, someone would have done it already...
I just wonder why this simple approach is not feasible.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


per-method jit compiler

2010-04-05 Thread Luis M . González
On 4 abr, 00:09, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Sat, 03 Apr 2010 22:58:43 +, kj wrote:
  Suppose I have a function with the following signature:

  def spam(x, y, z):
      # etc.

  Is there a way to refer, within the function, to all its arguments as a
  single list?  (I.e. I'm looking for Python's equivalent of Perl's @_
  variable.)

 Does this help?

  def spam(a, b, c=3, d=4):

 ...     pass
 ... spam.__code__.co_varnames

 ('a', 'b', 'c', 'd')

 The hardest part is having the function know its own name.

 I see that you are already using the inspect module. That almost
 certainly is the correct approach. I'd be surprised if inspect is too
 heavyweight, but if it is, you can pull out the bits you need into your
 own function.

 --
 Steven

The above post gave me an idea (very naive, of couse).
What if I write a simple decorator to figure out the types of every
function, and then we use it as a base for a simple method-jit
compiler for python?

example:

def typer(f):
def wrap(*args):
a = f.func_code.co_varnames
b = [type(i) for i in args]
return dict(zip(a,b))
return wrap

@typer
def spam(a, b, c=3, d=4):
pass

 spam(8,'hello',9.9, 10)
{'a': type 'int', 'c': type 'float', 'b': type 'str', 'd': type
'int'}

So by using this information, we record all the argument types used
the first time each function/method is executed, and then we generate
optimized code for them.
From this point on, a guard should check if all arguments remain the
same and, if so, the optimized code is run.
Otherwise, just fall back to the interpreter.

He! I have no idea how to implement it...
Any guru out there?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


OT: Meaning of monkey

2010-03-26 Thread Luis M . González
Webmonkey, Greasemonkey, monkey-patching, Tracemonkey, Jägermonkey,
Spidermonkey, Mono (monkey in spanish), codemonkey, etc, etc, etc...

Monkeys everywhere.
Sorry for the off topic question, but what does monkey mean in a
nerdy-geek context??

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Classes as namespaces?

2010-03-26 Thread Luis M . González
On 26 mar, 11:49, kj no.em...@please.post wrote:
 What's the word on using classes as namespaces?  E.g.

 class _cfg(object):
     spam = 1
     jambon = 3
     huevos = 2

 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)

I see no problem.
I wouldn't mix English, French and Spanish in the same recipe though...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DreamPie - The Python shell you've always dreamed about!

2010-03-22 Thread Luis M . González
On Feb 21, 6:40 pm, Mensanator mensana...@aol.com wrote:
 On Feb 21, 12:14 pm, Paul Boddie p...@boddie.org.uk wrote:





  On 21 Feb, 17:32, Mensanator mensana...@aol.com wrote:

   On Feb 21, 10:30 am, Mensanator mensana...@aol.com wrote:

What versions of Python does it suuport?

   What OS are supported?

  From the Web site referenced in the announcement (http://
  dreampie.sourceforge.net/):

  
  # Supports Python 2.5, Python 2.6, Jython 2.5, IronPython 2.6 and
  Python 3.1.
  # Works on Windows and Linux.
  

 Yeah, I saw that. Funny that something important like that wasn't part
 of the
 announcement. I notice no mention of Mac OS, so visiting the website
 was a complete
 waste of time on my part, wasn't it?



  Paul

Geez... someone spends many hours (or days or even months) writing a
program to be offered for free to the world, and you get annoyed by
losing two seconds while checking it out?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best Way to extract Numbers from String

2010-03-20 Thread Luis M . González
On Mar 20, 12:04 am, Jimbo nill...@yahoo.com wrote:
 Hello

 I am trying to grab some numbers from a string containing HTML text.
 Can you suggest any good functions that I could use to do this? What
 would be the easiest way to extract the following numbers from this
 string...

 My String has this layout  I have commented what I want to grab:
 [CODE] /th
                                 td class=last43.200 /td
                                 td class=change indicator nowrap0.040 
 /td

                                                    td43.150 /td #
 I need to grab this number only
                                 td43.200 /td
                                                    td43.130 /td #
 I need to grab this number only
                                 td43.290 /td                              
            td43.100 /td # I need to
 grab this number only
                                 td7,450,447 /td
                                 td class=middlea
                                         href=/asx/markets/optionPrices.do?
 by=underlyingCodeunderlyingCode=BHPexpiryDate=optionType=Options/
 a/td
                                 td class=middlea
                                         href=/asx/markets/warrantPrices.do?
 by=underlyingAsxCodeunderlyingCode=BHPWarrants  Structured
 Products/a/td
                                 td class=middlea
                                         href=/asx/markets/cfdPrices.do?
 by=underlyingAsxCodeunderlyingCode=BHPCFDs/a/td
                                 td class=middlea 
 href=http://hfgapps.hubb.com/asxtools/
 Charts.aspx?
 TimeFrame=D6compare=comp_indexindicies=XJOpma1=20pma2=20asxCode=BHP 
 img
 src=/images/chart.gif border=0 height=15 width=15/a
 /td
                                 tda 
 href=/research/announcements/status_notes.htm#XDXD/a
                                 /td
                                 tda href=/asx/statistics/announcements.do?
 by=asxCodeasxCode=BHPtimeframe=Dperiod=WRecent/a
 /td
                         /tr[/CODE]


You should use BeautifulSoup or perhaps regular expressions.
Or if you are not very smart, lik me, just try a brute force approach:

 for i in s.split(''):
for e in i.split():
if '.' in e and e[0].isdigit():
print (e)


43.200
0.040
43.150
43.200
43.130
43.290
43.100

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: to create variable from dict

2010-03-12 Thread Luis M . González
On Mar 12, 10:59 am, hiral hiralsmaill...@gmail.com wrote:
 Hi,

 Is there any way to create variables which name matches with dict key?

 For example:
 dict1 = {abc:'1, def:2}

 Now I am looking to have variable name abc and it's value be '1' etc.

 Pl. suggest.

 Thank you.

Check out this thread (very recent):
http://groups.google.com/group/comp.lang.python/browse_thread/thread/bb1797ffb6fc3bd7/25fe94103c7a231f?lnk=gstq=luis+variables#25fe94103c7a231f

Short answer: you can update globals() with a dictionary, as follows:

globals().update( dict1 )

Then you'll have each key-value pair as variables in the global
namespace.
The question is: should you do it?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dictionary or Database—Please advise

2010-02-26 Thread Luis M . González
On Feb 26, 12:58 pm, Jeremy jlcon...@gmail.com wrote:
 I have lots of data that I currently store in dictionaries.  However,
 the memory requirements are becoming a problem.  I am considering
 using a database of some sorts instead, but I have never used them
 before.  Would a database be more memory efficient than a dictionary?
 I also need platform independence without having to install a database
 and Python interface on all the platforms I'll be using.  Is there
 something built-in to Python that will allow me to do this?

 Thanks,
 Jeremy

For small quantities of data, dicts are ok, but if your app
continually handles (and add) large quantities of data, you should use
a database.
You can start with sqlite (which is bundled with python) and it's much
easier to use than any other relational database out there.
You don't need to install anything, since it's not a database server.
You simply save your databases as files.
If you don't know sql (the standard language used to query databases),
I recomend this online tutorial: http://www.sqlcourse.com/

Good luck!
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 4:08 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
 On Tue, 23 Feb 2010 20:44:10 -0800, Luis M. González wrote:
  On Feb 24, 1:15 am, Steven D'Aprano
  ste...@remove.this.cybersource.com.au wrote:
  On Tue, 23 Feb 2010 19:47:22 -0800, Luis M. González wrote:
   On Feb 23, 10:41 pm, Steven D'Aprano
   ste...@remove.this.cybersource.com.au wrote:
   On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:
By the way, if you want the variables inside myDict to be free
variables, you have to add them to the local namespace. The local
namespace is also a dictionary locals(). So you can update
locals as follows:

    locals().update( myDictionary )

   No you can't. Try it inside a function.

   --
   Steven

   Sure. Inside a function I would use globals() instead. Although I
   don't know if it would be a good practice...

  Er, how does using globals change the local variables?

  --
  Steven

  Hmmm well, you tell me!

 I'm not the one that said you can update locals! You said it. I said you
 can't, because you *can't*. The docs warn that you can't change locals,
 and if you try it, you will see that the docs are right.

  def test():

 ...     x = 1
 ...     locals().update(x = 2)
 ...     print x
 ...

  test()

 1

  As I said, I don't know if this is the recomended way...

 It's not recommended because it doesn't work.

 --
 Steven

I guess I have to check the docs...
Anyway, nobody wanted to update locals() from within a function here.
Doing it outside of a function seems to work.
And updating globals() works in any case, which is what the OP seems
to need. Isn't it?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 7:44 am, Luis M. González luis...@gmail.com wrote:
 On Feb 24, 4:08 am, Steven D'Aprano





 ste...@remove.this.cybersource.com.au wrote:
  On Tue, 23 Feb 2010 20:44:10 -0800, Luis M. González wrote:
   On Feb 24, 1:15 am, Steven D'Aprano
   ste...@remove.this.cybersource.com.au wrote:
   On Tue, 23 Feb 2010 19:47:22 -0800, Luis M. González wrote:
On Feb 23, 10:41 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:
 By the way, if you want the variables inside myDict to be free
 variables, you have to add them to the local namespace. The local
 namespace is also a dictionary locals(). So you can update
 locals as follows:

     locals().update( myDictionary )

No you can't. Try it inside a function.

--
Steven

Sure. Inside a function I would use globals() instead. Although I
don't know if it would be a good practice...

   Er, how does using globals change the local variables?

   --
   Steven

   Hmmm well, you tell me!

  I'm not the one that said you can update locals! You said it. I said you
  can't, because you *can't*. The docs warn that you can't change locals,
  and if you try it, you will see that the docs are right.

   def test():

  ...     x = 1
  ...     locals().update(x = 2)
  ...     print x
  ...

   test()

  1

   As I said, I don't know if this is the recomended way...

  It's not recommended because it doesn't work.

  --
  Steven

 I guess I have to check the docs...
 Anyway, nobody wanted to update locals() from within a function here.
 Doing it outside of a function seems to work.
 And updating globals() works in any case, which is what the OP seems
 to need. Isn't it?

 Luis

Alright, this is what the docs say about locals:
Note
The built-in functions globals() and locals() return the current
global and local dictionary, respectively, which may be useful to pass
around for use as the second and third argument to exec().

Note
The default locals act as described for function locals() below:
modifications to the default locals dictionary should not be
attempted. Pass an explicit locals dictionary if you need to see
effects of the code on locals after function exec() returns.

I wonder why updating locals(), not from within a function, works (at
least in my interactive session).
And what about the trick of updating globals? Is it legal? If not, is
there any legal way to do what the OP needs?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 8:48 am, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
 Luis M. Gonz lez a crit :
 (snip)

  Alright, this is what the docs say about locals:
  Note
  The built-in functions globals() and locals() return the current
  global and local dictionary, respectively, which may be useful to pass
  around for use as the second and third argument to exec().

  Note
  The default locals act as described for function locals() below:
  modifications to the default locals dictionary should not be
  attempted. Pass an explicit locals dictionary if you need to see
  effects of the code on locals after function exec() returns.

  I wonder why updating locals(), not from within a function, works (at
  least in my interactive session).

 Because at the top level, locals and globals are the same thing.

  And what about the trick of updating globals? Is it legal?

 It's legal, but it's (usually) a very bad idea - at the top-level, it
 harms readability, and from within a function it's doubly bad
 (readibility + globals are evil).

 Now as usual with GoldenRules(tm), it's meant to be broken - once you do
 know why you shouldn't _usually_ do it.

   for the very same reasons global



  If not, is
  there any legal way to do what the OP needs?

  Luis

I still don't understand why is it a bad idea in the case of
globals().
This is the only way I know to define variables programatically in the
top-level namespace, without having to do it manually one by one.
I don't see the readability problem either.
Talking about Goldenrules(tm), what's the recomended way to do it?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-23 Thread Luis M . González
On Feb 23, 5:53 pm, vsoler vicente.so...@gmail.com wrote:
 Hi,

 I have two dicts

 n={'a', 'm', 'p'}
 v={1,3,7}

 and I'd like to have

 a=1
 m=3
 p=7

 that is, creating some variables.

 How can I do this?

You are probably coming from another language and you're not used to
python's data structures.
If you want a list of items, you use tuples or lists. Examples:

('a', 'm', 'p') --- this is a tuple, and it's made with
parenthesis ()
['a', 'm', 'p'] --- this is a list, and it's made with brackets
[]

Check the documentation to see the difference between tuples and
lists.
For now, lets just use lists and forget about tuples...
Now if you want a sequence of items ordered a key + value pairs, use a
dictionary, as follows:

{'name': 'joe', 'surname': 'doe', 'age': 21} --- this is a dict,
and it's made with curly braces {}.

Curly braces are also used to create sets, but you don't need them now
(check the documentation to learn more about sets).
So going back to your question, you should have two lists, as follows:

n = ['a', 'm', 'p']
v = [1,3,7] -- note that I used brackets [], not curly
braces {}.

And now you can build a dict formed by the keys in n and the values
in v:

myDict = {}   -- this is an new empty dictionary
for k,v in zip(n,v):
myDict[k] = v

This results in this dictionary: {'a': 1, 'p': 7, 'm': 3}.

Hope this helps...
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-23 Thread Luis M . González
On Feb 23, 7:56 pm, Luis M. González luis...@gmail.com wrote:
 On Feb 23, 5:53 pm, vsoler vicente.so...@gmail.com wrote:





  Hi,

  I have two dicts

  n={'a', 'm', 'p'}
  v={1,3,7}

  and I'd like to have

  a=1
  m=3
  p=7

  that is, creating some variables.

  How can I do this?

 You are probably coming from another language and you're not used to
 python's data structures.
 If you want a list of items, you use tuples or lists. Examples:

     ('a', 'm', 'p') --- this is a tuple, and it's made with
 parenthesis ()
     ['a', 'm', 'p'] --- this is a list, and it's made with brackets
 []

 Check the documentation to see the difference between tuples and
 lists.
 For now, lets just use lists and forget about tuples...
 Now if you want a sequence of items ordered a key + value pairs, use a
 dictionary, as follows:

     {'name': 'joe', 'surname': 'doe', 'age': 21} --- this is a dict,
 and it's made with curly braces {}.

 Curly braces are also used to create sets, but you don't need them now
 (check the documentation to learn more about sets).
 So going back to your question, you should have two lists, as follows:

     n = ['a', 'm', 'p']
     v = [1,3,7]         -- note that I used brackets [], not curly
 braces {}.

 And now you can build a dict formed by the keys in n and the values
 in v:

     myDict = {}           -- this is an new empty dictionary
     for k,v in zip(n,v):
         myDict[k] = v

 This results in this dictionary: {'a': 1, 'p': 7, 'm': 3}.

 Hope this helps...
 Luis

By the way, if you want the variables inside myDict to be free
variables, you have to add them to the local namespace.
The local namespace is also a dictionary locals().
So you can update locals as follows:

locals().update( myDictionary )

This way, all the key-value pairs inside myDict become free variables.
Wich is the same as declaring them as follows:

a = 1
p = 7

etc...

Luis



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-23 Thread Luis M . González
On Feb 23, 10:41 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
 On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:
  By the way, if you want the variables inside myDict to be free
  variables, you have to add them to the local namespace. The local
  namespace is also a dictionary locals(). So you can update locals as
  follows:

      locals().update( myDictionary )

 No you can't. Try it inside a function.

 --
 Steven

Sure. Inside a function I would use globals() instead.
Although I don't know if it would be a good practice...

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating variables from dicts

2010-02-23 Thread Luis M . González
On Feb 24, 1:15 am, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
 On Tue, 23 Feb 2010 19:47:22 -0800, Luis M. González wrote:
  On Feb 23, 10:41 pm, Steven D'Aprano
  ste...@remove.this.cybersource.com.au wrote:
  On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:
   By the way, if you want the variables inside myDict to be free
   variables, you have to add them to the local namespace. The local
   namespace is also a dictionary locals(). So you can update locals
   as follows:

       locals().update( myDictionary )

  No you can't. Try it inside a function.

  --
  Steven

  Sure. Inside a function I would use globals() instead. Although I don't
  know if it would be a good practice...

 Er, how does using globals change the local variables?

 --
 Steven

Hmmm well, you tell me!
As I said, I don't know if this is the recomended way...

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What happened to pyjamas?

2010-02-19 Thread Luis M . González
On Feb 18, 5:21 pm, Daniele Gondoni daniele.gond...@gmail.com wrote:
 On 18 Feb, 19:58, sstein...@gmail.com sstein...@gmail.com wrote:

  Down from here (NH, US).

  S

  On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote:

 Unreacheable from Italy as well...

Same here (Buenos Aires, Argentina).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python 3's adoption

2010-01-28 Thread Luis M . González
 Please don't post more noise and ad hominem attacks to the group, Steve.

Ad hominem?
Please, operor non utor lingua non notus per vulgaris populus.
Gratias ago vos...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is a list compression in Python?

2010-01-20 Thread Luis M . González
On Jan 18, 1:07 pm, Kit wkfung.e...@gmail.com wrote:
 Hello Everyone, I am not sure if I have posted this question in a
 correct board. Can anyone please teach me:

 What is a list compression in Python?

 Would you mind give me some list compression examples?

 Thanks  really appreciate that.
 Kit

It's also worth noting that from Python 3.0 on, you have also dict and
set comprehensions.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Java-to-Python?

2009-12-18 Thread Luis M . González
On Dec 18, 11:44 am, Virgil Stokes v...@it.uu.se wrote:
 I have a rather large Java package for the analysis of networks that I
 would like to convert to Python. Many of the classes in the Java package
 are Serializable.

 Any recommendations on Java-to-Python (2.6) would be appreciated.

 --V

Have you considered using this package with Jython?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When will Python 3 be fully deployed

2009-12-06 Thread Luis M . González
On Dec 6, 3:21 pm, vsoler vicente.so...@gmail.com wrote:
 I recently read that many libraries, including Numpy have not been
 ported to Python 3.

 When do you think that Python 3 will be fully deployed?

 Should I stick, so far, to Python 2.6?

 Regards

 Vicente Soler

You'll have some answers here: 
http://jessenoller.com/2009/12/04/pythons-moratorium-lets-think-about-this/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: High-performance Python websites

2009-11-26 Thread Luis M . González
On Nov 25, 4:24 pm, Nick Mellor nick.mellor.gro...@pobox.com wrote:
 Hi all,

 I'm contemplating setting up a Python-powered website for the tourist
 industry, which will involve a web service, a good deal of XML
 processing, and a Django-powered front-end. If the project works, it
 could get a lot of traffic. I'm sure it can be done, but I'm looking
 to find out more about how existing high-volume Python sites have
 managed their workload. Can anyone give me examples of high-volume
 Python-powered websites, if possible with some idea of their
 architecture?

 Many thanks,

 Nick

You should now that there's a Google service called Google App Engine
that lets you host yur website in google's own infraestructure (this
is known nowadays as cloud computing).
It's free to start (as long as you don't exceed the minimum quotas of
space and traffic, which are quite generous).
The good thing is that you don't have to think about scallig issues or
about your overall site's arquitecture or hardware. It's te whole
google infraestructure at your disposal, which can scale from one user
to tens of thousands without having to change anyting from your part.
Simply code correctly your site in python or java, using Django or any
other wsgi compliant framework, and you are set to go.

Check it out: http://code.google.com/appengine/docs/whatisgoogleappengine.html

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Unladen-Swallow: A faster python

2009-03-27 Thread Luis M . González
This is a new project started by two Google engineers to speed up
python:
http://code.google.com/p/unladen-swallow/

--
http://mail.python.org/mailman/listinfo/python-list


Re: is python Object oriented??

2009-01-29 Thread Luis M . González
On Jan 29, 7:21 am, Gary Herron gher...@islandtraining.com wrote:
 Python *is* object-oriented, but it is not (as your definition suggests)
 object-fascist.  

I'm a python-nazi.
No python for you!
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's the point of rpython?

2009-01-18 Thread Luis M . González
On Jan 18, 8:56 am, andrew cooke and...@acooke.org wrote:
 Since this is a PyPy bashing thread, maybe it's an appropriate place
 to suggest that the project has got a little bit waylaid by exploring
 cool things instead of releasing a useful final result?

 I am not questioning rpython directly - the case for something like
 that is obvious.  But there's a question of balance.  It's possible to
 go on building ever more complex systems which are theoretically
 justified, but which postpone ever finishing the job.  At some point
 there has to be a good enough.

 To some extent I am playing devil's advocate here, but as an outside
 who looked at PyPy a while back, my uninformed and naive impression
 was that the project was suffering from the kid of issues I have
 caricatured above

 Andrew

 PS I guess you are aware of worse is better etc?  I think this may
 also be a US/Euro culture issue...

It's worth adding that, regarding the goal of having a faster python,
we have had for a long time a solid and useful proof-of-concept in
psyco. Pypy rolls up on this concept and adds many more useful
features, not all of them related to speed but to flexibility.
I have no doubt the project will be succesful. The question is how
long we will have to wait...

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: *Advanced* Python book?

2009-01-17 Thread Luis M . González
On Jan 16, 5:27 pm, mk mrk...@gmail.com wrote:
 Hello everyone,

 I looked for it I swear, but just can't find it.

 Most Python books seem to focus on examples of how to call functions
 from standard library. I don't need that, I have online Python
 documentation for that.

 I mean really advanced mental gymnastics, like gory details of how
 Python objects operate, how to exploit its dynamic capabilities, dos and
 donts with particular Python objects, advanced tricks, everything from
 chained decorators to metaprogramming. Dive Into Python comes closest to
 this ideal from what I have found, but still not far enough.

 Anybody found such holy grail?

 Regards,
 mk

I believe that any book will give you enough information about
python's objects behaviour.
But if you want to understand the more esoteric aspects of python (I'm
in the same situation),
perhaps you should investigate decorators and metaclasses.
A good starting point is the 3 article series in decorators by Bruce
Eckel in Artima ( http://www.artima.com/weblogs/viewpost.jsp?thread=240808
).

I second the suggestion of reading samples and cookbooks, for example
in ActiveState's site.
I found particularly interesting one that shows how to implement an
ORM under 100 lines ( http://code.activestate.com/recipes/496905/ ).
This script goes deep into black magic and it's clear enough to grasp.

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: what's the point of rpython?

2009-01-16 Thread Luis M . González
On Jan 16, 9:37 pm, Brendan Miller catph...@catphive.net wrote:
 So I kind of wanted to ask this question on the pypy mailing list..
 but there's only a pypy-dev list, and I don't want to put noise on the
 dev list.

 What's the point of RPython? By this, I don't mean What is RPython?
 I get that. I mean, why?

 The goals of the pypy project seems to be to create a fast python
 implementation. I may be wrong about this, as the goals seem a little
 amorphous if you look at their home page.

 So, to do that this RPython compiler was created? Except that it
 doesn't compile python, it compiles a static subset of python that has
 type inference like ML.

 This RPython thing seems like a totally unnecessary intermediate step.
 Instead of writing an implementation of one language, there's an
 implementation of two languages.

 Actually, it seems like it harms the ultimate goal. For the
 interpreted pyton to be fast, the interpreter has to be written in a
 reasonably fast language. ML, and C++ compilers have had a lot of work
 put into their optimization steps. A lot of the performance boost you
 get from a static language is that knowing the types at compile time
 lets you inline code like crazy, unroll loops, and even execute code
 at compile time.

 RPython is a statically typed language because I guess the developers
 associate static languages with speed? Except that they use it to
 generate C code, which throws away the type information they need to
 get the speed increase. Huh? I thought the goal was to write a fast
 dynamic language, not a slow static one?

 Is this going anywhere or is this just architecture astronautics?

 The RPython project seems kind of interseting to me and I'd like to
 see more python implementations, but looking at the project I can't
 help but think that they haven't really explained *why* they are doing
 the things they are doing.

 Anyway, I can tell this is the sort of question that some people will
 interpret as rude. Asking hard questions is never polite, but it is
 always necessary :)

 Thanks,
 Brendan

Check out this thread:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/1a8c866b4c4d7521/2174f796cd687931?lnk=gstq=enlighten+pypy#2174f796cd687931

One of pypy's goals is having a more flexible implementation, easier
to experiment with than cpython.
Having all written in the same language facilitates this task.
Why Rpython? Because by avoiding the dinamicity of the whole python
language, it is possible to translate this code to a static one (c,
java, whatever).
The translated rpython interpreter aims to be something similar in
performance to cpython. The only difference is that cpython was
written from scratch in c, while pypy's interpreter was written in
rpython and then translated automatically to c.

The pypy team intends to achieve greater speed and performance by
adding a JIT compiler to this interpreter.
So pypy-c + JIT = faster python.

I hope this helps...

Luis


--
http://mail.python.org/mailman/listinfo/python-list


Re: optimizing large dictionaries

2009-01-16 Thread Luis M . González
On Jan 15, 6:39 pm, Per Freem perfr...@yahoo.com wrote:
 hello

 i have an optimization questions about python. i am iterating through
 a file and counting the number of repeated elements. the file has on
 the order
 of tens of millions elements...

 i create a dictionary that maps elements of the file that i want to
 count
 to their number of occurs. so i iterate through the file and for each
 line
 extract the elements (simple text operation) and see if it has an
 entry in the dict:

 for line in file:
   try:
     elt = MyClass(line)# extract elt from line...
     my_dict[elt] += 1
   except KeyError:
     my_dict[elt] = 1

 i am using try/except since it is supposedly faster (though i am not
 sure
 about this? is this really true in Python 2.5?).

 the only 'twist' is that my elt is an instance of a class (MyClass)
 with 3 fields, all numeric. the class is hashable, and so my_dict[elt]
 works well.
 the __repr__ and __hash__ methods of my class simply return str()
 representation
 of self, while __str__ just makes everything numeric field into a
 concatenated string:

 class MyClass

   def __str__(self):
     return %s-%s-%s %(self.field1, self.field2, self.field3)

   def __repr__(self):
     return str(self)

   def __hash__(self):
     return hash(str(self))

 is there anything that can be done to speed up this simply code? right
 now it is taking well over 15 minutes to process, on a 3 Ghz machine
 with lots of RAM (though this is all taking CPU power, not RAM at this
 point.)

 any general advice on how to optimize large dicts would be great too

 thanks for your help.

How about this?:

for line in file:
elt = MyClass(line)
my_dict[elt] = my_dict.get(elt, 0) + 1
...

--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Luis M . González
On 19 dic, 13:01, walterbyrd walterb...@iname.com wrote:
 I have not worked with Python enough to really know. But, it seems to
 me that more I look at python 3.0, the more I wonder if it isn't a
 step backwards.

 To me, it seems that this:

 print %s=%d % ('this',99)

 Is much easier, and faster, to type, and is also easier to read and
 understand. It also allows people to leverage their knowledge of C.

 This (if it's right) is much longer, and requires more special
 characters.

 print( {0}={1}.format('this',99))

 Maybe it's worth all the extra trouble, and breaking backward
 compatibilty, and all. But, I never had the idea that the old way was
 all that big a problem. Of course, I could be wrong. Was the old way
 all that big of a problem?

Well, I was playing with python 3k a little bit and, as usual, after a
few minutes everything felt natural.
The new string formating is perhaps a little more typing, much is much
more clear and readable.
I know where it came from. Long ago, Guido took a look at Boo, which
is a python-like .NET language, and he posted a comment saying how
much he liked the string formating, which is identical to the new one
in python.

I still can't get used to add the parenthesis to print, and this is
the only thing I don't like, but I'm sure there's a good reason for
this change...

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Luis M . González
On Dec 29, 9:44 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 How do you lose backward compatibility by *adding* new functionality? The
 old functionality will continue to work as normal.

 --
 Steven

AFAIK it still works the old way, but it will be deprecated soon.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Luis M . González
On Dec 22, 12:11 pm, walterbyrd walterb...@iname.com wrote:
 I have read that python is the world's 3rd most popular language, and
 that python has surpassed perl in popularity, but I am not seeing it.

 From what I have seen:

 - in unix/linux sysadmin, perl is far more popular than python,
 windows sysadmins typically don't use either.
 - in web-development, php is far more popular than python - it's not
 even close.
 - when I did a search on dice, I found over 20X more jobs advertised
 for ruby on rails developers, than for python dango developers.
 - application development is dominated by java, c/c++, and maybe a
 little visual basic.
 - as I understand it, fortran is still the most popular language for
 numberical programming.

 Of course, these are just observations on my part, nothing scientific
 about it. But, I can't help but wonder how python's popularity was
 determined. I suspect that a lot of people use python as a secondary
 skill. For example, I use ms-word, but I'm not an ms-word
 professional.

 Please note: I am not confusing popularity with quality. I am not
 saying that php is better for web-dev, or anything like that. I am
 just wondering how python is rated as being so popular, when python
 does not seem to dominate anything.


Sooner or later, we will remember those good old days where python was
our secret sauce...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-22 Thread Luis M . González
On Dec 22, 3:44 pm, r rt8...@gmail.com wrote:
 Steve Holden

  What makes you assume this is a zero-sum game, and that Python won't
  survive if any other language becomes popular. Every language borrows
  from those that came before it. Terms like outright plagiarism don't
  encourage rational debate, and make you seem like a troll who is more
  interested in stirring up controversy than actually doing things to help
  promote the language.

 This is a war Steve, and i will explain why. Python does not need to
 compete with perl, lisp, C, basic, etc, etc. WHY, well because python
 is SO radically different than those languages. Ruby on the other
 hand, took most from python, the only difference is Ruby's full OO
 integration.(12.method()). Since Ruby is so similar to python we must
 consider that some people who would have found only python in this
 niche now could go to Ruby. I am for choices, but this is out and out
 robbery!
 Of course we must stand on the shoulders of greater minds than our own
 to get ahead, but using someone's knowledge against them is wrong. If
 Ruby want's to incorporate so many Pythonian ideas into their
 language, at least put a note in the tutorial giving credit to Guido
 for his wisdom. Don't use our ideas and then bash python in the next
 breath!

  I have an article about the Zen coming up in Python Magazine so I
  won't steal its thunder. Suffice it to say that people take the Zen far
  too seriously. Anyone who does so undermines their own credibility as a
  Python commentator. This isn't a war. Stop being childish.

 I was speaking to the loyalty of Pythonista's. Of course we are not
 really going to slay mats, come on Steve, get real!

  If all you want from a language is speed, go use C. I would avoid
  assembly language though, since a modern optimizing C compiler will
  often beat an assembly language programmer for execution speed, and the
  programming time will definitely be shorter. But to make speed the
  be-all and end-all is a witless approach. Speed is definitely not why
  dynamic languages' popularity is increasing. Speed *is* still relevant
  in certain areas, and completely irrelevant in others.

 Come on Steve, i am NOT saying speed is the only thing that matters
 here! But it is very important. I never compared Python to C, that is
 madness. But it must be better, faster, smarter than it's direct
 competition(ruby)... you agree??

  Much more of this kind of tripe and nobody will read what you write
  anyway. You will hear the plonking of a hundred thousand newsreaders
  every time you post.

 Oh Steve... Listen, my words are ment as a wake-up-call to all who
 still love Python, and i believe you are one of them. Maybe old age
 has slowed your hand, that's OK, Us youngsters will take the helm.
 And be serious, do you really think this group is read by hundreds-of-
 thousands of news readers? I wish it were, but I highly doubt it.

Dude, calm down... There is no war here.
Please turn off your computer, go take a walk for awhile, experience
some real life in the outer world, and then think about this again.
Python is cool language, Ruby too. We are all happy and competition is
good.
Nobody will win this war and the loser won't be annihilated. I hope
there will be some healthy cross-pollination.
There is actually, for example python borrowed list-comprehensions
from haskell and I've never heard any haskell fan calling for jihad.

Did you know that people are looking forward to use pypy to create a
fast ruby implementation?
Pypy is being developed by python developers and they will be happy to
see a ruby, perl, logo or whatever language implemented with pypy. We
are talking about tools, not religions.
Those who use them to create useful, real life applications know it.

Soon, we will be able to use python libraries from ruby and the other
way around. the differences will be just a matter of taste, different
syntax to achieve the same tasks.

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-22 Thread Luis M . González
On Dec 22, 3:42 pm, cm_gui cmg...@gmail.com wrote:
 Python is slow.

Haven't you said that already?
Well, you did it so many times that you convinced me...

I'll tell the Google folks that they are a bunch of ignorant fools for
choosing python.
That's why their business is doing that bad. They will surely go to
hell.
This Google search engine and that silly site youtube... they won't
work.
THEY ARE SLOW!

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-21 Thread Luis M . González
On Dec 21, 2:34 pm, r rt8...@gmail.com wrote:
 RTFM, use as much python code and optimize with C where needed,
 problem solved!

That's true if your *really* need C's extra speed.
Most of the times, a better algorithm or psyco (or shedskin) can help
without having to use any other language.
This is unless you are hacking a kernel, writing device drivers or 3D
image processing.
For anything else, python is fast enough if you know how to optimize
your code.

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: Namespaces, multiple assignments, and exec()

2008-12-20 Thread Luis M . González
On Dec 19, 11:34 pm, John O'Hagan resea...@johnohagan.com wrote:
 I have a lot of repetitive assignments to make, within a generator, that use a
 function outside the generator:

 var1 = func(var1, args)
 var2 = func(var2, args)
 var3 = func(var3, args)
 etc...

 In each case the args are identical, but the first argument is a string of the
 name being assigned. It works fine but I'd like to reduce the clutter by
 doing the assignments in a loop. I've tried using exec():

 for name in name_string_list:
     exec(name + ' = func(\' + name + '\, args)')

 but in the local namespace it doesn't understand func(), and if I give it
 globals() it doesn't understand the args, which come from within the
 generator.

 What's a good way to do this kind of thing?

 Thanks,

 John

Why don't you just use a dictionary?

d = {}

for name in name_string_list:
 d[name] = func(name, args)

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-15 Thread Luis M . González
On Dec 15, 1:38 am, cm_gui cmg...@gmail.com wrote:
 hahaha, do you know how much money they are spending on hardware to
 make
 youtube.com fast???

  By the way... I know of a very slow Python site called YouTube.com. In
  fact, it is so slow that nobody ever uses it.



Buddy, just stop whining and go with c++ if it makes you happy.
By the way, what's the blazingly fast application you need to write so
desperately?
What kind of performance problem have you find in python that makes
you so unhappy?
What are you going to do with all the extra speed provided by c++ (a
Hello World! ?)...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-12 Thread Luis M . González
On Dec 12, 10:43 am, sturlamolden sturlamol...@yahoo.no wrote:
 On Dec 12, 2:29 pm, sturlamolden sturlamol...@yahoo.no wrote:

  Creating a fast implementation of a dynamic language is almost rocket
  science. But it has been done. There is Stronghold,

 I meant of course Strongtalk...

Blah, blah, blah...
Why don't you guys google a little bit to know what's being done to
address python's slowness??
It has been mentioned in this thread the pypy project (isn't it enough
for you??)
Other hints: shedskin, psyco, pyrex...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-12 Thread Luis M . González
On Dec 12, 11:17 am, sturlamolden sturlamol...@yahoo.no wrote:
 On Dec 12, 3:04 pm, Luis M. González luis...@gmail.com wrote:

  Why don't you guys google a little bit to know what's being done to
  address python's slowness??

 Nothing is being done, and woth Py3k it got even worse.

  It has been mentioned in this thread the pypy project (isn't it enough
  for you??)
  Other hints: shedskin, psyco, pyrex...

 None of those projects addresses inefficacies in the CPython
 interpreter, except for psyco - which died of an overdose PyPy.

 PyPy is interesting if they ever will be able to produce something
 useful. They have yet to prove that. Even if PyPy can come up with a
 Python JIT, they will still be decades behind the technologies of
 Strongtalk and Java. That is the problem with reinventing the wheel
 all over again.

 Not to forget LLVM and Parrot which also will support Python
 frontends.

So, what's your conclusion?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-11 Thread Luis M . González
On Dec 10, 3:42 pm, cm_gui [EMAIL PROTECTED] wrote:
 http://blog.kowalczyk.info/blog/2008/07/05/why-google-should-sponsor-...

 I fully agree with Krzysztof Kowalczyk .
 Can't they build a faster VM for Python since they love the language
 so much?

 Python is SLOW.    And I am not comparing it with compiled languages
 like C.
 Python is even slower than PHP!

 Just go to any Python website and you will know.
 An example is:http://www2.ljworld.com/
 And this site is created by the creators of Django!

 And it is not just this Python site that is slow. There are many many
 Python sites which are very slow. And please don’t say that it could
 be the web hosting or the server which is slow — because when so many
 Python sites are slower than PHP sites, it couldn’t be the web
 hosting.   Also, Zope/Plone is even slower.

 Python is slow. Very slow.


Now seriously, just to finish your idiotic rant, check the Pypy
project:

http://codespeak.net/pypy
http://morepypy.blogspot.com

And if you still think this is not enough, why don't you help these
guys to make it faster?

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python is slow

2008-12-10 Thread Luis M . González
You are WRONG, WRONG, WRONG!!
And when I say Wrong, I mean WRONG!!!

And I am not saying that you are confussed.
I say that you are WRONG!

And when someone says so many times that you are wrong, it is because
you are WRONG!
And don't say that you are not wrong, because you are wrong!

You are Wrong. Very Wrong.


On Dec 10, 3:42 pm, cm_gui [EMAIL PROTECTED] wrote:
 http://blog.kowalczyk.info/blog/2008/07/05/why-google-should-sponsor-...

 I fully agree with Krzysztof Kowalczyk .
 Can't they build a faster VM for Python since they love the language
 so much?

 Python is SLOW.    And I am not comparing it with compiled languages
 like C.
 Python is even slower than PHP!

 Just go to any Python website and you will know.
 An example is:http://www2.ljworld.com/
 And this site is created by the creators of Django!

 And it is not just this Python site that is slow. There are many many
 Python sites which are very slow. And please don’t say that it could
 be the web hosting or the server which is slow — because when so many
 Python sites are slower than PHP sites, it couldn’t be the web
 hosting.   Also, Zope/Plone is even slower.

 Python is slow. Very slow.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python for kids?

2008-12-07 Thread Luis M . González
This is a very good advice.
I learned from my own experience in college that trying to learn a
solution to a problem I never had, is wasted time.
The first step is confronting your student with an specific problem,
then let him try to find a way to solve it by himself.
After he tried hard many approaches to solving the problem with his
limited knowledge, show him the right way.
This way he will see the light.

I believe that many teachers don't know this basic concept, and they
simply teach in a mechanical way, without having their students
interested in the subject or without having explained them what
exactly these skills are good for.

Luis

On Dec 7, 5:37 pm, [EMAIL PROTECTED] wrote:
 On Dec 7, 9:13 pm, Russ P. [EMAIL PROTECTED] wrote:

  I have a 12-year-old son who spends too much time playing Xbox live
  and watching silly YouTube videos. I would like to try to get him
  interested in programming.

 Lot of people learn to program even before age of 12.
 But I think it's better for you to help him get interest in problem-
 solving and some of the other bases of the mathematic, scientific and
 computational mindset. Once those interests are in place, he will
 probably go looking by himself for things like programming languages,
 math and science (of course at that point a gentle guide toward good
 ideas, good problems to solve, good books to read and good programming
 languages, helps).

 Otherwise you risk pushing a person to learn using a tool (programming
 is interesting by itself, but it's mostly a tool still) before having
 any use for such tool or desire to learn it. And this may lead to
 someone with no passion to solve problems and learn.

 Bye,
 bearophile

--
http://mail.python.org/mailman/listinfo/python-list


Re: How to import from a file which is not in the current directory?

2008-10-22 Thread Luis M . González
Lets say that you are in directory C:\\Python25 and you want to
import function bar defined in module foo located in your windows
desktop.
You do it like this:

 import sys
 sys.path.append('C:\\Users\\You\\Desktop')
 from foo import blah

So you add your desktop to sys.path and then import the function as
though it is in the same directory.
Hope this helps...

Luis



On 22 oct, 18:38, Kurda Yon [EMAIL PROTECTED] wrote:
 Hi,

 I would like to import a function from a file which is located not in
 the same directory as the main program (from which the function needed
 to be imported).

 Could anybody pleas tell me how to do that?

 Thank you in advance.

--
http://mail.python.org/mailman/listinfo/python-list


Re: How to import from a file which is not in the current directory?

2008-10-22 Thread Luis M . González
Lets say that you are in directory C:\\Python25 and you want to
import function bar defined in module foo located in your windows
desktop.
You do it like this:

 import sys
 sys.path.append('C:\\Users\\You\\Desktop')
 from foo import bar

So you add your desktop to sys.path and then import the function as
though it is in the same directory.
Hope this helps...
Luis


On 22 oct, 18:38, Kurda Yon [EMAIL PROTECTED] wrote:
 Hi,

 I would like to import a function from a file which is located not in
 the same directory as the main program (from which the function needed
 to be imported).

 Could anybody pleas tell me how to do that?

 Thank you in advance.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python - ubuntu

2008-08-29 Thread Luis M . González
It's worth noting that Ubuntu's creator is a fan of python.
So it comes as no surprise that the distribution has a lot of
components written in this language.
Also, and as far as I know, the use of python is encouraged for making
contributions.


On Aug 29, 11:57 am, azrael [EMAIL PROTECTED] wrote:
 Hy folks

 A friend of mine told me something about Guido and google developing
 an Ubuntu distribution based and totaly oriented for the Python
 appliction development. I googled for it with no results. Is it
 possible that My Buddy is trying to foole me or is it possible that
 someone knows something about that.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Replace reduce with listcomprehension?

2008-08-25 Thread Luis M . González
Actually, GvR announced that lambda, filter and map will stay (the
latter two with small changes, returning iterators instead of lists).
Only reduce will be removed from the 3.0 standard library. You can
import it from functools.

Check the full article here: 
http://www.artima.com/weblogs/viewpost.jsp?thread=98196

Luis


On Aug 25, 7:08 pm, ssecorp [EMAIL PROTECTED] wrote:
 GvR wants to eliminate all the functional stuff (lambda map reduce
 filter) which kind of makes sense for Python, listcomprehensions are
 more efficient(at least as implemented inpython) from what i have
 gathered and they can express everything map/reduce/filter with
 crippled lambdas can.

 but what about this:
 reduce(lambda x,y:x*y+x,[1,2,3,4,5,6])

 how would I express that in a listcomprehension?

--
http://mail.python.org/mailman/listinfo/python-list


Re: Replace reduce with listcomprehension?

2008-08-25 Thread Luis M . González
Correction:
I guess the link I provided above is old news...
In the more recent Python 3000 FAQ, GvR says:

Q. If you're killing reduce(), why are you keeping map() and filter()?

A. I'm not killing reduce() because I hate functional programming; I'm
killing it because almost all code using reduce() is less readable
than the same thing written out using a for loop and an accumulator
variable. On the other hand, map() and filter() are often useful and
when used with a pre-existing function (e.g. a built-in) they are
clearer than a list comprehension or generator expression. (Don't use
these with a lambda though; then a list comprehension is clearer and
faster.)

So it seems only reduce will be eliminated.

Luis
--
http://mail.python.org/mailman/listinfo/python-list


Re: Hobbyist - Python vs. other languages

2008-08-01 Thread Luis M . González
On 31 jul, 15:32, fprintf [EMAIL PROTECTED] wrote:
 I have been playing with computers since I first learned to program
 moving shapes on an Atari 800XL in BASIC. After many years of dabbling
 in programming languages as a hobbyist (I am not a computer scientist
 or other IT professional), I have never found a way to stick with a
 language far enough to do anything useful.  I learn all about loops
 and data structures and functions/methods etc. but never get to create
 a program that will do anything of value that I can't more easily do
 via freeware. Well, except the slot car timing system I wrote in C++
 for Linux many moons ago.

 Honestly Python seems like a breath of fresh air and possibly a way to
 get back to my BASIC roots, you know, programming just for the fun of
 it.

 Since I don't have a specific problem to solve, besides
 Pythonchallenge (which I found very cryptic), and Project Euler (which
 I found beyond my mathematics skills), is there a place to go for
 increasingly difficult problems to solve? I have followed a number of
 the recommended online tutorials that contain a logical progression of
 problems and yet they all end at the point where a person has enough
 knowledge of the syntax, but not really enough to do anything.

Are you interested in web development?
This could be a very good way to use python for doing useful things,
since any app you create for the web can be instantly available to
thousands of people. And now you have Google App Engine, which is a
new and free way to get your python app online.
Actually, any problem you may want to solve should have some kind of
graphical interface if you want your app to be used by other people.
So why not giving your apps a web interface? It has many advantages,
and it seems to be the way to go today.


--
http://mail.python.org/mailman/listinfo/python-list


Re: object-relational mappers

2008-04-03 Thread Luis M . González
I have come to the same conclusion.
ORMs make easy things easier, but difficult things impossible...

The best approach I've seen so far is webpy's (if we are talking of
web apps).
It isn't an ORM, it is just a way to make the database api easier to
use.
Queries don't return objects, they return something similar to
dictionaries, which can be used with dot notation ( for example,
result.name is equal to result['name'] ).

A simple select query would be db.select('customers') or
db.select('customers', name='John').
But you can also resort to plain sql as follows: db.query('select *
from customers where name = John').

Simple, effective and doesn't get in your way.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: object-relational mappers

2008-04-03 Thread Luis M . González
Yes, webpy's db api can be used in stand-alone scripts if you want.
See below:

import web
db = web.database(dbn='mysql', db='northwind', user='root')
x = db.select('employees')
...

Another good thing is that, since queries return Storage objects
(similar to dictionaries), they are much more flexible.
Suppose that you get the results of a form sent via a POST method, and
you want to insert this data into your database.
You would simple write:

i = web.input()
db.insert('orders', **i)

So everything related to CRUD operations are is easy to do, without
having to mess with objects.
I think this sticks strictly to the KISS principle, keeping it simple,
with less overhead, less layers of abstraction and therefore, less
bugs and complications.
And it matchs perfectly webpy's philosofy for creating web apps.

Luis


On 3 abr, 11:06, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
 Seems nice too in another way. Is that part independant of the rest of
 the framework ? If so, I'll have to give it a try at least for admin
 scripts.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: object-relational mappers

2008-04-03 Thread Luis M . González
On 3 abr, 11:06, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
 Luis M. González a écrit :

  I have come to the same conclusion.
  ORMs make easy things easier, but difficult things impossible...

 Not my experience with SQLAlchemy. Ok, I still not had an occasion to
 test it against stored procedures, but when it comes to complex queries,
 it did the trick so far - and (warning: front-end developper
 considerations ahead) happened to be much more usable than raw strings
 to dynamically *build* the queries.

  The best approach I've seen so far is webpy's (if we are talking of
  web apps).
  It isn't an ORM, it is just a way to make the database api easier to
  use.
  Queries don't return objects, they return something similar to
  dictionaries, which can be used with dot notation ( for example,
  result.name is equal to result['name'] ).

  A simple select query would be db.select('customers') or
  db.select('customers', name='John').
  But you can also resort to plain sql as follows: db.query('select *
  from customers where name = John').

  Simple, effective and doesn't get in your way.

 Seems nice too in another way. Is that part independant of the rest of
 the framework ? If so, I'll have to give it a try at least for admin
 scripts.

Yes, webpy's db api can be used in stand-alone scripts if you want.
See below:

import web
db = web.database(dbn='mysql', db='northwind', user='root')
x = db.select('employees')

for i in x:
print i.FirstName, i.LastName
...

Another good thing is that, since queries return Storage objects
(similar to dictionaries), they are much more flexible.
Suppose that you get the results of a form sent via a POST method, and
you want to insert this data into your database.
You would simple write:

i = web.input()
db.insert('orders', **i)


So everything related to CRUD operations are is easy to do, without
having to mess with objects.
I think this sticks strictly to the KISS principle, keeping it simple,
with less overhead, less layers of abstraction and therefore, less
bugs and complications.
And it matchs perfectly webpy's philosofy for creating web apps.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Psyco alternative

2008-03-29 Thread Luis M . González
On 27 mar, 13:14, king kikapu [EMAIL PROTECTED] wrote:
  One reason attention is going to PyPy instead of Psyco...

  Jean-Paul

 I had a look at PyPy, it, indeed, have a very long way to go so we can
 consider it an alternative.

To see how it´s going, you can check this out: http://morepypy.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting a string to the most probable type

2008-03-06 Thread Luis M . González
On 6 mar, 11:27, Pierre Quentel [EMAIL PROTECTED] wrote:
 Hi,

 I would like to know if there is a module that converts a string to a
 value of the most probable type ; for instance :
 - if the string is abcd the value is the same string abcd
 - string 123 : value = the integer 123
 - string -1.23 (or -1,23 if the locale for decimals is ,) : value
 = the float -1.23
 - string 2008/03/06 (the format is also locale-dependant) : value =
 datetime.date(2008,03,06)

 Like in spreadsheets, special prefixes could be used to force the
 type : for instance '123 would be converted to the *string* 123
 instead of the *integer* 123

 I could code it myself, but this wheel is probably already invented

 Regards,
 Pierre

 def convert(x):
if '.' in x:
try: return float(x)
except ValueError: return x
else:
try: return int(x)
except: return x


 convert('123')
123
 convert('123.99')
123.98
 convert('hello')
'hello'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Seeing locals() from imported function

2008-02-24 Thread Luis M. González
This is one of these times when I feel so dumb and ashamed that I
wished I never dared to ask...
Well, that did the trick. Thanks!

luis

On Feb 24, 3:41 am, 7stud [EMAIL PROTECTED] wrote:
 Yes, define your functions so that they get all the input they need
 from the arguments that are passed in.

-- 
http://mail.python.org/mailman/listinfo/python-list


Seeing locals() from imported function

2008-02-23 Thread Luis M. González
I apologize for this very basic question, but I can't understand how
this works...
I want to import a function from module B into my main script A, so
this function can see and use the locals from A.

For example:

def auto():
urls = ['/', 'index']
for k,v in __main__.locals().items(): #  these locals
are the ones of the main script
if isinstance(v,type) and k != 'index':
urls.append('/%s' %k)
urls.append(k)
return tuple(urls)

Of course this doesn't work...

Any hint?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to use .NET DLL from Python

2008-02-15 Thread Luis M. González
On Feb 14, 6:26 pm, Fuzzyman [EMAIL PROTECTED] wrote:
 On Feb 13, 6:58 pm, Luis M. González [EMAIL PROTECTED] wrote:



  On 13 feb, 00:26, Dino Viehland [EMAIL PROTECTED] wrote:

Oh, I know what you mean.
But that was exactly the reason for having a .DLLs folder, isn't it?
When you place an assembly into this folder, you avoid having to write
this boilerplate code, and simply import the assembly as you would
with a normal python module. At least, that´s how it worked in
previous versions...
   No. You have always had to add references to assemblies before being
   able to use the namespaces they contain. You even have to do this with
   C# in Visual Studio.

   This *should* work in bothIronPython1.x and IronPyton 2.0 - the catch 
   though is that it's implemented in the default site.py we ship with.  So 
   if you do the usual thing and use CPython's Lib directory you'll lose 
   this feature w/o copying it over.

  Sorry Dino, I don't understand...
  What does Cpython's Lib have to do with it?

 If you have the CPython standard library in your IRONPYTHONPATH, then
 when IronPython does it's normal 'import site' on startup the CPython
 one will be used instead of the default IronPython one...

 Michael Foordhttp://www.manning.com/foord

I see. Thank you!

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RELEASED Python 2.5.2, release candidate 1

2008-02-15 Thread Luis M. González
On 14 feb, 22:39, Paul Rubin http://[EMAIL PROTECTED] wrote:
 I join everyone else in thanking Martin for his work on this whole
 effort.  This wording and naming thing is a trivial subtopic.

Thanks Martin and company for the good job!
By the way, I'm not a native speaker either and I understood perfectly
the meaning of your post.

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to use .NET DLL from Python

2008-02-13 Thread Luis M. González
On 13 feb, 00:26, Dino Viehland [EMAIL PROTECTED] wrote:
  Oh, I know what you mean.
  But that was exactly the reason for having a .DLLs folder, isn't it?
  When you place an assembly into this folder, you avoid having to write
  this boilerplate code, and simply import the assembly as you would
  with a normal python module. At least, that´s how it worked in
  previous versions...
 No. You have always had to add references to assemblies before being
 able to use the namespaces they contain. You even have to do this with
 C# in Visual Studio.

 This *should* work in both IronPython 1.x and IronPyton 2.0 - the catch 
 though is that it's implemented in the default site.py we ship with.  So if 
 you do the usual thing and use CPython's Lib directory you'll lose this 
 feature w/o copying it over.

Sorry Dino, I don't understand...
What does Cpython's Lib have to do with it?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why not a Python compiler?

2008-02-08 Thread Luis M. González
On 8 feb, 22:15, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
 On Fri, 08 Feb 2008 17:45:36 +, Grant Edwards wrote:
  On 2008-02-08, Arnaud Delobelle [EMAIL PROTECTED] wrote:

  Please get back on topic.  This discussion is about parsecs and
  wookies now.

  What's a wookie a unit of?

 The degree of confusion among the jury when using the Chewbacca defense. :-)

 http://en.wikipedia.org/wiki/Chewbacca_defense

 Ciao,
 Marc 'BlackJack' Rintsch


You are all a bunch of pathetic geeks with your nerdy lingo.
All of you should be frozen in carbonite and sold to a Hutt...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to use .NET DLL from Python

2008-02-07 Thread Luis M. González
On 7 feb, 05:52, Fuzzyman [EMAIL PROTECTED] wrote:
 Luis M. González wrote:
  On 6 feb, 21:17, Fuzzyman [EMAIL PROTECTED] wrote:
   On Feb 6, 9:59 pm, Luis M. Gonz�lez [EMAIL PROTECTED] wrote:

On Feb 6, 6:27 pm, Huayang Xia [EMAIL PROTECTED] wrote:

 Hello All,

 I have several .NET DLL (I have no source code for them), is there
 anyway to use them from python instead of from C#.

 Thanks,
 Huayang

I used to put my .dll files into the .DLL folder, so I could simply
import them as I would with any other python module.
But since I started using Ironpython 2.0 Alpha* this doesn't work
anymore...
Any hint?

   The rule is probably still that the DLLs must be in a directory on
   sys.path for the interpreter to find them. Try adding the directory
   containing the assemblies to sys.path and see if you can add
   references to them.

   Michael Foordhttp://www.manning.com/foord

Luis

  I tried adding the directory to sys.path.
  Still not working...

   import sys
   sys.path.append('C:\Documents and 
   Settings\luismg\Escritorio\IronPython-2.0A
  8\DLLs')
   from ClassLibrary1 import *
  Traceback (most recent call last):
File , line unknown, in ##235
File , line unknown, in _stub_##2
  ImportError: No module named ClassLibrary1

 You need to add references to assemblies before you can import from
 the namespaces they contain.

 import clr
 clr.AddReference('ClassLibrary1')

 HTH

 Fuzzymanhttp://www.manning.com/foord

Oh, I know what you mean.
But that was exactly the reason for having a .DLLs folder, isn't it?
When you place an assembly into this folder, you avoid having to write
this boilerplate code, and simply import the assembly as you would
with a normal python module. At least, that´s how it worked in
previous versions...

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Luis M. González
On Feb 6, 6:27 pm, Huayang Xia [EMAIL PROTECTED] wrote:
 Hello All,

 I have several .NET DLL (I have no source code for them), is there
 anyway to use them from python instead of from C#.

 Thanks,
 Huayang

I used to put my .dll files into the .DLL folder, so I could simply
import them as I would with any other python module.
But since I started using Ironpython 2.0 Alpha* this doesn't work
anymore...
Any hint?

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Luis M. González
On 6 feb, 21:17, Fuzzyman [EMAIL PROTECTED] wrote:
 On Feb 6, 9:59 pm, Luis M. González [EMAIL PROTECTED] wrote:

  On Feb 6, 6:27 pm, Huayang Xia [EMAIL PROTECTED] wrote:

   Hello All,

   I have several .NET DLL (I have no source code for them), is there
   anyway to use them from python instead of from C#.

   Thanks,
   Huayang

  I used to put my .dll files into the .DLL folder, so I could simply
  import them as I would with any other python module.
  But since I started using Ironpython 2.0 Alpha* this doesn't work
  anymore...
  Any hint?

 The rule is probably still that the DLLs must be in a directory on
 sys.path for the interpreter to find them. Try adding the directory
 containing the assemblies to sys.path and see if you can add
 references to them.

 Michael Foordhttp://www.manning.com/foord



  Luis

I tried adding the directory to sys.path.
Still not working...

 import sys
 sys.path.append('C:\Documents and Settings\luismg\Escritorio\IronPython-2.0A
8\DLLs')
 from ClassLibrary1 import *
Traceback (most recent call last):
  File , line unknown, in ##235
  File , line unknown, in _stub_##2
ImportError: No module named ClassLibrary1

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Client side GUI-like web framework ?

2008-02-05 Thread Luis M. González
On Feb 4, 2:45 pm, USCode [EMAIL PROTECTED] wrote:
 Wouldn't it be handy if there was a web framework that allowed you to
 create pages and control the interface like you would using a
 client-side GUI framework such as Tkinter?

 The framework would need a small, fast web server that would
 automatically fire up when you ran your application and you then control
 the interface just like you would with client-side GUI widgets (within
 the limitations of browsers of course).  It would handle all the
 complexities of HTTP, HTML, Javascript, etc. letting you focus on adding
 functionality to your application.

 Essentially you would be using the browser as your cross-platform
 client-side interface.  You would just interact with all the widgets
 like trees, grids, paned windows, checkboxes, buttons, etc.

 There wouldn't happen to be anything like that available, would there?
 I've seen CherryPy but that doesn't quite seem to be what I described.

 Thanks!

There are many python web frameworks available.
All you need is to create a web app with one of these, and then
distribute it with its own built-in server (all these frameworks
include a small development server).
If you use a database, you should use sqlite, which comes already
included in within python.

Actually, there only difference is that instead of serving your site
through a web server, you are serving it through a built-in server,
included within your app distribution.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IronPython vs CPython: faster in 1.6 times?

2008-02-05 Thread Luis M. González
On 5 feb, 14:31, dmitrey [EMAIL PROTECTED] wrote:
 Hi all,
 the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
 (blog of a game developers)
 says IronPython is faster than CPython in 1.6 times.
 Is it really true?
 If yes, what are IronPython drawbacks vs CPython?
 And is it possible to use IronPython in Linux?

 D.

I posted a little benchmark some time ago in ironpython's list that
showed a big performance gap between both implementations (being
cpython much faster than ironpython).
Jim Hugunin replied showing that making the script more abstract
(encapsulating code as much as possible into functions) the .NET
framework makes a better job at optimizing everything.

So I took Istvan script and made a little modification as follows:

import time

def foo(a):
return a * a

def do():
start = time.time()
data = {}
for i in xrange( 10**6 ):
data[i] = foo(i)
print 'Elapsed time:%5.2f s' % ( time.time() - start)

do() # pre-run to avoid initialization time
do()

import psyco
psyco.full()

print '\nNow with psyco...\n'

do()
do()

input()

The result is that it runs slighty faster in both, IP and CP, but
cpython is still faster (around 2x) than ironpython.
However, when using psyco simply blows everything out of the water...

These are my results.

Ironpython 2.0 Alpha 8:
Elapsed time: 3.14 s
Elapsed time: 3.36 s

cpyhon 2.5:
Elapsed time: 1.55 s
Elapsed time: 1.58 s

Now with psyco...

Elapsed time: 0.88 s
Elapsed time: 0.80 s
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why not a Python compiler?

2008-02-05 Thread Luis M. González
On 5 feb, 05:19, Santiago  Romero [EMAIL PROTECTED] wrote:
  ( Surely if this question has been asked for a zillion of times... )
  ( and sorry for my english! )

  I'm impressed with python. I'm very happy with the language and I
 find Python+Pygame a very powerful and productive way of writing 2D
 games. I'm not, at this moment, worried about execution speed of the
 small game I'm working on (it runs at full 60 fps even in an old AMD-
 K6 450 Laptop computer), but I continue asking me the same question:

  Why not a Python COMPILER?

  It would be very nice to be able to output Linux, MAC or Windows
 binaries of compiled (not bytecompiled) code. It would run faster, it
 will be smaller in size (I think) and it will be easy to distribute to
 people not having python installed. Yes, I know about py2exe, but I'm
 not sure if that's the right aproach.

  So, what's wrong with compiling python?

  Maybe is not possible due to nature of the language? Is just a
 decision?

  What do you think about this?


There are some projects aimed to speed up Python by a large margin.
Right now you can use psyco, which is considered to be feature
complete, and whose future relies on the Pypy project.

Pypy is a very ambitious project and it aims, amongst many other
goals, to provide a fast just-in-time python implementation.
They even say that the secret goal is being faster than c, which is
nonsense, isn´t it? (I still didn´t get the joke though...).

And finally, you have ShedSkin, a project developed by one lonely and
heroic coder (Mark Dufour).
Shedskin aims at being a static python compiler, which can translate a
subset of python to stand alone executables.
It also can compile extension modules for cpython.
It works by translating python to c++ and then to machine code.
The python code must be done in a static way (getting rid of dynamic
features like, for example, not asigning different types to the same
variable).

Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: achieving performance using C/C++

2007-11-05 Thread Luis M . González
On Nov 5, 8:51 am, Filip Wasilewski [EMAIL PROTECTED] wrote:
 On Nov 5, 7:40 am, sandipm [EMAIL PROTECTED] wrote: I did fair amount of 
 programming in python but never used c/c++ as
  mentioned below.
  any good tutorials for using C/C++ to optimize python codebase for
  performance?
  how widely do they use such kind of mixed coding practices?

 [...]

 Since you are fluent in Python I also suggest you to start with
 Pyrex[1]/Cython[2]. This will let you to express your ideas more
 naturally (in a Python-based language) and interface with C code base
 without delving much into reference counting, manual parameters
 conversion and low-level exception handling.

 You will find some tutorials and links to resources and mailing lists
 on the projects websites, and if you specify your problem a bit more
 then probably someone will be able to give you more precise
 references.

 For alternatives take a look at [3] and [4]. Try also scanning the
 Python Package Index[5] for 'binding', 'wrapper', 'lib' or 'pyrex'
 keywords or browse for C/C++ Programming Language category as this
 will return some examples of Python extensions.

 [1]http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
 [2]http://www.cython.org/
 [3]http://www.python.org/doc/faq/extending/#writing-c-is-hard-are-there-...
 [4]http://docs.python.org/lib/module-ctypes.html
 [5]http://pypi.python.org

 fw


You might be interested also in ShedSkin.
It is a python to c++ compiler, and it lets you write extension
modules in a restricted subset of python that get automatically
translated to c++. It's still a work in progress although very usable
in its current state (and extremely easy to use).
Its main advantage, compared to Pyrex, is that you don't need to know
c or c++ at all to use it.
Pyrex requires some knowledge about c and its data types in order to
take advantage of its capabilities.
On the other hand, with shedskin you just code in python (getting rid
of its most dynamic features), and this code gets automatically
compiled to a c++ extension module, directly usable from cpython.

Check it out: http://mark.dufour.googlepages.com/

Luis


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TRying to import files from my folder not pythons lib folder

2007-09-24 Thread Luis M . González
On Sep 24, 5:00 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
 En Sun, 23 Sep 2007 22:01:39 -0300, Luis M. González [EMAIL PROTECTED]
 escribi?:

  This is exactly what I did, but I have a new problem now:
  After setingPYTHONPATHI'm no longer able to start IDLE from the
  start menu.
  It seems the system cannot find the file.
  But if I eliminatePYTHONPATH, everything works as it used to.

  I setPYTHONPATHbecause I wanted to import any existing file in my
  desktop without having to use sys.path.append...
  It works when using the command line but strangely, something get
  messed up with IDLE.
  Any hint?

 Perhaps a python module in your desktop has a name conflicting with a
 standard module?

 - On the Start menu, navigate to the IDLE item, but dont click it.
 - RIGHT click on it, and select Properties. Copy the Destination field.
 Should be something like C:\Python25\Lib\idlelib\idle.bat
 - Open a cmd window (console), paste the above text and press Enter.
 - Almost certainly you'll get an error; post here the full error and
 traceback.

 --
 Gabriel Genellina

If I paste the destination path in the command window, it simply
disappears before I can read any error message.
If I enter cmd and then the destination path, I get this:

C:\Documents and Settings\AdministradorC:\Python25\Lib\idlelib
\idle.bat
El sistema no puede encontrar el archivo idle.pyw.

Any hint?

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: TRying to import files from my folder not pythons lib folder

2007-09-24 Thread Luis M . González
On Sep 24, 5:00 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
 En Sun, 23 Sep 2007 22:01:39 -0300, Luis M. González [EMAIL PROTECTED]
 escribi?:

  This is exactly what I did, but I have a new problem now:
  After setingPYTHONPATHI'm no longer able to start IDLE from the
  start menu.
  It seems the system cannot find the file.
  But if I eliminatePYTHONPATH, everything works as it used to.

  I setPYTHONPATHbecause I wanted to import any existing file in my
  desktop without having to use sys.path.append...
  It works when using the command line but strangely, something get
  messed up with IDLE.
  Any hint?

 Perhaps a python module in your desktop has a name conflicting with a
 standard module?

 - On the Start menu, navigate to the IDLE item, but dont click it.
 - RIGHT click on it, and select Properties. Copy the Destination field.
 Should be something like C:\Python25\Lib\idlelib\idle.bat
 - Open a cmd window (console), paste the above text and press Enter.
 - Almost certainly you'll get an error; post here the full error and
 traceback.

 --
 Gabriel Genellina

I solved the problem!
You were right. It seems there was a module that was causing problems,
although I don't know which one...
I just moved all the .py files on my desktop to a new folder, and
everything worked just fine.
The list of .py files in my desktop were:

'code.py', 'code2.py', 'code22.py', 'code3.py', 'draft.py',
'flups.py', 'forma.py', 'fx.py', 'nuevo.py', 'nwind', 'ops',
'pages.py', 'qqq.py', 'sample.py', 'ses.py', 'sess.py', 'sess2.py',
'soup.py', 'style.py', 'test_session.py', 'up.py', 'up2.py', 'ww.py',
'xx.pyw', 'xx.rsrc.py', '.py'

Any idea of which one was causing trouble?

Gracias, che!
Luis

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: TRying to import files from my folder not pythons lib folder

2007-09-23 Thread Luis M . González

Steve Holden wrote:
 [EMAIL PROTECTED] wrote:
  On Sep 21, 12:32 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:
  Hi,
 
  I'm trying to create my own lib of functions, but it seems like I can
  only import them if they are in pythons lib folder.
 
  Example
  I have a folder called
  K:\mypython
 
  Now in the interactive python shell I type
  Import k:\mypython\listall
  And get a error on :
 
  If I store listall.py in pythons lib folder and type
  Limport listall
 
  It works fins.
 
  Can I create my own library of functions and store them in a separate
  dir
 
  Also I try to creat a folder in pythomns lib folder and that did not
  work
 
  Help
  -Ted
 
  One workaround is to do to this:
 
  code
 
  import sys
  sys.path.append(r'K:\mypython')
  import listall
 
  /code
 
  You can also add your path to the .pth file, but I've never done that,
  so I can't tell you how.
 
  Hope that helps!
 
  Mike
 
 The easiest way, particularly for testing, is to set the PYTHONPATH
 variable. It should be a colon-separated list of directories on Unices,
 and a semi-colon separated list on Windows. Those directories will be
 added to sys.path.

 See http://docs.python.org/tut/node8.html for yet more.

 regards
   Steve

 --
 Steve Holden+1 571 484 6266   +1 800 494 3119
 Holden Web LLC/Ltd   http://www.holdenweb.com
 Skype: holdenweb  http://del.icio.us/steve.holden

 Sorry, the dog ate my .sigline

This is exactly what I did, but I have a new problem now:
After seting PYTHONPATH I'm no longer able to start IDLE from the
start menu.
It seems the system cannot find the file.
But if I eliminate PYTHONPATH, everything works as it used to.

I set PYTHONPATH because I wanted to import any existing file in my
desktop without having to use sys.path.append...
It works when using the command line but strangely, something get
messed up with IDLE.
Any hint?

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Luis M . González
On Sep 2, 11:16 pm, llothar [EMAIL PROTECTED] wrote:
 On 3 Sep., 07:38, Eduardo O. Padoan [EMAIL PROTECTED]
 wrote:

   No.http://www.artima.com/weblogs/viewpost.jsp?thread=211430

  Ops, I 
  meant:http://www.artima.com/forums/threaded.jsp?forum=106thread=211200

 Thanks. I whish there would be a project for rewritting the C
 interpreter
 to make it better and more useable for threading use.

 But the CPU infrastructure is also not perfect enough so maybe it's
 good to
 wait with this a few more years until Intel and AMD know what they are
 doing.


I read somewhere that PYPY won't have the interpreter lock (I may be
wrong though).
Check it out: http://codespeak.net/pypy


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ActiveRecord for Python/MySQL

2007-08-26 Thread Luis M . González
On Aug 26, 5:52 am, Devraj [EMAIL PROTECTED] wrote:
 Thanks

 On Aug 26, 5:26 pm, EuGeNe Van den Bulke

 [EMAIL PROTECTED] wrote:
  Devraj wrote:
   My application uses MySQL as a backend and am using the MySQL/Python
   bindings. Are there any libraries that provide a database abstraction
   layer like Activerecords for Python?'

  SQLObject
  SQLAclhemy
  DejaVu
  Storm

  Google for Python ORM you may find more!

  EuGeNe --http://www.3kwa.com


If you want an ActiveRecord -like experience with SQLAlchemy, you can
use the extension Elixir on top of it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python + XUL

2007-08-12 Thread Luis M . González
On Aug 12, 3:21 am, Stefan Behnel [EMAIL PROTECTED] wrote:
 Madhu Alagu wrote:
  Hi

  Python + XUL Success Stories

  Thanks

  Madhu Alagu

 Any chance you forgot to ask a question?

 Stefan



My telepatic powers tell me that this means:
I don't really feel like googling, so just give me the info, ok?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-06-30 Thread Luis M . González
On Jun 29, 7:48 am, Mark Dufour [EMAIL PROTECTED] wrote:
 Hi all,

 I have just released version 0.0.22 of Shed Skin, an experimental
 Python-to-C++ compiler. Among other things, it has the exciting new
 feature of being able to generate (simple, for now) extension modules,
 so it's much easier to compile parts of a program and use them (by
 just importing them). Here's the complete changelog:

 -support for generating simple extension modules (linux/windows; see README)
 -dos text format fix (long overdue)
 -improved detection of dynamic types (avoid hanging on them)
 -improved overloading (__nonzero__, __int__, __abs__ etc.)
 -add str(ing).{capitalize, capwords, swapcase, center, ato*)
 -fix string.maketrans
 -several other minor bug fixes

 For more details about Shed Skin and a collection of 27 programs, at a
 total of about 7,000 lines, that it can compile (resulting in an
 average speedup of about 39 times over CPython and 11 times over Psyco
 on my computer), please visit the homepage at:

 http://mark.dufour.googlepages.com

 I could really use some help in pushing Shed Skin forward. Please try
 the latest release and send in bug reports, or join the project via
 the homepage.

 Thanks,
 Mark Dufour.

 On 3/31/07, Mark Dufour [EMAIL PROTECTED] wrote:



  Hi all,

  I have recently released version 0.0.20 and 0.0.21 of Shed Skin, an
  optimizing Python-to-C++ compiler. Shed Skin allows for translation of
  pure (unmodified), implicitly statically typed Python programs into
  optimized C++, and hence, highly optimized machine language. Besides
  many bug fixes and optimizations, these releases add the following
  changes:

  -support for 'bisect', 'collections.deque' and 'string.maketrans'
  -improved 'copy' support
  -support for 'try, else' construction
  -improved error checking for dynamic types
  -printing of floats is now much closer to CPython

  For more details about Shed Skin and a collection of 27 programs, at a
  total of about 7,000 lines, that it can compile (resulting in an
  average speedup of about 39 times over CPython and 11 times over Psyco
  on my computer), please visit the homepage at:

 http://mark.dufour.googlepages.com

  I could really use more help it pushing Shed Skin further. Simple ways
  to help out, but that can save me lots of time, are to find smallish
  code fragments that Shed Skin currently breaks on, and to help
  improve/optimize the (C++) builtins and core libraries. I'm also
  hoping someone else would like to deal with integration with CPython
  (so Shed Skin can generate extension modules, and it becomes easier to
  use 'arbitrary' external CPython modules such as 're' and 'pygame'.)
  Finally, there may be some interesting Master's thesis subjects in
  improving Shed Skin, such as transforming heap allocation into stack-
  and static preallocation, where possible, to bring performance even
  closer to manual C++. Please let me know if you are interested in
  helping out, and/or join the Shed Skin mailing list.

  Thanks!
  Mark Dufour.
  --
  One of my most productive days was throwing away 1000 lines of code
  - Ken Thompson

 Mark Dufour.
 --
 One of my most productive days was throwing away 1000 lines of code
 - Ken Thompson


I love it! This is absolutely fantastic!!!
I can't belive I can write extension modules that easily...
Keep up the good work and thank you!!!

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyDAO - Python Hibernate-like Object-Relational Mapper

2007-06-27 Thread Luis M . González
On Jun 27, 4:08 pm, [EMAIL PROTECTED] wrote:
 PyDAO is very thin object-relational mapper similar to Hibernate (but
 much simpler). It's created to speed-up application development. It's
 very simple, but powerful, based on POPO (Plain Old Python Objects).

  http://aplikacja.info/PyDAO.html

 Main features:

  - can use any database that has DB-API interface (MySQLdb, psycopg
tested)
  - can work without database at all (useful for early phases of
development)
  - speeds up unit testing (dedicated in memory database)

 What is not handled:

  - automatic scheme generation
  - separate query language
  - automated handling of associations (replaced by filtering by
foreign keys)

 Here's an example how to use PyDAO:

 class User:
 def __init__(self):
 self.id = None
 self.login = None
 self.password = None

 dao = pydao.InMemoryDao()

 # filling database
 user = User()
 user.login = user1
 user.password = roh8OoPh
 dao.save(user)

 # filtering based on example
 userSearch = User()
 userSearch.login = user1
 userList = dao.list(userSearch)

 # updating
 user.password = eew8Me8g
 dao.update(user)

 Enjoy!

 --
 Dariusz Cieslakhttp://aplikacja.info- custom software systems


Interesting, but The link to AbstractDaoTest.py gives me an error
message...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: visual gui ides for python/jythpn

2007-06-24 Thread Luis M . González
On 24 jun, 04:23, Ethan Kennerly [EMAIL PROTECTED]
wrote:
 Luis M. Gonzalez wrote:
  PythonCard is an extremely easy to use alternative.
  It's like a simplified Visual Basic or Delphi IDE.
  Check IT out:www.pythoncard.org

 I second that!  PythonCard is a rapid way to prototype an ugly Windows GUI.
 (It's not PythonCard's fault that Windows are ugly. ;)  )  I use it for
 prototyping.

 But ONLY for prototyping.  At least with my version in Windows, it's got
 bugs in the resource editor.  For example, Korean characters in Korean fonts
 are rotated sideways.  And the color of a font can't be changed; only the
 foreground color can, which corrupts button display.  The send to back/front
 options don't seem to work.  Transparent images (like PNG) don't seem to
 work ... for me, anway.

 Yet, still, when I'm rapidly developing the mechanics of a game and need a
 GUI front-end, PythonCard was a quick solution.  It brilliantly stores the
 GUI as a recursive dictionary, which is like XML, only easy for a human to
 read.  The widgets require very little of your coding.  It's got a lot of
 samples, which makes some of its peculiar conventions easy to apply.  And
 any Python app made with the PythonCard framework has a namespace viewer,
 shell, and GUI message integrated into the application.

 Flash and Python:  The ultimate GUI prototyping combo?

 In my dreams, I would use Flash for the GUI portion of a Python app.  Flash
 is by far my favorite environment for rapidly designing interfaces.  It is
 an (almost) object-oriented drawing environment that can quickly produce
 good visual design.  Because the elements are instances of prototypes (Flash
 calls them symbols), they can be easily replaced and updated at any time.
 The timeline, animation, color, layer, and drawing tools are wonderful.  You
 can quickly make traditional or experimental interfaces.  The only thing
 that sucked (for me), was ActionScript.  It's not bad.  It's quite good for
 interface scripting.  But for back-end procedures it is prison compared to
 Python.

 Does anyone successfully use a Flash front-end and Python back-end in
 real-time?  I've tried an example of XMLRPC servers where a Flash app (SWF)
 communicates with Python (http://www.cs.unc.edu/~parente/tech/tr01.shtml),
 but that has a round-trip time that is too slow for something like a
 videogame (updates at 30 frames per second).  Some of the projects at OS
 flash look promising (http://osflash.org/ext_howto), but I haven't found the
 part that says that my interface made in Macromedia Flash (which is a
 fantastic design environment) can be used with my code in Python with a
 real-time frame rate.

 -- Ethan

Ethan,

If you are looking for something more ´advanced´ than a simple windows
GUI, I suggest checking out Silverlight, wich is the new deployment
technology that ties Ironpython to the browser.
With it, you can use Ironpython (wich is Python for .NET) to create
apps that run on the browser, the same way you would use javascript,
with a lot of new features like animations (ala flash).
You are not only limited to Ironpython though. You can use any .NET
language, includin other dynamic ones such as Ironruby (not released
yet).
It is a Microsoft technology, but it works on Firefox as well as IE,
on Windows and Mac.
It will also run on linux through a Mono project called Moonlight.

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: sqlite newbie questions

2007-06-21 Thread Luis M . González
On Jun 21, 4:24 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hello,

 I have a sqlite database table which has a table named Transmittal.
 Before inserting a new record into the database, i'd like to perform
 some checking. How do i select all records with certain value (say
 Smith) for a column (say Last_Name)? Knowing almost nothing about
 SQL, i just selected everything and process the returned list.

 cur.execute('select * from Transmittal')
 records = cur.fetchall()

 Also, how do i delete records with certain value for centain column. I
 was thining of something like
 cur.execute('delete * from Transmittal where Last_Name=?', Smith)
 but the syntax it's not correct.

 Thanks for your help.

 kelie

You need to learn sql if you want to deal with databases.
Don't worry, it's very easy, and here is a very good resource to get
you up and running in a few minutes:
http://www.sqlcourse.com

Good luck!
Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: visual gui ides for python/jythpn

2007-06-21 Thread Luis M . González
On Jun 20, 3:16 pm, kromakey [EMAIL PROTECTED] wrote:
 Hi,

 Are there any free visual GUI IDE's available for python/jython, which
 have a drag and drop form designer similar to Visual Studio or
 Delphi ?

 Cheers
 kromakey

PythonCard is an extremely easy to use alternative.
It's like a simplified Visual Basic or Delphi IDE.
Check IT out: www.pythoncard.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PHP5 programmer learning Python

2007-05-27 Thread Luis M . González
On May 27, 12:41 pm, romiro [EMAIL PROTECTED] wrote:
 Hi all,

 I'm a PHP5 developer looking to broaden my horizons so to speak by
 learning a new language. I emphasize the 5 in PHP since I have fully
 engrossed myself in the full OOP of version 5 with my own ground-up
 projects as well as some work with PRADO (http://pradosoft.com)

 I've dabbled with a number of languages in the past, Python being no
 exception, but always ended up coming back to PHP due to being
 comfortable with it.  Python has stuck to me as a language I _really_
 think I should know more about.  I've recently tried C#, a very short
 lived re-attempt at C++ and Java, and Ruby.  None of those seemed
 fun except for Ruby, although from what I've seen the syntax between
 Ruby and Python are very similar to each other compared to the other
 languages.

 Anyway, my first question was if anyone knows of a tutorial that
 focuses on PHP - Python learning, in such that there might be a block
 of PHP code alongside an example of how to do the same thing in
 Python.  One example of something I've already mapped a comparison to
 thanks to standard tutorials is a PHP numeric indexed array being
 similar to a list and a PHP associative array being similar to a
 dictionary.  Of course finding such of a tutorial isn't a deal breaker
 by any means, but I figured that having it available would be a boon
 for me to actually make some headway in my Python learning adventure.

 If there's anything else that could be said about the migration
 between the two languages, I'm all ears. I also don't really need to
 hear about how disgusting php is as a language...I am aware of the
 contained chaos that is PHP4, which is why I develop strictly in 5
 using its OOP to the extent my feeble brain allows, a wariness toward
 the insecure pitfalls the language has begat in the past, and an
 attempt to produce as clean of a syntax as the language can allow.

 Thanks in advance for any help.


I don't know of anything like a PHP to Python migration guide.
But I think that you should just forget about PHP for awhile an
inmerse yourself into learning Python, which is a general purpose
programming language suitable for many tasks, and not only for the
web.

Start with the official tutorial or, if you want something more
advanced, read Dive into Python.
Once you get a rough idea of all the cool things you can do with
Python, you can concentrate again in web development.

You'll be able to write more complex web sites with less code and a
cleaner syntax, although you will have to spend some time deciding how
to use Python in a web development context.

There are many frameworks to choose from, and trying them all can be a
daunting task...
The choices range from the so called full stack frameworks (such as
Django or TurboGears) that give you everything you need to build
complex web sites and even more (templates, dispatching mechanisms,
object-relational mappers, etc, etc) to minimalist solutions such as
webpy.
But this is something to evaluate after you have a good grasp of the
language itself.

Be warned: Python is highly addictive and it can make you a hopeless
junkie...

Good luck!
Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-16 Thread Luis M . González
On May 16, 6:04 pm, Victor Kryukov [EMAIL PROTECTED] wrote:
 Hello list,

 our team is going to rewrite our existing web-site, which has a lot of
 dynamic content and was quickly prototyped some time ago.

 Today, as we get better idea of what we need, we're going to re-write
 everything from scratch. Python is an obvious candidate for our team:
 everybody knows it, everybody likes it, it has *real* objects, nice
 clean syntax etc.

 Our main requirement for tools we're going to use is rock-solid
 stability. As one of our team-members puts it, We want to use tools
 that are stable, has many developer-years and thousands of user-years
 behind them, and that we shouldn't worry about their _versions_. The
 main reason for that is that we want to debug our own bugs, but not
 the bugs in our tools.

 Our problem is - we yet have to find any example of high-traffic,
 scalable web-site written entirely in Python. We know that YouTube is
 a suspect, but we don't know what specific python web solution was
 used there.

 TurboGears, Django and Pylons are all nice, and provides rich features
 - probably too many for us - but, as far as we understand, they don't
 satisfy the stability requirement - Pylons and Django hasn't even
 reached 1.0 version yet. And their provide too thick layer - we want
 something 'closer to metal', probably similar to web.py -
 unfortunately, web.py doesn't satisfy the stability requirement
 either, or so it seems.

 So the question is: what is a solid way to serve dynamic web pages in
 python? Our initial though was something like python + mod_python +
 Apache, but we're told that mod_python is 'scary and doesn't work very
 well'.

 And althoughhttp://www.python.org/about/quotes/lists many big names
 and wonderful examples, be want more details. E.g. our understanding
 is that Google uses python mostly for internal web-sites, and
 performance is far from perfect their. YouTube is an interesting
 example - anybody knows more details about that?

 Your suggestions and comments are highly welcome!

 Best Regards,
 Victor.


Take a look at reddit.com .
It's been developed with WEBPY and it receives millions of visits
every day.
There are also many sites built with Django (check their website) with
a lot of traffic and very good performance
And I'm sure other frameworks can show other success stories... just
check their websites.

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-16 Thread Luis M . González
On May 16, 6:04 pm, Victor Kryukov [EMAIL PROTECTED] wrote:
 Hello list,

 our team is going to rewrite our existing web-site, which has a lot of
 dynamic content and was quickly prototyped some time ago.

 Today, as we get better idea of what we need, we're going to re-write
 everything from scratch. Python is an obvious candidate for our team:
 everybody knows it, everybody likes it, it has *real* objects, nice
 clean syntax etc.

 Our main requirement for tools we're going to use is rock-solid
 stability. As one of our team-members puts it, We want to use tools
 that are stable, has many developer-years and thousands of user-years
 behind them, and that we shouldn't worry about their _versions_. The
 main reason for that is that we want to debug our own bugs, but not
 the bugs in our tools.

 Our problem is - we yet have to find any example of high-traffic,
 scalable web-site written entirely in Python. We know that YouTube is
 a suspect, but we don't know what specific python web solution was
 used there.

 TurboGears, Django and Pylons are all nice, and provides rich features
 - probably too many for us - but, as far as we understand, they don't
 satisfy the stability requirement - Pylons and Django hasn't even
 reached 1.0 version yet. And their provide too thick layer - we want
 something 'closer to metal', probably similar to web.py -
 unfortunately, web.py doesn't satisfy the stability requirement
 either, or so it seems.

 So the question is: what is a solid way to serve dynamic web pages in
 python? Our initial though was something like python + mod_python +
 Apache, but we're told that mod_python is 'scary and doesn't work very
 well'.

 And althoughhttp://www.python.org/about/quotes/lists many big names
 and wonderful examples, be want more details. E.g. our understanding
 is that Google uses python mostly for internal web-sites, and
 performance is far from perfect their. YouTube is an interesting
 example - anybody knows more details about that?

 Your suggestions and comments are highly welcome!

 Best Regards,
 Victor.


Take a look at reddit.com .
It's been developed with WEBPY and it receives millions of visits
every day.
There are also many sites built with Django (check their website) with
a lot of traffic and very good performance
And I'm sure other frameworks can show other success stories... just
check their websites.

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-16 Thread Luis M . González
On May 16, 6:04 pm, Victor Kryukov [EMAIL PROTECTED] wrote:
 Hello list,

 our team is going to rewrite our existing web-site, which has a lot of
 dynamic content and was quickly prototyped some time ago.

 Today, as we get better idea of what we need, we're going to re-write
 everything from scratch. Python is an obvious candidate for our team:
 everybody knows it, everybody likes it, it has *real* objects, nice
 clean syntax etc.

 Our main requirement for tools we're going to use is rock-solid
 stability. As one of our team-members puts it, We want to use tools
 that are stable, has many developer-years and thousands of user-years
 behind them, and that we shouldn't worry about their _versions_. The
 main reason for that is that we want to debug our own bugs, but not
 the bugs in our tools.

 Our problem is - we yet have to find any example of high-traffic,
 scalable web-site written entirely in Python. We know that YouTube is
 a suspect, but we don't know what specific python web solution was
 used there.

 TurboGears, Django and Pylons are all nice, and provides rich features
 - probably too many for us - but, as far as we understand, they don't
 satisfy the stability requirement - Pylons and Django hasn't even
 reached 1.0 version yet. And their provide too thick layer - we want
 something 'closer to metal', probably similar to web.py -
 unfortunately, web.py doesn't satisfy the stability requirement
 either, or so it seems.

 So the question is: what is a solid way to serve dynamic web pages in
 python? Our initial though was something like python + mod_python +
 Apache, but we're told that mod_python is 'scary and doesn't work very
 well'.

 And althoughhttp://www.python.org/about/quotes/lists many big names
 and wonderful examples, be want more details. E.g. our understanding
 is that Google uses python mostly for internal web-sites, and
 performance is far from perfect their. YouTube is an interesting
 example - anybody knows more details about that?

 Your suggestions and comments are highly welcome!

 Best Regards,
 Victor.


Reddit.com was built with webpy, and it's amongst the top 1000
websites in volume of traffic.
So if you liked it, go with it...
I believe one of the authors of reddit is also webpy's developer.

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-04 Thread Luis M . González
On May 4, 6:12 pm, Fuzzyman [EMAIL PROTECTED] wrote:
 On May 4, 5:27 pm, Kaz Kylheku [EMAIL PROTECTED] wrote:



  On May 2, 5:19 pm, sturlamolden [EMAIL PROTECTED] wrote:

   On May 3, 2:15 am, Kaz Kylheku [EMAIL PROTECTED] wrote:

Kindly refrain from creating any more off-topic, cross-posted threads.
Thanks.

   The only off-topic posting in this thread is your own (and now this
   one).

  You are making a very clumsy entrance into these newsgroups. So far
  you have started two cross-posted threads. The first is only topical
  in comp.lang.python (how to emulate macros in Python). This one is
  topical in neither one, since it is about Microsoft DLR.

  It's quite possible that some Lisp and Python programmers have a
  strong interest in Microsoft DLR. Those people who have such an
  interest (regardless of whether they are Lisp and Python user also)
  and who like to read Usenet will almost certainly find a Microsoft DLR
  newsgroup for reading about and discussing Microsoft DLR. Do you not
  agree?

 Given that the DLR is a dynamic language framework, abstracted out of
 the IronPython 1.0 release, and that it also runs on top of the core
 CLR shipped with SilverLight meaning that for the first time sandboxed
 Python scripts can run in the browser...

 It would seem entirely on topic for a Python newsgroup very on-
 topic...

 Fuzzymanhttp://www.voidspace.org.uk/ironpython/index.shtml

  Also note that there is very rarely, if ever, any good reason for
  starting a thread which is crossposted among comp.lang.* newsgroups,
  even if the subject contains elements that are topical in all of them
  (yours does not).

   Begone.

  You are childishly beckoning Usenet etiquette to be gone so that you
  may do whatever you wish. But I trust that you will not, out of spite
  for being rebuked, turn a few small mistakes into a persistent style.


Indeed, the subject is absolutely on-topic.
If can't talk about a so called Dynamic Languages Runtime in a
pyhton mailing list, I wonder what it takes to be considered on-topic.
Frankly, this on-topic/off-topic fascism I see in this list is pissing
me off a little bit.

I suggest reading this paragraph right from 
http://www.python.org/community/lists/:

Pretty much anything Python-related is fair game for discussion, and
the group is even fairly tolerant of off-topic digressions; there have
been entertaining discussions of topics such as floating point, good
software design, and other programming languages such as Lisp and
Forth.

Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Luis M . González
On Apr 20, 2:06 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Please help me think of an example where immutable tuples are
 essential.

 It seems that everywhere a tuple is used one could just as easily use
 a list instead.

 chris


I don't remember exactly where I read about it, but Guido said once
that tuples are being kept mainly for historical reasons.
This is what Python uses internally from the beginning and it's just
an implementation detail that makes sense in some contexts.
Although I guess you can ignore them and use only lists instead if you
want..

luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Luis M . González
On Apr 20, 3:28 pm, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] wrote:
 Luis M. González wrote:
  I don't remember exactly where I read about it, but Guido said
  once that tuples are being kept mainly for historical reasons.

 Weren't tuples added when lists already existed?

 Regards,

 Björn

 --
 BOFH excuse #101:

 Collapsed Backbone

I tried googling for these comments, but I couldn't find them.
Perhaps I never read them and it was just my imagination...
Anyway, I suggest reading this chapter of Dive into Python for a
good explanation of the differences between tuples and lists:
http://diveintopython.org/native_data_types/tuples.html

The article explains that, amongst other things, tuples are faster
than lists, so if you are working with constant values (inmutables)
they are more indicated than lists.

luis


-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >