[Python-Dev] Re: C API for the bool type?

2005-03-23 Thread Terry Reedy

"Bo Thorsen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> If this is not the correct place to post this problem, I apologize. In
> that case, please be gentle and point me to a better mailing list.

The general Python mailing list (pyrhon-list ?) also at python.org.  Or 
comp.lang.python (the two are gated to each other).  Or 
gmane.comp.python.general.  Or google groups.



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] docstring before function declaration

2005-03-23 Thread Anthony Baxter
On Tuesday 22 March 2005 05:58, Nicholas Jacobson wrote:
> Oops, you're right.
>
> What I should have said is to use a blank docstring as
> follows:

It's still unclear to me what a file containing a single docstring
followed by a def() line means. And this ambiguity doesn't seem
to be solvable, so I'm a solid -1 on this change.

(In addition, I should note that I tried editing a moderate sized
file to put the docstrings before the defs - to my eyes, it made 
the file more cluttered and much less pleasing to the eye)

-- 
Anthony Baxter <[EMAIL PROTECTED]>
It's never too late to have a happy childhood.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] bdist_deb checkin comments

2005-03-23 Thread Sean Reifschneider
On Sat, Mar 19, 2005 at 06:20:44PM -0500, Kurt B. Kaiser wrote:
>Sean Reifschneider <[EMAIL PROTECTED]> writes:
>> Does anyone have any feedback on this before I do so? 
>
>I made a few comments on the Tracker.

Thanks a lot, they look great.  I'll try to get the submitter to follow up
on it.

Sean
-- 
 Sure I like country music, and I like violins.
 But right now I need a telecaster through a vibrolux turned up to ten.
Sean Reifschneider, Member of Technical Staff <[EMAIL PROTECTED]>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] docstring before function declaration

2005-03-23 Thread Nicholas Jacobson
Oops, you're right.

What I should have said is to use a blank docstring as
follows:

""
"""Function docstring."""
def foo:
...

or:

"""Module docstring."""
""
def foo:
...

--- Anthony Baxter <[EMAIL PROTECTED]> wrote:
> On Monday 21 March 2005 20:08, Nicholas Jacobson
> wrote:
> > > How do you distinguish between a docstring at
> the
> > > top of a module
> > > that's immediately followed by a  function? Is
> it
> > > the module docstring
> > > or the function docstring?
> >
> > It's both.  The docstring would be assigned to
> both
> > the module and the function.  This is a *good*
> thing
> > when there is a module with only one function in
> it.
> > i.e. there should only be one docstring for both,
> and
> > this saves repetition of that docstring.
> >
> > If a programmer wanted a docstring for the
> function
> > but not the module, a blank first line would do
> the
> > trick.  A docstring for the module but not the
> > function?  Put a blank line between the module's
> > docstring and the function.
> 
> Yuk. This is magic taken to a ridiculous level. Note
> that
> "blank lines" currently have no meaning in Python,
> and adding
> a meaning to them is not my idea of a good thing.
> 
> -- 
> Anthony Baxter <[EMAIL PROTECTED]>
> It's never too late to have a happy childhood.
> 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] C API for the bool type?

2005-03-23 Thread Bo Thorsen
Hi people,

If this is not the correct place to post this problem, I apologize. In 
that case, please be gentle and point me to a better mailing list.

I'm coding a text editor in Qt that uses Python for macros. The problem I 
have is that want to use the bool type introduced in 2.3, but I can't see 
how to do this. On http://docs.python.org/api/arg-parsing.html the format 
units are described, but no bool is there.

I guess there are two possibilities. Either the documentation is not 
updated with the new format unit, or it doesn't exist.

If it doesn't exist, I guess I should use the int format unit and call the 
http://docs.python.org/api/boolObjects.html functions to see if this is 
actually a bool or not?

I hope you can help me with this question. Please CC me with answers, 
since I am not a member of this list.

Thanks,

Bo Thorsen.

-- 

Thorsen Consulting ApS - Qt programming services
http://www.thorsen-consulting.dk
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: Re: Ye don't be needin' these!

2005-03-23 Thread Josiah Carlson

Tim Lesher <[EMAIL PROTECTED]> wrote:
> 
> On Wed, 23 Mar 2005 22:58:51 +0100, Florian Schulze
> <[EMAIL PROTECTED]> wrote:
> > BTW, Herman Toothrot is from Monkey Island.
> 
> Right.  That's what leads me to believe 1) it's not a serious post,
> and 2) it's from someone who's old enough to know better.

I thought the pirate talk plus scurvy reference was sufficient for that
(I didn't have the opportunity to play Monkey Island when I was a child).

 - Josiah

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Greg Ward
On 23 March 2005, Oleg Broytmann said:
>I'd like to remove all those redirects. Any opinion?

+0.5.  The beauty of Python is that it generally provides thin
wrappers: when writing a convenient wrapper, it's OK to expose the
underlying beast, warts and all.

(I had a minor epiphany about this recently when digging into
ossaudiodev again: turns out that certain ioctls are implemented subtly
differently in OSS and in ALSA's OSS emulation layer.  ossaudiodev, as
it turns out, faithfully mirrors this inconsistency to Python
programmers.  The inconsistency is not ossaudiodev's fault, so it's not
ossaudiodev's problem to fix it.  Python programmers should have access
to everything that C programmers have access to, only with less typing.
If that means they have to worry about Mozilla dumping lots of text to
stdout, or ALSA implementing certain ioctls differently than OSS, so be
it.)

(But, oh yeah: +1 to Fred's suggestion of making redirection
controllable.  Something like this: default should be no redirection,
programmer should be allowed to specify what to do with stdout/stderr of
GUI browsers.)

Greg
-- 
Greg Ward <[EMAIL PROTECTED]> http://www.gerg.ca/
If at first you don't succeed, give up--no use making a damn fool of yourself.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Fred L. Drake, Jr.
On Wednesday 23 March 2005 08:25, Rodrigo Dias Arruda Senra wrote:
 > Under some linux distros (I'm positive for some Mdk releases), Mozilla is
 > compiled dumping a lot of info to stdout/stderr. Since one of the goals of
 > webbrowser is to give the end-user a stress-free experience, there goes
 > the mentioned nullification .

This sounds familliar.  This was certainly true when Mozilla was young and I 
actually wrote the webbrowser module.  (Or was that, when Grail was young?  I 
don't even remember if there was a Mozilla for the first version!)

 > In a development environment, a developer should not find difficulty to
 > reverse that if needed.

Right.  I think if the API provides a control for this and some mention is 
made in the documentation, that would be good.


  -Fred

-- 
Fred L. Drake, Jr.  
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Fred L. Drake, Jr.
On Wednesday 23 March 2005 07:40, Oleg Broytmann wrote:
 >While I'm working on webbrowser... Why do all graphical browsers are
 > called with their stdout/stderr redirected to /dev/null? Do we really
 > need to hide problems from the user? Browsers are usually silent beasts
 > - they interact with the user using windows, not stdio.

I don't remember why I did that; feel free to remove it.  If it's actually 
useful, then 1) it should turn up before 2.5 final anyway, 2) we really want 
to know why, even if it just turns into a code comment, and 3) it should 
probably be controllable via the API, if its useful at all.


  -Fred

-- 
Fred L. Drake, Jr.  
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: Re: Ye don't be needin' these!

2005-03-23 Thread Tim Lesher
On Wed, 23 Mar 2005 22:58:51 +0100, Florian Schulze
<[EMAIL PROTECTED]> wrote:
> BTW, Herman Toothrot is from Monkey Island.

Right.  That's what leads me to believe 1) it's not a serious post,
and 2) it's from someone who's old enough to know better.
-- 
Tim Lesher <[EMAIL PROTECTED]>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: Re: Ye don't be needin' these!

2005-03-23 Thread Florian Schulze
On Wed, 23 Mar 2005 13:59:29 -0500, Tim Lesher <[EMAIL PROTECTED]> wrote:
On Wed, 23 Mar 2005 11:34:09 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote:
"Herman Toothrot" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Avast!  Why be there builtins divmod and pow, when operators **, /, 
and %
> should be good enough for ya?  It runs counter to TOOWTDI, I be 
thinking.

Questions like this should be asked on comp.lang.python or the python
mailing list.  I'll answer if I see it there.
I have to wonder if this wasn't a tongue-in-cheek message sent from a
just-created hotmail account, by an existing python-dev participant
who's embroiled in the current "do we even need functionals anymore"
discussion...
BTW, Herman Toothrot is from Monkey Island.
Regards,
Florian Schulze
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Shorthand for lambda

2005-03-23 Thread Josiah Carlson

Ka-Ping Yee <[EMAIL PROTECTED]> wrote:
> 
> On Wed, 23 Mar 2005, Josiah Carlson wrote:
> > Paul Moore <[EMAIL PROTECTED]> wrote:
> > > I thought about it, but couldn't convince myself that it would work
> > > properly in all cases. I was thinking in terms of operator overloading
> > > of everything possible - how did you do it?
> >
> > PyTables allows something very similar for "in-kernel" searches of data,
> > but only on a single constraint.  I would imagine that Ka-Ping did it by
> > only allowing a single operation per item.
> 
> You can do more than one operation, but the usage is still quite limited.
> The item placeholder must be the first operand for it to work.
> 
> >>> numbers = [3, 8, 4, 1, 2]
> >>> filter(_ < 5, numbers)
> [3, 4, 1, 2]
> >>> map(_ * 5 + 7, numbers)
> [10, 15, 11, 8, 9]

Your implementation "works" by not crashing, but that last map should
certainly return [22, 47, 27, 12, 17] rather than what it does.

It may be extensible to actually work the way I expect such operations
to work.

 - Josiah

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Delaney, Timothy C (Timothy)
Rodrigo Dias Arruda Senra wrote:

> However, there are two other issues:
> 1) If a *graphical* application  dumps messages to the console,
>that might be disruptive to other console applications.
>IMVHO, a log file should be used instead. (strong argument)

Perhaps instead webbrowser.py should redirect to a (preferably
specified) log file. The detail is then still available, but hidden from
normal usage.

Tim Delaney
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: webbrowser.py

2005-03-23 Thread Rodrigo Dias Arruda Senra
On Wed, 23 Mar 2005 21:29:30 +0300
Oleg Broytmann <[EMAIL PROTECTED]> wrote:

> Suggested resolutions:
> http://python.org/sf/754022
>Review and apply! ;)

Reviewed. 
Thank you Oleg, fine integration job.
I added a +1 comment to the tracker and copied
your remaining obs to 754022 history.
So a commiter-dev just have to mind about 754022.

>I also added elinks support - currently it is very similar to links,
> but I am going to extend its remote capabilities. (Yes, that small
> text-mode broswer supports remoting, windows and tabs! Who'd think?!.)
>Also I'm going to add "new-tab" support similar to "new-window" for
> Mozilla/Firefox and elinks.

Excellent.

cheers,
Rod Senra
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Reinhold Birkenfeld
Ka-Ping Yee wrote:
> On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote:
>> What does you implementation do for this:
>>
>> >>> somevar = False
>> >>> filter(_ and False, numbers)
> 
> It fails.  (For the same reason that __len__ doesn't work --
> Python insists that __nonzero__ must return an int.)  Though
> i must say i have no idea what you are trying to do here.
> If you filter on False, you'll always get an empty list.

I know; I just wanted to show that this approach can be very misleading
as and/or can't be overloaded.

Reinhold


-- 
Mail address is perfectly valid!

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: Ye don't be needin' these!

2005-03-23 Thread Tim Lesher
On Wed, 23 Mar 2005 11:34:09 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote:
> 
> "Herman Toothrot" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Avast!  Why be there builtins divmod and pow, when operators **, /, and %
> > should be good enough for ya?  It runs counter to TOOWTDI, I be thinking.
> 
> Questions like this should be asked on comp.lang.python or the python
> mailing list.  I'll answer if I see it there.

I have to wonder if this wasn't a tongue-in-cheek message sent from a
just-created hotmail account, by an existing python-dev participant
who's embroiled in the current "do we even need functionals anymore"
discussion...

-- 
Tim Lesher <[EMAIL PROTECTED]>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Bob Ippolito
On Mar 23, 2005, at 1:16 PM, Ka-Ping Yee wrote:
On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote:
What does you implementation do for this:
somevar = False
filter(_ and False, numbers)
It fails.  (For the same reason that __len__ doesn't work --
Python insists that __nonzero__ must return an int.)  Though
i must say i have no idea what you are trying to do here.
If you filter on False, you'll always get an empty list.
Similarly, appscript provides function versions of operators named such 
as AND and OR.  I suppose there could be a length one as well (in 
AppleScript terminology, it would be called count), or you could 
technically denote it as __len__(), but that's quite ugly.

I had implemented something quite similar to this a long time ago, but 
considered it "evil" and never used it for anything:

http://tinyurl.com/6ft4h
-bob
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: webbrowser.py

2005-03-23 Thread Oleg Broytmann
On Tue, Mar 22, 2005 at 01:28:42PM +0300, Oleg Broytmann wrote:
> On Sun, Mar 20, 2005 at 11:40:27AM -0300, [EMAIL PROTECTED] wrote:
> > Perhaps you could focus in 728278. It addresses some of the issues you
> > have addressed in 754022, but it is not properly formatted. If you could
> > merge into your patch the result of  "set(728278)-set(754022)", it would
> > be great.
> > 
> > These two patches have the biggest number of changes, and most significant
> > ones. Naturally they are also the most conflicting.
> > 
> > If these two are merged, then I believe *all* webbrowser.py related
> > patches could be addressed and closed quickly.
> 
>I am working on them. I am going to consolidate these patches along
> with 954628 and 1166780 into one big patch.

   Well, I've consolidated patches 728278, 954628, 1166780 into 754022.
Some parts of those patches were applied, some rejected, many things
changed.

   Suggested resolutions:

http://python.org/sf/728278
   Close with resolution "partially applied, partially rejected".

http://python.org/sf/754022
   Review and apply! ;)

http://python.org/sf/1166780
   Close with resolution "applied". (Though it was not applied in
exactly that form...)

http://python.org/sf/1077979
   Close with resolution "applied long ago".

http://python.org/sf/1144816
   Close with resolution "duplicate of 1077979".

   I tested the consolidated patch on Linux with Mozilla/links/elinks
browsers, and on w32 with default-browser and with Mozilla.

   I also added elinks support - currently it is very similar to links,
but I am going to extend its remote capabilities. (Yes, that small
text-mode broswer supports remoting, windows and tabs! Who'd think?!.)
   Also I'm going to add "new-tab" support similar to "new-window" for
Mozilla/Firefox and elinks.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Ka-Ping Yee
On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote:
> What does you implementation do for this:
>
> >>> somevar = False
> >>> filter(_ and False, numbers)

It fails.  (For the same reason that __len__ doesn't work --
Python insists that __nonzero__ must return an int.)  Though
i must say i have no idea what you are trying to do here.
If you filter on False, you'll always get an empty list.


-- ?!ng
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Reinhold Birkenfeld
Ka-Ping Yee wrote:

> It dawned on me that you could use this idea to make the whole
> filter/lambda experience vastly more pleasant.  I whipped up a quick
> implementation:
> 
> >>> from placeholder import _
> >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
> >>> filter(_ < 30, numbers)
> [5, 9, 1, 24]
> >>> map(_ + 10, numbers)
> [15, 19, 66, 44, 11, 34, 47, 99]
> >>>
> 
> Look ma, no lambdas!

What does you implementation do for this:

>>> somevar = False
>>> filter(_ and False, numbers)

Reinhold

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Shorthand for lambda

2005-03-23 Thread Ka-Ping Yee
On Wed, 23 Mar 2005, Josiah Carlson wrote:
> Paul Moore <[EMAIL PROTECTED]> wrote:
> > I thought about it, but couldn't convince myself that it would work
> > properly in all cases. I was thinking in terms of operator overloading
> > of everything possible - how did you do it?
>
> PyTables allows something very similar for "in-kernel" searches of data,
> but only on a single constraint.  I would imagine that Ka-Ping did it by
> only allowing a single operation per item.

You can do more than one operation, but the usage is still quite limited.
The item placeholder must be the first operand for it to work.

>>> numbers = [3, 8, 4, 1, 2]
>>> filter(_ < 5, numbers)
[3, 4, 1, 2]
>>> map(_ * 5 + 7, numbers)
[10, 15, 11, 8, 9]

I tried implementing __len__, but that doesn't work because Python
enforces a type restriction.

>>> words = 'lovely spam and eggs'.split()
>>> filter(len(_) == 4, words)
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: __len__() should return an int

__getitem__ and __getattr__ mostly work.  However, in order to call a
method on the placeholder you have to add an underscore to distinguish
it from retrieving an attribute.

>>> filter(_.endswith_('s'), words)
['eggs']

You can check out http://zesty.ca/python for the gory details.

As Jeremy wrote, the proper way to do map and filter is to use a
list comprehension, so these are bad examples.  The original
motivation was to provide a way to write lambda expressions for
cases where you aren't doing map or filter.  For that, it works,
but only in limited cases.

I realize this isn't that practical.  It's mainly for your
amusement -- yet another in a long tradition of hacks that use
operator overloading to hijack the Python parser.  (Also a long
tradition of me doing silly things in public.)


-- ?!ng
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Shorthand for lambda

2005-03-23 Thread Josiah Carlson

Paul Moore <[EMAIL PROTECTED]> wrote:
> 
> On Wed, 23 Mar 2005 10:33:53 -0600 (CST), Ka-Ping Yee
> <[EMAIL PROTECTED]> wrote:
> > It dawned on me that you could use this idea to make the whole
> > filter/lambda experience vastly more pleasant.  I whipped up a quick
> > implementation:
> > 
> > >>> from placeholder import _
> > >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
> > >>> filter(_ < 30, numbers)
> > [5, 9, 1, 24]
> > >>> map(_ + 10, numbers)
> > [15, 19, 66, 44, 11, 34, 47, 99]
> > >>>
> > 
> > Look ma, no lambdas!
> > 
> > I bet someone has already done this before, right?
> 
> I thought about it, but couldn't convince myself that it would work
> properly in all cases. I was thinking in terms of operator overloading
> of everything possible - how did you do it?


PyTables allows something very similar for "in-kernel" searches of data,
but only on a single constraint.  I would imagine that Ka-Ping did it by
only allowing a single operation per item.

 - Josiah

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: Ye don't be needin' these!

2005-03-23 Thread Terry Reedy

"Herman Toothrot" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Avast!  Why be there builtins divmod and pow, when operators **, /, and % 
> should be good enough for ya?  It runs counter to TOOWTDI, I be thinking.

Questions like this should be asked on comp.lang.python or the python 
mailing list.  I'll answer if I see it there.

Terry J. Reedy



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Shorthand for lambda

2005-03-23 Thread Paul Moore
On Wed, 23 Mar 2005 10:33:53 -0600 (CST), Ka-Ping Yee
<[EMAIL PROTECTED]> wrote:
> It dawned on me that you could use this idea to make the whole
> filter/lambda experience vastly more pleasant.  I whipped up a quick
> implementation:
> 
> >>> from placeholder import _
> >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
> >>> filter(_ < 30, numbers)
> [5, 9, 1, 24]
> >>> map(_ + 10, numbers)
> [15, 19, 66, 44, 11, 34, 47, 99]
> >>>
> 
> Look ma, no lambdas!
> 
> I bet someone has already done this before, right?

I thought about it, but couldn't convince myself that it would work
properly in all cases. I was thinking in terms of operator overloading
of everything possible - how did you do it?

Paul.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Shorthand for lambda

2005-03-23 Thread Jeremy Hylton
For filter and map, list comprehensions and generator expressions are
the answer.

>>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
>>> [x for x in numbers if x < 30]
[5, 9, 1, 24]
>>> (x for x in numbers if x < 30)

>>> list(_)
[5, 9, 1, 24]

Jeremy

On Wed, 23 Mar 2005 10:33:53 -0600 (CST), Ka-Ping Yee
<[EMAIL PROTECTED]> wrote:
> Hey folks,
> 
> I'm sitting over here in the AppleScript talk and Jacob is explaining a
> module called 'appscript' that interfaces to the Apple Events system.
> 
> What caught my eye was this example:
> 
> from appscript import *
> ab = app('Address Book')
> people = ab.people.filter(its.emails != [])
> 
> That last line asks the Address Book to select only entries with
> e-mail addresses.  The weird 'its' object comes from the appscript
> module -- asking for its properties and using operators causes it
> to set up thunks for you.
> 
> It dawned on me that you could use this idea to make the whole
> filter/lambda experience vastly more pleasant.  I whipped up a quick
> implementation:
> 
> >>> from placeholder import _
> >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
> >>> filter(_ < 30, numbers)
> [5, 9, 1, 24]
> >>> map(_ + 10, numbers)
> [15, 19, 66, 44, 11, 34, 47, 99]
> >>>
> 
> Look ma, no lambdas!
> 
> I bet someone has already done this before, right?
> 
> -- ?!ng
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/jeremy%40alum.mit.edu
>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Shorthand for lambda

2005-03-23 Thread Ka-Ping Yee
Hey folks,

I'm sitting over here in the AppleScript talk and Jacob is explaining a
module called 'appscript' that interfaces to the Apple Events system.

What caught my eye was this example:

from appscript import *
ab = app('Address Book')
people = ab.people.filter(its.emails != [])

That last line asks the Address Book to select only entries with
e-mail addresses.  The weird 'its' object comes from the appscript
module -- asking for its properties and using operators causes it
to set up thunks for you.

It dawned on me that you could use this idea to make the whole
filter/lambda experience vastly more pleasant.  I whipped up a quick
implementation:

>>> from placeholder import _
>>> numbers = [5, 9, 56, 34, 1, 24, 37, 89]
>>> filter(_ < 30, numbers)
[5, 9, 1, 24]
>>> map(_ + 10, numbers)
[15, 19, 66, 44, 11, 34, 47, 99]
>>>

Look ma, no lambdas!

I bet someone has already done this before, right?


-- ?!ng
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: Ye don't be needin' these!

2005-03-23 Thread Robert Kern
Herman Toothrot wrote:
Avast!  Why be there builtins divmod and pow, when operators **, /, and 
% should be good enough for ya?  It runs counter to TOOWTDI, I be 
thinking.  Arr.
Well, divmod(x, y) does both / and % in one shot, which can be very 
useful. pow(x, y[, z]) has an optional third argument ((x**y) % z), 
which is necessary for really large numbers like the ones you play with 
in cryptography.

--
Robert Kern
[EMAIL PROTECTED]
"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Ye don't be needin' these!

2005-03-23 Thread Aahz
On Wed, Mar 23, 2005, Herman Toothrot wrote:
>
> Avast!  Why be there builtins divmod and pow, when operators **, /, and % 
> should be good enough for ya?  It runs counter to TOOWTDI, I be thinking.  
> Arr.

This is off-topic for python-dev.  Please post to comp.lang.python
instead.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Oleg Broytmann
Oops...

> PS. This, of course, should must be fixed - pydoc must use webbrowser.py!
   ^^ delete (-:

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Oleg Broytmann
On Wed, Mar 23, 2005 at 11:59:24AM -0300, Rodrigo Dias Arruda Senra wrote:
> Has this same issue been dealt in another stdlib module ?

pydoc.py:
   rc = os.system('netscape -remote "openURL(%s)" &' % url)
   if rc: os.system('netscape "%s" &' % url)

PS. This, of course, should must be fixed - pydoc must use webbrowser.py!

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Ye don't be needin' these!

2005-03-23 Thread Herman Toothrot
Avast!  Why be there builtins divmod and pow, when operators **, /, and % 
should be good enough for ya?  It runs counter to TOOWTDI, I be thinking.  
Arr.

H. Toothrot
_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Rodrigo Dias Arruda Senra
[Rod Senra]:
> > Under some linux distros (I'm positive for some Mdk releases), Mozilla is
> > compiled dumping a lot of info to stdout/stderr. Since one of the goals of
> > webbrowser is to give the end-user a stress-free experience, there goes the
> > mentioned nullification .

[Oleg Broytmann]:
> 
> I see the point. Still I don't know what is worse and more stressful
> to hide errors or to show errors.
> MandrakeZilla spits too much to stdout/err? That's certainly a
> problem. Should we "fix" it and hide from the user? I don't think so.

That is undoubtly a good argument. In general, if the end user could fix
or report a problem based on a stdout/stderror message, I couln't agree more
on keeping them flowing.

However, there are two other issues:
1) If a *graphical* application  dumps messages to the console,
   that might be disruptive to other console applications. 
   IMVHO, a log file should be used instead. (strong argument)

2) If a dummy user sees a warning or info message in stdout/stdin
   that is not necessarily critical, it might interpret it wrongly
   as a error message and generate a false bug report. (weak argument)

In the case of webbrowser.py, since detection process might face a
diverse plethora of browsers (even unknown if defined by environment variables),
we cannot predict if 1) or 2) will ever happen. 
Therefore, my -1 vote in my previous reply. But I do see your point .

Has this same issue been dealt in another stdlib module ?

best regards,
Rod Senra
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Oleg Broytmann
On Wed, Mar 23, 2005 at 10:25:12AM -0300, Rodrigo Dias Arruda Senra wrote:
> > Why do all graphical browsers are called with their stdout/stderr 
> > redirected 
> > to /dev/null? 
> 
> Under some linux distros (I'm positive for some Mdk releases), Mozilla is
> compiled dumping a lot of info to stdout/stderr. Since one of the goals of
> webbrowser is to give the end-user a stress-free experience, there goes the
> mentioned nullification .

   I see the point. Still I don't know what is worse and more stressful
- to hide errors or to show errors.
   MandrakeZilla spits too much to stdout/err? That's certainly a
problem. Should we "fix" it and hide from the user? I don't think so.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Rodrigo Dias Arruda Senra
On Wed, 23 Mar 2005 15:40:20 +0300
Oleg Broytmann <[EMAIL PROTECTED]> wrote:

> Hello!
> 
>While I'm working on webbrowser...

Great.

> Why do all graphical browsers are called with their stdout/stderr redirected 
> to /dev/null? 

Under some linux distros (I'm positive for some Mdk releases), Mozilla is
compiled dumping a lot of info to stdout/stderr. Since one of the goals of
webbrowser is to give the end-user a stress-free experience, there goes the
mentioned nullification .

In a development environment, a developer should not find difficulty to reverse
that if needed.


>I'd like to remove all those redirects. Any opinion?
-1 for me.

best regards,
Rod Senra

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


python-dev@python.org

2005-03-23 Thread Oleg Broytmann
Hello!

   While I'm working on webbrowser... Why do all graphical browsers are
called with their stdout/stderr redirected to /dev/null? Do we really
need to hide problems from the user? Browsers are usually silent beasts
- they interact with the user using windows, not stdio.
   (Text-mode browsers, naturally, use stdout... for their windows).

   I'd like to remove all those redirects. Any opinion?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] bug in pythondotnet implementation. Maybe related to a bug in cpython implementation...help!!!!

2005-03-23 Thread Paul Moore
On Wed, 23 Mar 2005 12:13:56 +0100, Stan Pinte <[EMAIL PROTECTED]> wrote:
> I would welcome any help regarding:
> 
> -how can I get/give more info on what's happening?
> -how to solve that stuff?
> 
> thanks a lot in advance.
> 
> here is the problem:
> 
> I have a python (actually pythondotnet) process freezing on windows,
> like that:

Hi,
This is off-topic for python-dev, which is for discussion of the
development OF Python, not for discussion of programs written IN
Python. For this problem, I'd suggest that you ask either on
comp.lang.python, or probably more appropriately on one of the
python.NET lists (I know there are some, but I'm afraid I can't recall
the details).

Thanks,
Paul.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] bug in pythondotnet implementation. Maybe related to a bug in cpython implementation...help!!!!

2005-03-23 Thread Stan Pinte
hello,

I would welcome any help regarding:

-how can I get/give more info on what's happening?
-how to solve that stuff?

thanks a lot in advance.

here is the problem:

I have a python (actually pythondotnet) process freezing on windows,
like that:

Thread Start Address:
>Symbol Name:   Line Number:PC:
>mscoree!_CorExeMain() + 0x0--- 7917D08C
>
>Thread Stack:
>
>ntdll ! KiFastSystemCallRet() + 0x
>KERNEL32 ! WaitForSingleObject() + 0x12
>python24 ! PySys_WriteStderr() + 0x14d
>python24 ! PyTuple_Type() + 0x0

How can I know who's calling PyTuple_Type()???


see below for full description of my problem.

 am running Simpy (python simulation framework) within pythondotnet,
and, even though this process is single-thread, it hangs misteriously,
in an unpredictable way...

Python console cease to respond to Ctrl-C events...

Here is the current Thread status:

Thread Start Address:
Symbol Name:Line Number:PC:
mscoree!_CorExeMain() + 0x0 --- 7917D08C

Thread Stack:

ntdll ! KiFastSystemCallRet() + 0x
KERNEL32 ! WaitForSingleObject() + 0x12
python24 ! PySys_WriteStderr() + 0x14d
python24 ! PyTuple_Type() + 0x0

as the entry point in the hanging thread (higher on stack) is
PyTuple_Type() and as PyTuple is defined in C# (src/runtime/PyTuple.cs),
I suspect this might be the cause of my problem.

[PythonNet-1.0-beta4]> grep -nr "PyTuple_Type" .
Binary file ./DLLs/_socket.pyd matches
Binary file ./python24.dll matches
[PythonNet-1.0-beta4]>

However, I would like to be able to go higher in the stack, to see what
caused this deadlock.

Any proposed strategy to guess what happened, or to track down the problem?

thanks a lot,

Stan.




___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] New PyPI broken package editing

2005-03-23 Thread Walter Dörwald
[EMAIL PROTECTED] wrote:
Zitat von Walter Dörwald <[EMAIL PROTECTED]>:
I've uploaded a new package to the new PyPI. Editing this
new packages gives me a unicode error. The URL is
http://www.python.org/pypi?:action=submit_form&name=ll-ansistyle&version=0.6.1
I see that the package is online now, so I assume that
it now worked?
OK, I've deleted the files and the packages. Running "setup.py register"
with author=u"Walter Dörwald" in setup.py gives me:
---
running register
Using PyPI login from /home/walter/.pypirc
Server response (500): Internal Server Error
---
Using author=u"Walter Dörwald".encode("utf-8") in setup.py works.
I'm not sure if this is the right approach. The encoding I specify in 
setup.py should be independent of the encoding used between distutils 
and PyPI to communicate on the wire. I.e. the author (and maintainer) 
argument should always be unicode. When str is passed, this is treated 
as any other str in a unicode context, it is decoded using the default 
encoding. This would fix another problem: It would make it nearly 
impossible to send a request to PyPI with the wrong encoding, because 
any encoding problems are sorted out completely on the client side.

[...]
As for the uploads: you'll have noticed that it put the
sdist files into packages/2.5; this is not supposed to
happen. If you delete the files, and reupload them with
the current CVS, the files should go into /packages/source.
OK, I've re-uploaded the packages.
BTW, uploading the packages a second time leads to the following problem:
---
running upload
Submitting dist/ll-ansistyle-0.6.1.tar.bz2 to http://www.python.org/pypi
Upload failed (500): There's been a problem with your request
Submitting dist/ll-ansistyle-0.6.1.tar.gz to http://www.python.org/pypi
Upload failed (500): There's been a problem with your request
---
Is there a way to display the HTTP response by PyPI?
Editing the package is still broken. The link "edit" on the page 
http://www.python.org/pypi/ll-ansistyle/0.6.1 gives:
---
Error...

There's been a problem with your request
exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in 
position 92: ordinal not in range(128)
---

Bye,
   Walter Dörwald
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com