Guido van Rossum | 1 May 01:12 2004

Re: PEP 289 - Generator Expressions - Let's Move Forward

> I was using this example more generally to show that if you have a
> late-binding genexpr, you have to worry about not changing the local
> variables it uses, which looks like all uses of genexprs with free
> variables are subtle bugs waiting to appear whenever someone
> modifies the function anywhere after the genexpr.  The same argument
> applies to the other stdlib cases I mentioned (which make somewhat
> less than 10% of all uses).

That's not new, we all know that that's the downside of late binding.

My counter to that is that *any* use of genexps where the consumer
doesn't consume (or discard) the iterator before the next line is
reached is extremely advanced use.

--Guido van Rossum (home page: http://www.python.org/~guido/)

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Barry Warsaw | 1 May 01:27 2004

Re: Re: PEP 289 - Generator Expressions - Let's MoveForward

On Fri, 2004-04-30 at 18:28, David Eppstein wrote:

> Oh, me too (and I'm getting a little irritated with writing dict([...]) so 
> often instead of having a proper dictcomp syntax) but semantically I think 
> they are the same.

I'm easily convinced.

pep-274-ly y'rs,
-Barry

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Junaid Ali | 1 May 07:49 2004
Picon

lost sys.stderr

hello,
ive tried to run Mozpython 0.1.1(source attached) on my i386 with Python 2.3.3 and Mozilla 1.6. While the program works perfectly well for windows , but when i try to run it on linux it gives me an error as "lost sys.stderr"
I think the problem lies in the pythontohtmlconv module wherein the python script output is written mistakenly onto the standard o/p rather than the file.
ny help is most welcome.
Ali

Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
Attachment (MozPython-0.1.1_src.zip): application/x-zip-compressed, 141 KiB
_______________________________________________
C++-sig mailing list
C++-sig <at> python.org
http://mail.python.org/mailman/listinfo/c++-sig
Armin Rigo | 1 May 09:08 2004

Re: PEP 289 - Generator Expressions - Let's Move Forward

Hello Guido,

On Fri, Apr 30, 2004 at 04:12:59PM -0700, Guido van Rossum wrote:
> That's not new, we all know that that's the downside of late binding.
> 
> My counter to that is that *any* use of genexps where the consumer
> doesn't consume (or discard) the iterator before the next line is
> reached is extremely advanced use.

My argument was that late-binding make it even more mysterious, not less
suprizing, because in the minority of cases where a listcomp is not used
immediately but still need a genexpr for performance, you have to think
carefully.

Well, I insist a bit because I cannot helping thinking that the arguments for
early-binding are "that's useful in a very small number of cases", and the
arguments for late-binding are "you don't want to do that anyway so let's pick
the semantic of free vars in functions".  I don't immediately think of genexps
as similar to functions, rather closer to listcomps, even if I know that they
are functions under the hood.

Armin

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Dan Gass | 1 May 21:31 2004
Picon

RE: Proposal: A more powerful alternative to ConfigParser

Per suggestions posted on this mailing list I created a sourceforge project 
(config-py), registered it with PyPi and submitted the following 
announcement to python-announce.

I look forward to your feedback.

Thanks,
Dan Gass

Announcement
------------

config-py version 1.0 has been released and is available at SourceForge.  
This
is the initial release of a Python module for reading python based user
configuration files to control script execution.  (It is a more powerful
alternative to Python's ConfigParser module).  The long term goal is to 
refine
this module for eventual inclusion in the standard Python distribution.

Module Description
------------------

This python module provides a simple, but extremely flexible and powerful
method of controlling python script execution by use of configuration 
settings
stored in user configuration files.  This module is a more powerful
alternative to the ConfigParser module already available in the standard
Python distribution.

The standard ConfigParser module parses text based user configuration files
and provides access to that information.  This module reads python based
configuration files and provides access to the python objects contained
within.  In addition, this module supports hierarchical organization of the
settings within the configuration files so that settings may be accessed 
using
keys specified by the user from the command line or by other means.  By use 
of
python based configuration files, this module provides a simple solution to
most configuration problems but also has the flexibility to solve the most
complex configuration issues.

Other Important Information
---------------------------

License:            GNU General Public License (GPL)

Project Home Page:  http://config-py.sourceforge.net/

Download URL:       https://sourceforge.net/projects/config-py/

Author/Maintainer:  Dan Gass (dmgass <at> hotmail.com)

_________________________________________________________________
Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Greg Ewing | 3 May 05:03 2004
Picon
Picon

Re: PEP 289 - Generator Expressions - Let's Move Forward

Armin Rigo <arigo <at> tunes.org>:

> Early binding is closer to the idea that turning a listcomp into a
> genexprs should just work if you only iterate once on the result.

I'm not sure that's an idea we should be promulgating in the first
place. The original motivation for generator expressions was things
like

  total = sum(x**2 for x in stuff)

where not only will the sequence be used just once, but it will be
used *immediately* before doing anything else.

Those are the use cases we need to advertise this as targeting, I
think, not "any listcomp that's only used once".

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg <at> cosc.canterbury.ac.nz	   +--------------------------------------+

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Greg Ewing | 3 May 05:05 2004
Picon
Picon

Re: PEP 289 - Generator Expressions - Let's Move Forward

Samuele Pedroni <pedronis <at> bluewin.ch>:

> "There should be one-- and preferably only one --obvious way to do
> it."  of course this is the case for generator expressions and list
> comprehsensions because they are separated by performance
> characteristics and somehow by the fact that one directly produces a
> list. I suspect that we have to learn to live with the fact that
> they are distinguished by (just) that, both a nuisance (sometimes
> people don't want to bother to choose) and a feature.

I just had a thought.

What if generator expressions were allowed *only* as a
parameter to a function call?

Would that help avoid leading people into the trap of
using them where they're not appropriate?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg <at> cosc.canterbury.ac.nz	   +--------------------------------------+

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Greg Ewing | 3 May 05:23 2004
Picon
Picon

Re: PEP 289 - Generator Expressions - Let's Move Forward

Josiah Carlson <jcarlson <at> uci.edu>:

> Semantically, in the first case you are modifying your dictionary, which
> has consequences to anything that has a reference to the object. Mutable
> modification during runtime should be something we are used to by now.

The point is that anyone who's going to be confused by the difference
between early and late binding behaviour is likely to be equally
confused by this.

The issue is really about when expressions are evaluated, not when
names are bound. Patching up just one part of it (binding of free
variables) doesn't really fix the problem.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg <at> cosc.canterbury.ac.nz	   +--------------------------------------+

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Greg Ewing | 3 May 05:27 2004
Picon
Picon

Re: Accessing base class C struct of subclass instance

Nick Bastin <nbastin <at> opnet.com>:

> If I define a new style class in C, and subclass it in python, how can 
> I get the base class instance object from a subclass instance in C?

What do you mean by "base class instance object"? That's
a meaningless combination of words to me.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg <at> cosc.canterbury.ac.nz	   +--------------------------------------+

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Greg Ewing | 3 May 05:41 2004
Picon
Picon

Re: Re: PEP 289 - Generator Expressions - Let's Move Forward

"Russell E. Owen" <rowen <at> cesmail.net>:

> Personally, I'd only like to see generator expressions added to Python 
> if they can allow list comprehensions to be deprecated -- to avoid 
> language clutter.

That's possible in the sense that a list comprehension
can be written as list(generator_expression).

But it will still be necessary to decide whether to
wrap a list() around it.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg <at> cosc.canterbury.ac.nz	   +--------------------------------------+

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org


Gmane