Re: [Python-Dev] Removing IDLE from the standard library

2010-07-10 Thread Guilherme Polo
2010/7/10 Miki Tebeka :
> Hello Tal,
>
>> I would like to propose removing IDLE from the standard library.
> -1.
> One of the biggest "selling points" for me when switching to python was the
> "out of the box" working IDE with REPL, syntax highliting and a debugger.
> The only other candidate I think of to replace IDLE might be IPython. However
> for novice users who are not used to command line it might be too 
> intimidating.
>
> There are my others IDEs out there, some better some worse. However IMO
> to have one bundled with Python is highly important.
>
>> Cross-platform support has degraded with the increasing popularity of OSX 
>> and 64-bit
>> platforms.
> I use IDLE on Ubuntu 64bit and before that on OS X 64 bit, never had a
> problem. Can you give
> some examples on what do you mean by "cross-platform support"?
>

By "never had a problem" do you mean using some of the latest versions
? Here, running "idle" from a mac terminal and trying to type: print
"hi" crashes when entering the quotation mark. I'm mostly sure this
has been fixed on versions newer than 2.6.1 (but I hope you agree with
me that shouldn't happen with a version distributed on macosx), so my
another example is in the form of a question: how functional is the
current IDLE debugger when running on a Mac ?

-- 
-- Guilherme H. Polo Goncalves
___
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] [Idle-dev] Removing IDLE from the standard library

2010-07-11 Thread Guilherme Polo
2010/7/11 "Martin v. Löwis" :
>> In the 2009 Google Summer of Code I was the mentor for a Brazilian
>> student, Guilherme Polo, who completed and extended important
>> improvements to IDLE made during the previous year by David Scherer.
>> Given the somewhat official nature of this work, I assumed that these
>> needed improvements would make it into the standard distribution, but as
>> far as I know that hasn't happened. It would seem that if even this
>> "sponsored" project didn't impact the standard Python distribution,
>> something is broken in the procedures, and probably what is needed is,
>> as Guido says, that someone be given the authority to get improvements
>> to IDLE into the standard distribution. Making a significant change to
>> the update procedures is clearly needed.
>
> I don't think so; instead, the perception of authority needs to be
> adjusted (in the specific case). Guilherme could have committed these
> changes, but, for whatever reason, decided not to. Nor did his direct
> mentor (i.e. you) tell him to commit the changes, and neither did I.
>
>> Even if this needed change is made, there is also merit to Tai's
>> suggestion of creating a separate project, to encourage developers like
>> him to work together to improve IDLE, without having as a first priority
>> to worry about getting it into the standard distribution, but with the
>> clear understanding that this is the place to go for improvements to
>> migrate into the standard distribution.
>
> Again, Guilherme could commit his changes any time.
>
> Regards,
> Martin

I think Martin has always supported me in some way and I really
appreciate that. But, maybe because I won commit privileges solely
based on GSoC work, I felt other developers wouldn't approve my
commits without previous discussion and that is the major reason for
not committing most of my patches.

-- 
-- Guilherme H. Polo Goncalves
___
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] Removing IDLE from the standard library

2010-07-14 Thread Guilherme Polo
2010/7/14 Terry Reedy :
> On 7/14/2010 2:35 AM, Giampaolo Rodolà wrote:
>>
>> One of the main problems with IDLE is the lack of tabs for editing
>> multiple files within the same window.
>> Having that alone would be a great improvement.
>
> Yes, the same as tabs for browsing was.
>
> This is firstly an unlying gui widget set issue. Tk does not, as far as I
> know, have a tabbed document widget. Ttk has a new Notebook widget, with
> tabs.
>

I have worked on this before, and I can tell you that simply changing
to ttk widgets is the easiest part. My recommendation, that you are
free to ignore (especially if you want to skip this previous work),
is: as a first step change the EditWindow to act more like a EditPage.
That is, you should be able to instantiate a EditWindow and include
this new EditPage on it (as a child or something else that you may
imagine).

> --
> Terry Jan Reedy
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Removing IDLE from the standard library

2010-07-14 Thread Guilherme Polo
2010/7/14 Greg Ewing :
> Giampaolo Rodolà wrote:
>>
>> One of the main problems with IDLE is the lack of tabs for editing
>> multiple files within the same window.
>
> While tabs seem to work well for web browsing, I'm not so
> sure about using them for source editing. Often I want to
> display two or more files side by side, which can't be
> done if they're in different tabs of the same window.
>

Adding tabs doesn't necessarily mean a single window, you should be
able to continue using multiple windows with single tabs if that is
your preference.

> --
> Greg


-- 
-- Guilherme H. Polo Goncalves
___
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] Is it intentional that "sys.__debug__ = 1" is illegal in Python 2.7?

2010-07-30 Thread Guilherme Polo
2010/7/30 Barry Warsaw :
> On Jul 30, 2010, at 01:42 PM, Guido van Rossum wrote:
>
>>Well it is a reserved name so those packages that were setting it
>>should have known that they were using undefined behavior that could
>>change at any time.
>
> Shouldn't it be described here then?
>
> http://docs.python.org/reference/lexical_analysis.html#identifiers
>

Doesn't the section
http://docs.python.org/reference/lexical_analysis.html#reserved-classes-of-identifiers
make this clear enough ?

> -Barry
>
> ___
> 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/ggpolo%40gmail.com
>
>



-- 
-- Guilherme H. Polo Goncalves
___
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] draft 3.1 release schedule

2009-03-05 Thread Guilherme Polo
On Thu, Mar 5, 2009 at 10:53 AM, Brad Miller  wrote:
>
>
> On Mon, Mar 2, 2009 at 4:22 PM, "Martin v. Löwis" 
> wrote:
>>
>> > Would whoever is responsible for IDLE please take a look at the patches
>> > I submitted for Python 2 & 3 [tracker IDs 5233 and 5234 respectively].
>> > These change the behavior of IDLE so that IDLESTARTUP or PYTHONSTARTUP
>> > files are executed with each restart. This allows loading frequently
>> > used packages, personal utilities, etc. automatically at each restart. I
>> > consider this a very important problem in IDLE, especially when using it
>> > to teach.
>>
>> Just to put this into perspective: I personally don't see that as a very
>> important problem. I didn't know IDLESTARTUP existed, and I use
>> PYTHONSTARTUP only for the command line (to setup readline and history).
>> I think there are many more open issues that are *way* more important.
>
> Martin,
>   No disrespect intended but I don't see how this puts things into
> perspective.  I'm writing to you from the annual computer science education
> conference (SIGCSE)  where Python is clearly gaining ground as an important
> language for teaching computer science.
> It seems logical to me that the committers are high powered Python users who
> don't think much about Python being used in education.  I'm just as
> frustrated as Mitchell about a patch for displaying ranges and
> dict_keys/values objects in a more user friendly way.  I submitted this
> patch during the 3.0 alpha phase and it is still sitting around.  For me
> this is a serious problem, but I can understand how it seems pretty minor to
> others, who are not teaching new programmers.
> So what is the solution?  The obvious solution is for one of us, that is
> someone who uses Python as an education tool, to become a committer.  This
> seems problematic to me.  Although I'm willing to be a committer, and I'm
> confident I have the development skills necessary to be a committer I don't
> have the time to develop the resume of patches needed to earn that
> privilege.
> It would be nice if we could find some solution to this.

Or... IDLE could be taken out from Python. Tkinter is following the
same path too, sadly.
My hope is that by removing IDLE from Python it would bring new
developers that are not necessary python developers (by this I mean
developers of python itself). I changed IDLE quite a bit last year,
but I'm not sure if anyone cared enough to look at it (added tabs, ttk
support, themes, window relayout, and some other things), and I don't
think continuing with it in the stdlib is bringing any benefits.

I have commit access, and although I have been inactive for two or
three weeks (maybe a bit more) now, I have submitted plenty of fixes
for tkinter which are mostly reviewed by Martin, and only, Martin --
when he has time to review or when the fix hits some level of
"important enough" to be looked at. I could just commit these fixes,
but some people would hate me then because I didn't let anyone review,
so I don't really think adding more new committers will bring the
benefits you are expecting.

A different problem also present in both tkinter and IDLE is the lack of tests.

> Brad
>>
>>
>> This is not to say that the patch should not applied - I haven't even
>> looked at it. It's just a warning that, if no other committer feels this
>> is as important as you fell it is, it may not be committed reviewed and
>> committed before 3.1.
>>
>> Regards,
>> Martin
>> ___
>> 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/bmiller%40luther.edu
>
>
>
> --
> Brad Miller
> Assistant Professor, Computer Science
> Luther College
>
> ___
> 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/ggpolo%40gmail.com
>
>



-- 
-- Guilherme H. Polo Goncalves
___
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] [Python-ideas] Adding a test discovery into Python

2009-03-11 Thread Guilherme Polo
On Wed, Mar 11, 2009 at 7:37 PM, Raymond Hettinger  wrote:
> [Christian Heimes]

 I'm +1 for a simple (!) test discovery system. I'm emphasizing on simple
 because there are enough frameworks for elaborate unit testing.
>
> Test discovery is not the interesting part of the problem.

Interesting or not, it is a problem that is asking for a solution,
this kind of code is being duplicated in several places for no good
reason.

>
> Axiom:  The more work involved in writing tests, the fewer
> tests that will get written.

At some point you will have to run them too, I don't think you want to
reimplement the discovery part yet another time.


-- 
-- Guilherme H. Polo Goncalves
___
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] Core projects for Summer of Code

2009-03-18 Thread Guilherme Polo
On Wed, Mar 18, 2009 at 7:23 PM, Daniel Fetchinson
 wrote:
>> Hey guys/gals
>>
>> Summer of Code is ramping up.  Every year the common complaint is that not
>> enough Python core projects get proposed by students, and of course a big
>> reason for that is often the only encouragement we offer prospective
>> students is a link to the PEP index.
>>
>> So let's make this year different.
>>
>> Accepted students are paid a total of $4500 to work for roughly 30 hours a
>> week, 12 weeks, on their proposed project.
>>
>> The challenge is finding project ideas for them that could reasonably occupy
>> them for the entire Summer and which the results of their work can be
>> demonstrated.  They're being paid for specific projects so "Spend the Summer
>> fixing bugs on the tracker" is a no-go, and Google has outlined that Summer
>> of Code is about code, not documentation.
>>
>> I've seen and heard that a lot of work is still needed on
>> http://svn.python.org/view/python/trunk both during the 3.1 release cycle,
>> optimization possible all over the place.  It'd be great if those of you
>> working closely with this can shout out some ideas, brainstorm a bit.
>>
>> PSF was announced as one of the mentoring orgs today, this week before
>> student applications are open is for students to talk to their prospective
>> mentors and iron out the wrinkles in their plans, so there's not much time
>> to get core project ideas together.
>
> How about porting PIL to 3.0?
> There were many such requests on python-list and image-sig (including mine :))
>

I have ported it to the stage where its tests passes (which are far
from covering all the code) and some of my own tests, there is a git
repo on the image-sig that points to it. I wasn't really careful with
some of the things (and I would even consider redoing some of them),
but only one or two people got a copy of it so apparently people don't
want/need it on python 3.0 just yet (not it alone at least).

> Cheers,
> Daniel
>
>
> --
> Psss, psss, put it down! - http://www.cafepress.com/putitdown
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Core projects for Summer of Code

2009-03-18 Thread Guilherme Polo
On Wed, Mar 18, 2009 at 9:44 PM, Daniel Fetchinson
 wrote:
 Summer of Code is ramping up.  Every year the common complaint is that
 not
 enough Python core projects get proposed by students, and of course a big
 reason for that is often the only encouragement we offer prospective
 students is a link to the PEP index.

 So let's make this year different.

 Accepted students are paid a total of $4500 to work for roughly 30 hours
 a
 week, 12 weeks, on their proposed project.

 The challenge is finding project ideas for them that could reasonably
 occupy
 them for the entire Summer and which the results of their work can be
 demonstrated.  They're being paid for specific projects so "Spend the
 Summer
 fixing bugs on the tracker" is a no-go, and Google has outlined that
 Summer
 of Code is about code, not documentation.

 I've seen and heard that a lot of work is still needed on
 http://svn.python.org/view/python/trunk both during the 3.1 release
 cycle,
 optimization possible all over the place.  It'd be great if those of you
 working closely with this can shout out some ideas, brainstorm a bit.

 PSF was announced as one of the mentoring orgs today, this week before
 student applications are open is for students to talk to their
 prospective
 mentors and iron out the wrinkles in their plans, so there's not much
 time
 to get core project ideas together.
>>>
>>> How about porting PIL to 3.0?
>>> There were many such requests on python-list and image-sig (including mine
>>> :))
>>>
>>
>> I have ported it to the stage where its tests passes (which are far
>> from covering all the code) and some of my own tests, there is a git
>> repo on the image-sig that points to it. I wasn't really careful with
>> some of the things (and I would even consider redoing some of them),
>> but only one or two people got a copy of it so apparently people don't
>> want/need it on python 3.0 just yet (not it alone at least).
>
> I did a "git clone git://gpolo.ath.cx/pil-py3k.git" but it failed:
>
> gpolo.ath.cx[0: 189.7.18.241]: errno=Connection timed out
> fatal: unable to connect a socket (Connection timed out)
> fetch-pack from 'git://gpolo.ath.cx/pil-py3k.git' failed.
>

Thanks for noticing that, maybe more people had this same problem
then, I will consider using github or some similar service (or maybe
take the chance to bazaar, or mercurial, or svn, or..).

> By the way the reason I think few people checked it out is that people
> mostly are waiting for an "official" PIL release that is known to be
> stable. Did you try making your port part of the "official" PIL
> distribution?
>

I have talked with Fredrik, he said he would be running it on another
test suite to check how much of it really works. But, no, I didn't
really try pushing it to be integrated into the next PIL release and
it also wouldn't be possible without distributing a py3k version only
-- I didn't do the port with the ability to work in python 3.x and
python 2.x but this can be arranged.

> Cheers,
> Daniel
>
>
> --
> Psss, psss, put it down! - http://www.cafepress.com/putitdown

Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] Non-Core project: IDLE

2009-03-23 Thread Guilherme Polo
On Wed, Mar 18, 2009 at 8:53 PM, Terry Reedy  wrote:
> IDLE needs lots of attention -- more than any one experienced person is
> likely to have
>

I'm willing to step up as a student for this but I still have to write
a good proposal for it.
My actual concern is about mentor availability, is someone around
interested on being an IDLE mentor ?

Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC: Core Python development tools

2009-03-23 Thread Guilherme Polo
On Mon, Mar 23, 2009 at 5:03 PM, Antoine Pitrou  wrote:
>
> Hi,
>
> Daniel (ajax) Diniz  gmail.com> writes:
>>
>> But the real point is that, regardless of underlying VCS, there is a
>> choice between "having all core developers know by heart the right
>> switches and order of steps to correctly checkout/update ->( branch
>> locally) -> fix -> diff -> commit -> merge -> solve conflicts" and
>> "offering a little, well-documented script that takes care of the
>> switches and sequence of steps".
>
> Well, it seems to me that most of these steps are separated by manual
> intervention (e.g. compile and run the test suite to check that everything 
> works
> smoothly), so there's no real point in making a script out of them.
>
> The real issues with svnmerge are its occasional bugs or failures (it forgot
> some changesets when merging in the io-c branch!),

Any chance you were not using the latest svnmerge when you did that
merge ? I've had problems like this when using older versions.

> its slowness, and its
> limitations (which are really inherent to the SVN model: e.g., if someone
> commits to the branch you have just started doing an svnmerge to, you have to
> revert everything and start over with the latest updates).
>
> Regards
>
> Antoine.
>
>
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Non-Core project: IDLE

2009-03-23 Thread Guilherme Polo
On Mon, Mar 23, 2009 at 5:39 PM, Terry Reedy  wrote:
> Guilherme Polo wrote:
>>
>> On Wed, Mar 18, 2009 at 8:53 PM, Terry Reedy  wrote:
>>>
>>> IDLE needs lots of attention -- more than any one experienced person is
>>> likely to have
>>>
>>
>> I'm willing to step up as a student for this but I still have to write
>> a good proposal for it.
>> My actual concern is about mentor availability, is someone around
>> interested on being an IDLE mentor ?
>
> If I could, I would, and would have said so.  But I have only read about tk
> and have not actually used it.  If I did decide to dive into it, you'd be
> mentoring me ;-).  What I can and would do is give ideas for changes, read
> and comment on a proposal, and user test patched versions.
>

That is very nice Terry. Do you have some specific ideas that you want
to share publicly (or in private) about IDLE ? Your expectations about
what should be addressed first, or areas that should be improved.. you
know, anything.

The proposal I'm planning will include IDLE but it will also include
some Tkinter, since it depends on it and bugs on the later can affect
the former as you know. I was planning to first target the lack of
tests of both IDLE and Tkinter, I believe that by adding tests (and
doing it nicely) may change how future changes are applied (I'm
thinking about having them getting new tests for new features, fixes,
etc as it happens for other areas in Python) and will make easier to
maintain them. My other target is to check the open tickets in the bug
tracker regarding IDLE and Tkinter too, I have been much more active
on the later so the former will take some more time to test/think/make
a decision.

I will be able to test these changes under Linux and on plain Windows
XP, Vista and the 7 but differences between different system
configurations may also affect IDLE, so any help you can provide will
be very much appreciated. Hopefully someone with a mac will be able to
provide some help here too.

> Terry
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Non-Core project: IDLE

2009-03-24 Thread Guilherme Polo
On Mon, Mar 23, 2009 at 7:52 PM, Scott David Daniels
 wrote:
> Guilherme Polo wrote:
>>
>> On Wed, Mar 18, 2009 at 8:53 PM, Terry Reedy  wrote:
>>>
>>> IDLE needs lots of attention -- more than any one experienced person is
>>> likely to have
>>
>> I'm willing to step up as a student for this but I still have to write
>> a good proposal for it.
>> My actual concern is about mentor availability, is someone around
>> interested on being an IDLE mentor ?
>
> You might want to talk to Bruce Sherwood, as VPython suffered through
> a bunch of Idle problems.  I got the impression he had a person or two
> who were his Idle experts (so I am thinking they might be the mentors
> you are looking for).  In any case, even a charter of "unit tests to 50%
> coverage" of Idle would be a huge improvement.
>

Thanks for the direction Scott. I have talked with Bruce yesterday and
now again, he included a list of issues that is considered important
to be fixed but unfortunately several of them are related to mac only
and I won't be able to properly address them.

He also pointed me to the person that worked on some issues regarding
IDLE and VPython, waiting now to hear if he is interested on gsoc.

> I've run after specific bugs in Idle, but don't really know the lay of
> the land.
>
>
> --Scott David Daniels
> scott.dani...@acm.org

Thanks,


-- 
-- Guilherme H. Polo Goncalves
___
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] Non-Core project: IDLE

2009-03-24 Thread Guilherme Polo
On Tue, Mar 24, 2009 at 4:26 AM, Mark Summerfield  wrote:
> On 2009-03-23, Guilherme Polo wrote:
>> On Mon, Mar 23, 2009 at 5:39 PM, Terry Reedy  wrote:
>> > Guilherme Polo wrote:
>> >> On Wed, Mar 18, 2009 at 8:53 PM, Terry Reedy  wrote:
>> >>> IDLE needs lots of attention -- more than any one experienced person is
>> >>> likely to have
>> >>
>> >> I'm willing to step up as a student for this but I still have to write
>> >> a good proposal for it.
>> >> My actual concern is about mentor availability, is someone around
>> >> interested on being an IDLE mentor ?
>> >
>> > If I could, I would, and would have said so.  But I have only read about
>> > tk and have not actually used it.  If I did decide to dive into it, you'd
>> > be mentoring me ;-).  What I can and would do is give ideas for changes,
>> > read and comment on a proposal, and user test patched versions.
>>
>> That is very nice Terry. Do you have some specific ideas that you want
>> to share publicly (or in private) about IDLE ? Your expectations about
>> what should be addressed first, or areas that should be improved.. you
>> know, anything.
>
> I have one suggestion that I think might be widely appreciated:
>
> Add somewhere in the configuration dialog when users can enter a block
> of Python code to be executed at startup and whenever Restart Shell is
> executed.
>
> Use case: for people who use IDLE for calculations/experiments they
> might like to always have certain module imported. For me personally, it
> would be:
>
>    import os
>    import re
>    import sys
>    from math import *
>
> but of course the whole point is that people can write any code they
> like. (Some people might want to do various from __future__ imports in
> Python 2.6 to get various Python 3 features for example.)
>
> I know that you can use the -c option, but that only works at startup,
> not every time you Restart Shell.
>

Looks like a good suggestion to me, Mark.
I would recommend adding it as a feature request on the typical place
(bugs.python.org) because although I could just go and do it, I
believe you are aware that new features in IDLE are subject to
approval or disapproval by other members involved with IDLE. Hope you
understand my position.

> [snip]
>
> --
> Mark Summerfield, Qtrac Ltd, www.qtrac.eu
>    C++, Python, Qt, PyQt - training and consultancy
>        "Rapid GUI Programming with Python and Qt" - ISBN 0132354187
>
>

Regards,


-- 
-- Guilherme H. Polo Goncalves
___
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] http://bugs.python.org/issue2240

2009-04-07 Thread Guilherme Polo
On Tue, Apr 7, 2009 at 11:54 PM, Tennessee Leeuwenburg
 wrote:
> This issue has been largely resolved, but there is an outstanding bug where
> the (reviewed and committed) solution does not work on certain versions of
> FreeBSD (broken in 6.3, working in 7+). Do we have a list of 'supported
> platforms', and is FreeBSD 6.3 in it?
>
> What's the policy with regards to supporting dependencies like this? Should
> I set this issue to 'pending' seeing as no-one is currently working on a
> patch for this? Or is leaving this open and hanging around exactly the right
> thing to do?
>

I would find more appropriate to close this as fixed because the issue
was about adding setitimer and getitimer wrappers and that is done.

We could then create another issue regarding this bug in specific
versions of freebsd towards this setitimer/getitimer wrapper. That is
what makes more sense to me.

> Cheers,
> -T
>
>
>
> --
> --
> Tennessee Leeuwenburg
> http://myownhat.blogspot.com/
> "Don't believe everything you think"
>

Regards,


-- 
-- Guilherme H. Polo Goncalves
___
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] Google Summer of Code/core Python projects - RFC

2009-04-10 Thread Guilherme Polo
On Fri, Apr 10, 2009 at 5:38 PM, C. Titus Brown  wrote:
> Hi all,
>
> this year we have 10-12 GSoC applications that I've put in the "relevant
> to core Python development" category.  These projects, if mentors etc
> are found, are *guaranteed* a slot under the PSF GSoC umbrella.  As
> backup GSoC admin and general busybody, I've taken on the work of
> coordinating these as a special subgroup within the PSF GSoC, and I
> thought it would be good to mention them to python-dev.
>
> Note that all of them have been run by a few different committers,
> including Martin, Tarek, Benjamin, and Brett, and they've been obliging
> enough to triage a few of them.  Thanks, guys!
>
> Here's what's left after that triage.
> .
> .
>
> IDLE/Tkinter patch integration & improvement -- deal with ~120 tracker
>        issues relating to IDLE and Tkinter.
>

Is it important, for the discussion, to mention that it also involves
testing this area (idle and tkinter), Titus ? I'm considering this
more important than "just" dealing with the tracker issues.

> --titus
> --
> C. Titus Brown, c...@msu.edu

Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] Google Summer of Code/core Python projects - RFC

2009-04-10 Thread Guilherme Polo
On Fri, Apr 10, 2009 at 6:02 PM, C. Titus Brown  wrote:
> On Fri, Apr 10, 2009 at 05:53:23PM -0300, Guilherme Polo wrote:
> -> >
> -> > IDLE/Tkinter patch integration & improvement -- deal with ~120 tracker
> -> > ? ? ? ?issues relating to IDLE and Tkinter.
> -> >
> ->
> -> Is it important, for the discussion, to mention that it also involves
> -> testing this area (idle and tkinter), Titus ? I'm considering this
> -> more important than "just" dealing with the tracker issues.
>
> What, I tell you that your app is going to be accepted and we shouldn't
> argue about it, and you want to argue about it? ;)
>

Oh awesome then :) I think I misread part of your original email.

> --titus
> --
> C. Titus Brown, c...@msu.edu
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Tkinter: modify xview of entry widget

2009-08-14 Thread Guilherme Polo
2009/8/14 paolo.fr...@libero.it :
> Hi,
> I'm Paolo from Italy and I'm a python user.
> I wish to propose a useful and smart method modify in Tkinter Library:
>
> Previously to scroll this widget we had to write an external function  
> (recalling xview_moveto and xview_scroll).
>
> With my method this operation is cleared and the same as all other widgets  
> (just have to call xview).
>
> I wish that this implementation could be integrated in Tkinter, and I remain 
> at disposal for any question or further information.
>
> Waiting for your response,

I believe you are trying to mention the fact that the Entry.xview
method doesn't allow being called without passing an index, even if
this index is None. Is that the case ?

Take a look on http://bugs.python.org/issue1135 and
http://bugs.python.org/issue6180, they already address this fix.

> Best regards
> Paolo Fraguglia

Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] Auto-Assignment

2008-03-07 Thread Guilherme Polo
2008/3/7, Thomas Heller <[EMAIL PROTECTED]>:
> Martin v. Löwis schrieb:
>
> > Thomas Heller wrote:
>  >> Martin v. Löwis schrieb:
>  >>> I just implemented auto-assignment for the tracker, i.e. a component
>  >>> can be linked to a developer so that issues mentioning the component
>  >>> get assigned to that developer (unless an explicit assignment is
>  >>> made).
>  >>>
>  >>
>  >> You can autoassign ctypes issues to me, as you might have guessed.
>  >
>  > ctypes is currently not a "component" in the tracker. Should it be
>  > one?
>  >
>
> Hm, I didn't see that.
>
>  What is a components, and do you think it should be one?
>
>
>  Thomas
>

Hi Thomas,

When you create a new issue, you have to select a component from a
list, those are the available components.

-- 
-- Guilherme H. Polo Goncalves
___
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] How best to handle test_errno?

2008-03-13 Thread Guilherme Polo
2008/3/13, Brett Cannon <[EMAIL PROTECTED]>:
> I am going through my backlog of GHOP work and noticed that test_errno
>  is essentially a no-op at the moment. I was wondering if anyone knew
>  if there are any guaranteed values for the errno module? If not, the
>  test current says that Linux has all the values; is that really true?
>
>  -Brett

Half-answering your email..

ENOTOBACCO is missing here, Linux.

-- 
-- Guilherme H. Polo Goncalves
___
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] Dates wrong on front page of pydotorg

2008-04-04 Thread Guilherme Polo
2008/4/4, Martin Thomas <[EMAIL PROTECTED]>:
> Did anyone else notice that the dates are incorrect in the news items
>  on the front page? As an example:
>  Published: Mon, 4 Apr 2008
>  which should be
>  Published: Fri, 4 Apr 2008
>
>  I'll poke around and see if I can figure it out.
>

There is a file (newsindex.yml) which contains the news items. The
publication date is hand written so it is just a typo from whoever
commited that news item with that publication date.

I just fixed it (as you pointed out). Thanks ;)

Anyway, did you send this to the wrong list or was it intentional ?

Regards,

>  Cheers //M
>
>
>
>  ___
>  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/ggpolo%40gmail.com
>


-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC Student Introduction

2008-04-23 Thread Guilherme Polo
2008/4/23, "Martin v. Löwis" <[EMAIL PROTECTED]>:
> > See http://python.org/dev/bazaar/ for info. And if you have any other
>  > issues feel free to ask, Nick.
>
>
> I certainly can't speak for the respective mentors, but I feel that
>  "use bazaar" really isn't the right answer to "can I get commit access?"
>
>  One motivation for GSoC is also community bonding, and having the
>  mentor (but not *only* the mentor) comment on the proposed changes,
>  and monitor the progress of the project. That the development branch
>  sits on the student's laptop doesn't really help in that process.
>
>  Instead, the student would have to push the branch somewhere to
>  a web-visible location. Now I question whether it's the student's
>  obligation to find a server himself, or whether the mentoring org
>  should provide the infrastructure (or, failing that, Google (*)).
>
>  So I think an answer to the question above involving bazaar might
>  be "yes, but please don't commit to subversion, but only to the
>  bazaar repository".

Hi Martin,

What is the point on having a branch in the svn repo if you won't be
able to commit ? Maybe I misunderstood what you said, so maybe could
you clarify that answer ?

>
>  Regards,
>  Martin
>
>  (*) FWIW, Google does provide the infrastructure; students are
>  encouraged (required?) to commit their work to code.google.com.

It is required to submit the "final and complete" work done during
GSoC to a project under code.google.com. That project will be
automatically created after gsoc ends. But yeh, we could create
another project there to use as a repo for the summer.

And thank you, James Tauber, effbot and everyone else that accepted me
as a student this year too. I guess I should create a new thread to
introduce myself and my project =)

Thanks,

>
> ___
>  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/ggpolo%40gmail.com
>


-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC Student Introduction

2008-04-23 Thread Guilherme Polo
2008/4/23 "Martin v. Löwis" <[EMAIL PROTECTED]>:
> > What is the point on having a branch in the svn repo if you won't be
>  > able to commit ? Maybe I misunderstood what you said, so maybe could
>  > you clarify that answer ?
>
>  What I meant is this: you need commit privileges regardless of whether
>  you are going to use bazaar or subversion (i.e. even for bazaar, you
>  still need commit privileges). So if mentors favor usage of bazaar
>  over subversion, they still need to arrange their students to get
>  commit privileges, and then ask them not to use these privileges for
>  subversion, but only for bazaar (because we only have a single set
>  of credentials that we manage).

I see, thanks for clearing it up.

But, what about giving students a branch in the svn and instructing
them to commit only there ? (Chris mentioned this two emails ago). If
for some reason svn is not the way to go, then I'm happy in using
bazaar for commits anyway.
Also, are you (PSF) planning to do this now or just at the "official"
gsoc start ? And, is there some internal discussion going on to decide
if students are going to get a branch or something at python
repositories ?

>
>  HTH,
>  Martin
>



-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC Student Introduction, again

2008-05-07 Thread Guilherme Polo
Hi,

I have been accepted as a student for GSoC and I'm already working in
my project, "Bringing Ttk to Tkinter". This is my second GSoC, first
time in PSF, and it has been awesome to have Fredrik Lundh as mentor,
we have talked a lot and he is a very nice person.

Regarding the project, I expect it to be integrated into Python's
stdlib sometime in the future, I believe it will be in very good shape
before binaries compiled against tcl/tk 8.5 start showing up.

I've put a site that contains all the information available, which may
be of interest, at http://gpolo.ath.cx:81/projects/ttk_to_tkinter/ and
will be updating it as necessary. There is also a repo you may take a
look: http://svn.python.org/view/sandbox/trunk/ttk-gsoc/

Thank you all,

-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC Student Introduction, again

2008-05-08 Thread Guilherme Polo
2008/5/8 "Martin v. Löwis" <[EMAIL PROTECTED]>:
>> Regarding the project, I expect it to be integrated into Python's
>> stdlib sometime in the future, I believe it will be in very good shape
>> before binaries compiled against tcl/tk 8.5 start showing up.
>
> Actually, I would like to release Python 2.6 and 3.0 on Windows with Tk
> 8.5 included, preferably starting at the next betas. Would you see a
> problem with that?
>

I've already wrapped all the Ttk functionality by now, and I will
complete the documentation till the first betas.
But as you know there isn't much people using (I know myself and a Tcl
guy) so I'm not sure if it would be acceptable to include this module
right into these betas, or would it be ? Should I start doing
something more/else ?

> Regards,
> Martin
>
>

Thanks,

-- 
-- Guilherme H. Polo Goncalves
___
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] GSoC Student Introduction, again

2008-05-10 Thread Guilherme Polo
2008/5/10 "Martin v. Löwis" <[EMAIL PROTECTED]>:
>> I've already wrapped all the Ttk functionality by now, and I will
>> complete the documentation till the first betas.
>> But as you know there isn't much people using (I know myself and a Tcl
>> guy) so I'm not sure if it would be acceptable to include this module
>> right into these betas, or would it be ? Should I start doing
>> something more/else ?
>
> No. My question really was whether you see any reason not to bundle
> Tk 8.5 with Python 2.6 (on Windows).

No reasons that I'm aware of, Martin.
I haven't tested it under Windows myself but given that it is not
supposed to break tk 8.4 apps and I haven't experienced bugs here in
Linux, I would say it is a safe bet to start bundling Tk 8.5 within
the first betas.

> Whether or not the Ttk API is
> exposed is a different matter - you might consider providing it
> as a distutils package.
>
> Regards,
> Martin
>

Thanks,

-- 
-- Guilherme H. Polo Goncalves
___
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] How to help out with PEP 3108

2008-05-11 Thread Guilherme Polo
2008/5/11 Brett Cannon <[EMAIL PROTECTED]>:
> I have tried to update PEP 3108
> (http://www.python.org/dev/peps/pep-3108/) as best as I can to list
> what needs to be done for each module in order to get it removed if
> there is some extra step. The ones without comment most likely need no
> special work and thus I can take care of really quickly myself (have
> it down to instinct at this point). But anything with special needs I
> would appreciate the help in dealing with. I have also tried to make
> the steps necessary to deal with the various modules as clear as
> possible in the PEP itself.
>
> Although I created issue 2775 to track stuff, it is probably wiser to
> create individual issues for the modules that require any form of work
> to deal with. Just make sure that if you do that you make it a
> dependency in issue 2775 (and if you can, list it in the PEP).
>
> I would like to not have to hold up the betas just because of this
> PEP, but I don't know if I can finish the PEP completely on my own. So
> help is appreciated. Thanks to anyone who can help (or who already
> have)!
>
> -Brett

Hi Brett,

I've sent a patch regarding the move of Tkinter to the tkinter
package. But I'm in doubt about stub modules for this case, I'm not
sure if using lib-old is good for Tkinter specifically, since lib-tk
is included in sys.path.
How should I proceed on this ?

-- 
-- Guilherme H. Polo Goncalves
___
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] lib2to3, need some light on the imports fixer

2008-05-12 Thread Guilherme Polo
Hello,

Would someone tell me how can I add a new entry in the MAPPING dict in
the lib2to3/fixes/fix_imports.py that does the following:

"import A" gets fixed as "import C.D as A"

Right now it is fixing by doing "import C.D" and changing several
other lines in the code to use this new "C.D" name. I wanted to avoid
these changes if possible.


Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] heads up on svn.python.org ssh keys - debian/ubuntu users may need new ones

2008-05-13 Thread Guilherme Polo
2008/5/13 Gregory P. Smith <[EMAIL PROTECTED]>:
> Heads up.
>
> Debian screwed up.  As a result all ssh and ssl keys generated in the
> last 18 months on debian and ubuntu systems may be compromised due to
> not using a good random number generator seed.
> http://lists.debian.org/debian-security-announce/2008/msg00152.html
> and  http://www.links.org/?p=327
>
> If you generated your python subversion ssh key during this time on a
> machine fitting the description above, please consider replacing your
> keys.
>
> apt-get update ; apt-get upgrade on debian will provide you with a
> ssh-vulnkey program that can be used to test if your ssh keys are
> valid or not.
>

Thanks for pointing it out Gregory.

ssh-vulnkey says most of my keys are compromised, including the one
used for python's svn.

> -gps
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] lib2to3, need some light on the imports fixer

2008-05-16 Thread Guilherme Polo
2008/5/12 Collin Winter <[EMAIL PROTECTED]>:
> On Mon, May 12, 2008 at 1:58 PM, Guilherme Polo <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>>  Would someone tell me how can I add a new entry in the MAPPING dict in
>>  the lib2to3/fixes/fix_imports.py that does the following:
>>
>>  "import A" gets fixed as "import C.D as A"
>>
>>  Right now it is fixing by doing "import C.D" and changing several
>>  other lines in the code to use this new "C.D" name. I wanted to avoid
>>  these changes if possible.
>
> I don't believe there's a way to do that, but adding support for it
> should be fairly straight-forward. Assign the patch to me for review.
>

Is there something I could read get some 2to3 understanding ? How do I
construct patterns ?

> Collin Winter
>



-- 
-- Guilherme H. Polo Goncalves
___
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] lib2to3, need some light on the imports fixer

2008-05-16 Thread Guilherme Polo
2008/5/16 Collin Winter <[EMAIL PROTECTED]>:
> On Fri, May 16, 2008 at 10:30 AM, Guilherme Polo <[EMAIL PROTECTED]> wrote:
>> 2008/5/12 Collin Winter <[EMAIL PROTECTED]>:
>>> On Mon, May 12, 2008 at 1:58 PM, Guilherme Polo <[EMAIL PROTECTED]> wrote:
>>>> Hello,
>>>>
>>>>  Would someone tell me how can I add a new entry in the MAPPING dict in
>>>>  the lib2to3/fixes/fix_imports.py that does the following:
>>>>
>>>>  "import A" gets fixed as "import C.D as A"
>>>>
>>>>  Right now it is fixing by doing "import C.D" and changing several
>>>>  other lines in the code to use this new "C.D" name. I wanted to avoid
>>>>  these changes if possible.
>>>
>>> I don't believe there's a way to do that, but adding support for it
>>> should be fairly straight-forward. Assign the patch to me for review.
>>>
>>
>> Is there something I could read get some 2to3 understanding ?
>
> The README is a very shallow overview, but it needs to be beefed up to
> talk about architecture. Honestly, the best way (currently) is to read
> the existing fixers. Mea culpa.
>
>> How do I construct patterns ?
>
> find_pattern.py is the tool I wrote/use to find patterns. You give it
> some Python code and it spits out the pattern for it. It's hard to
> hand-construct patterns due to some optimizations done to eliminate
> unneeded nodes (nodes with only a single child are eliminated, pulling
> the child to its grandparent).
>

I see find_pattern.py is only at
http://svn.python.org/projects/sandbox/trunk/2to3.
Now I remember I saw it some time ago, but was trying to find it at
python's repo and couldn't find it =)

Thanks Collin.

-- 
-- Guilherme H. Polo Goncalves
___
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] Possible problem that may be caused by Tkinter renaming

2008-05-17 Thread Guilherme Polo
Hello,

I smell a problem caused by this line at tkinter/__init__.py:

tkinter = _tkinter # b/w compat for export

This was fine when tkinter was a Tkinter module, but I believe it
would be better to rename this to something else.
Given that python has a lot of users, I'm sure you will be able to
find all sort of crazy things over the internet and one of them could
be:

import tkinter
from tkinter import *

something = tkinter._default_root

Which is not that crazy at all, for some values of crazy, but will fail now.


Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] Possible problem that may be caused by Tkinter renaming

2008-05-17 Thread Guilherme Polo
2008/5/17 Guilherme Polo <[EMAIL PROTECTED]>:
> Hello,
>
> I smell a problem caused by this line at tkinter/__init__.py:
>
> tkinter = _tkinter # b/w compat for export

Georg and me decided to remove that line as a solution to this problem.

>
> This was fine when tkinter was a Tkinter module, but I believe it
> would be better to rename this to something else.
> Given that python has a lot of users, I'm sure you will be able to
> find all sort of crazy things over the internet and one of them could
> be:
>
> import tkinter
> from tkinter import *
>
> something = tkinter._default_root
>
> Which is not that crazy at all, for some values of crazy, but will fail now.
>
>
> Regards,
>
> --
> -- Guilherme H. Polo Goncalves
>



-- 
-- Guilherme H. Polo Goncalves
___
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] [Python-3000] Please svnmerge your changes

2008-05-25 Thread Guilherme Polo
2008/5/25 Christian Heimes <[EMAIL PROTECTED]>:
> Hello fellow developers!
>
> I've been busy with personal work in the past weeks. At present I'm
> still moving into my new apartment. It has been a real challenge to
> install an IKEA kitchen in a house built before WW2 all by myself. On
> the one hand it's fun but on the other hand it costs me most of my free
> time at night. At least this building has a shelter in its cellar so I'm
> mostly protected in the case of an air strike. *g*
>
> In order to get all code merged before the first betas I need your help.
> Please everybody grab a couple of your checkins and merge them yourself.
>
> You can find the list of required merges at http://rafb.net/p/cghbTk63.html
>

I see there is one commit of mine that shouldn't be merged, maybe you
could remove it from there ?

> Christian

Thanks,

-- 
-- Guilherme H. Polo Goncalves
___
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] Modules for 2.6 inclusion

2008-06-06 Thread Guilherme Polo
2008/6/6 Georg Brandl <[EMAIL PROTECTED]>:
> Hi,
>
> PEP 361 lists the following modules for possible inclusion in 2.6 (next
> to pyprocessing, which is now accepted):
>
> - winerror
>  http://python.org/sf/1505257
>  (Owner: MAL)
>
> This patch has been marked as rejected, so I'll remove the entry from
> the PEP.
>
> - setuptools
>  BDFL pronouncement for inclusion in 2.5:
>  http://mail.python.org/pipermail/python-dev/2006-April/063964.html
>
>  PJE's withdrawal from 2.5 for inclusion in 2.6:
>  http://mail.python.org/pipermail/python-dev/2006-April/064145.html
>
> I guess this will be deferred?
>
> - ast
>  http://mail.python.org/pipermail/python-dev/2008-April/078950.html
>
> If there's no objection, I'll go over the interface with Thomas, who's
> working on AST optimization for 2.7, to make sure the ast interface can
> stay the same after his branch is merged, write the docs and commit it
> before beta1.
>
> - bdist_deb in distutils package
>  http://mail.python.org/pipermail/python-dev/2006-February/060926.html
>
> - bdist_egg in distutils package
>
> - pure python pgen module
>  (Owner: Guido)
>  Deferral to 2.6:
>  http://mail.python.org/pipermail/python-dev/2006-April/064528.html
>

I created an issue 1 week ago (http://bugs.python.org/issue2983)
suggesting the addition of the ttk module to lib-tk, and to the new
tkinter package. Is there any chance to this be accepted for Python
2.6 ?

>
> There are also several other "possible" todo items in PEP 361, but they
> all look as if they are not required to be in before beta1.
>
> Georg
>
> --
> Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
> Four shall be the number of spaces thou shalt indent, and the number of thy
> indenting shall be four. Eight shalt thou not indent, nor either indent thou
> two, excepting that thou then proceed to four. Tabs are right out.
>
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Modules for 2.6 inclusion

2008-06-06 Thread Guilherme Polo
2008/6/6 "Martin v. Löwis" <[EMAIL PROTECTED]>:
>> I created an issue 1 week ago (http://bugs.python.org/issue2983)
>> suggesting the addition of the ttk module to lib-tk, and to the new
>> tkinter package. Is there any chance to this be accepted for Python
>> 2.6 ?
>
> Is it complete? In principle, it's for the mentor to decide (who
> would need to decide before the first beta, of course - afterwards
> it's for the release manager to decide).
>

It is complete Martin. But I will wait for Fredrik's decision then,
not sure if it will be soon enough tho.

> Regards,
> Martin
>



-- 
-- Guilherme H. Polo Goncalves
___
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] on Python's tests (and making them better)

2008-06-06 Thread Guilherme Polo
2008/6/6 Ron Adam <[EMAIL PROTECTED]>:
>
>
> Martin v. Löwis wrote:
>>>
>>> How does 1 directory scale when one day you have possibly thousands of
>>> tests?
>>
>> I find this a theoretical question. It took 18 years to arrive at 500
>> test files. Assuming a linear growth, we get 1000 tests in 2025, and
>> 2000 tests in 2060. People can worry about reorganizing them then.
>
>
> Personally I'd like to see packages have their own test directory.  This
> keeps things related to each other together.  Top level modules of course
> would have their tests in the top level test directory as they are now.
>

I really dislike having a test directory inside a python package. You
have my -1 on that idea.

> I don't see any need to subdivide tests further than that.
>
>
>
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Python FAQ: Why doesn't Python have a "with" statement?

2008-06-14 Thread Guilherme Polo
On Sat, Jun 14, 2008 at 5:05 PM, Cesare Di Mauro <[EMAIL PROTECTED]> wrote:
> In data 14 giugno 2008 alle ore 21:33:40, Georg Brandl <[EMAIL PROTECTED]> ha 
> scritto:
>
>> So what is the advantage to
>>
>> b = Button(self)
>> b.text = "QUIT"
>> b.fg = "red"
>> b.command = self.quit
>>
>> ?
>>
>> Georg
>
> In this example there are many assignaments, so there aren't many advantages.
>
> But this
>
>t = ScrolledText.ScrolledText(master, width=60, height=37)
>t.insert(Tkinter.END, self.log.getText())
>t.configure(state=Tkinter.DISABLED)
>t.see(Tkinter.END)
>t.pack(fill=Tkinter.BOTH)
>
> can look like:
>
>  on Tkinter:
>on ScrolledText.ScrolledText(master, width=60, height=37):
>  insert(END, self.log.getText())
>  configure(state=DISABLED)
>  see(END)
>  pack(fill=BOTH)
>

Then you have to start guessing from where these names came from.

> Cesare Di Mauro
>
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] setitimer, getitimer wrapper (issue2240)

2008-06-24 Thread Guilherme Polo
Hello,

It has been some time since some discussion happened on
http://bugs.python.org/issue2240, and I intended to compose this email
several days ago but just did it now.

This is an attempt to find someone who might have some
information/idea that could help solving the current problem regarding
the setitimer/getitimer wrapper under FreeBSD (and maybe somewhere
else?). The current problem is that the virtual and prof itimers, in
some occasions, may never finish, and as I remember from talking with
Trent Nelson, the problem showed up when running all the tests but not
when running the test_signal alone.

So, that is it.. any solutions ? :)

Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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] datetime.date.today() raises "AttributeError: time"

2008-11-16 Thread Guilherme Polo
On Sun, Nov 16, 2008 at 11:55 AM, Tal Einat <[EMAIL PROTECTED]> wrote:
> Steve Holden wrote:
>> Tal Einat wrote:
>>> It this desired behavior?
>>>
>>> At the very least the exception should be more detailed, perhaps to
>>> the point of suggesting the probable cause of the error (i.e.
>>> overriding the time module).
>>>
>> How is this different from any other case where you import a module with
>> a standard library name conflict, thereby confusing modules loaded later
>> standard library. Should we do the same for any error induced in such a way?
>
> The difference is that here the exception is generated directly in the
> C code so you don't get an intelligible traceback. The C code for
> datetime imports the time module via the Python C API.
>
> In other words, here a function from a module in the stdlib, datetime,
> barfs unexpectedly because I happen to have a file name time.py
> hanging around in some directory. There is no traceback and no
> intelligible exception message, just "AttributeError: time". I had to
> dig through datetime's C code to figure out which module was being
> imported via the Python C API, which turned out to be time.

Just like Steve told you, this isn't different from other cases. But,
at least you get a message a bit more verbose in most cases, like:

Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute 'time'

Then I went to look why this wasn't happening with datetime too, and I
found out that PyObject_CallMethod in abstract.c re sets the exception
message that would have been set by PyObject_GetAttr by now. Maybe
someone can tell me why it is doing that, for now a patch is attached
here (I didn't resist to not remove two trailing whitespaces).

>
>  This is rare enough that I've never had something like this happen to
> me in seven years of heavy Python programming.
>
> - Tal
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
Index: Objects/abstract.c
===
--- Objects/abstract.c	(revision 67226)
+++ Objects/abstract.c	(working copy)
@@ -2575,13 +2575,11 @@
 		return null_error();
 
 	func = PyObject_GetAttrString(o, name);
-	if (func == NULL) {
-		PyErr_SetString(PyExc_AttributeError, name);
-		return 0;
-	}
+	if (func == NULL)
+		return NULL;
 
 	if (!PyCallable_Check(func)) {
-		type_error("attribute of type '%.200s' is not callable", func); 
+		type_error("attribute of type '%.200s' is not callable", func);
 		goto exit;
 	}
 
@@ -2614,13 +2612,11 @@
 		return null_error();
 
 	func = PyObject_GetAttrString(o, name);
-	if (func == NULL) {
-		PyErr_SetString(PyExc_AttributeError, name);
-		return 0;
-	}
+	if (func == NULL)
+		return NULL;
 
 	if (!PyCallable_Check(func)) {
-		type_error("attribute of type '%.200s' is not callable", func); 
+		type_error("attribute of type '%.200s' is not callable", func);
 		goto exit;
 	}
 
___
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] mlockall() in Python?

2008-11-23 Thread Guilherme Polo
On Sun, Nov 23, 2008 at 10:44 PM, Evgeni Golov <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'd like to write a small daemon in Python, which should never be
> swapped out (on Linux, this daemon will be Linux specific, so no need
> in a platform-independent solution).
>
> In C I'd do:
> #include 
> mlockall(MCL_FUTURE);
> //do stuff here
> munlockall();
>
> Is there anything similar in Python?
>

Python doesn't wrap those function itself, but maybe some extension
modules does (or you could wrap it a second:
http://pastebin.com/m3286272c http://pastebin.com/m33ca908d)

Also, this list is for development *of* Python, not development *with*
Python (one of the most used messages this month).

> TIA & kind regards
> Evgeni Golov
>
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] building Tcl/Tk to deploy on other platforms?

2008-11-26 Thread Guilherme Polo
On Wed, Nov 26, 2008 at 8:42 PM, chris <[EMAIL PROTECTED]> wrote:
> I built Python 2.5.2 on RedHat3 and wrapped it up with some other
> stuff that was deployed on RedHat4. When trying to fire up Idle on
> RedHat4, there is an error that states a usable init.tcl cannot be
> found.
>

Then you have to set the TCL_LIBRARY environment variable, it should
point to the directory that contains the correct init.tcl file.
If it then complains about not finding tk.tcl, then you have to set
the TK_LIBRARY env var too.

> Python is built on RedHat3 against Tcl/Tk 8.3, so even installing
> Tcl/Tk on RedHat4 would not work, as it is 8.4.
>
> I've noticed when Python is installed on Windows, all the necessary
> stuff is also installed in the Python25 directory. Is there a similar
> way to do this on linux?
>

Adjust the TCL_LIBRARY and TK_LIBRARY as needed.

> Thanks,
> -Chris
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] building Tcl/Tk to deploy on other platforms?

2008-11-26 Thread Guilherme Polo
On Wed, Nov 26, 2008 at 9:51 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
>> Adjust the TCL_LIBRARY and TK_LIBRARY as needed.
>
> We should also point out that the FixTk module already does
> that, but is imported only on Windows. So if you arrange to
> always import FixTk, then it should Just Work.
>

It would Just Work if you had python and tcl/tk installed with the
same paths as the ones used by the windows installer.

> Regards,
> Martin
>


-- 
-- Guilherme H. Polo Goncalves
___
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] Attribute error: providing type name

2008-11-30 Thread Guilherme Polo
On Sun, Nov 30, 2008 at 4:41 PM, Filip Gruszczyński <[EMAIL PROTECTED]> wrote:
> This is my first message in this list, therefore I would like to say
> hello to everyone. I also hope, that I am not breaking any rules or
> guidelines for sending proposals.
>
> I would like to ask, if it is possible to provide type name of the
> object invoking the exception, when Attribute error is catched. It is
> done for functions, like:
>
> AttributeError: 'function' object has no attribute 'getValue'
>
> but for some objects there is only:
>
> AttributeError: connectToBases

I would say this is due to Py_FindMethod being used.
It is a nice and easy function to use, but it fails to set a good
error message so maybe you are experiencing these error messages from
modules that are using it.

I have added a patch in http://bugs.python.org/issue4475

>
> This is cool, when you know exactly what type of object cast the
> exception. But if there might be many of them, you must do one of two
> things: add print statement just before the line with the exception
> and check the type or iterate over all classes that might appear them.
> Showing the class name would solve this problem and could save a lot
> of time.
>
> --
> Filip Gruszczyński
> ___
> 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/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
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] Py3k: magical dir()

2008-12-19 Thread Guilherme Polo
On Fri, Dec 19, 2008 at 12:20 PM, Dmitry Vasiliev  wrote:
> Hello!
>
> I think it's a strange behavior:
>
> Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 hash(range(10))
> Traceback (most recent call last):
>  File "", line 1, in 
> TypeError: unhashable type: 'range'
 dir(range(10))
> ['__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__',
> '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__',
> '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__',
> '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__',
> '__sizeof__', '__str__', '__subclasshook__']
 hash(range(10))
> -1211318616
 hash(range(1000))
> -1211318472
>

There are other ways to reproduce it without using dir, like
range(10).__class__; hash(range(10))

Is there some reason no set tp_hash for rangeobject to
PyObject_HashNotImplemented ?

> --
> Dmitry Vasiliev (dima at hlabs.spb.ru)
>  http://hlabs.spb.ru



-- 
-- Guilherme H. Polo Goncalves
___
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] [capi-sig] Exceptions with additional instance variables

2008-12-22 Thread Guilherme Polo
On Mon, Dec 22, 2008 at 10:06 AM,   wrote:
> On Mon, Dec 22, 2008 at 03:29, Guilherme Polo  wrote:
>> On Sun, Dec 21, 2008 at 11:02 PM,   wrote:
>>> Hello,
>>>
>>> I'm trying to implement custom exception that have to carry some
>>> useful info by means of instance members, to be used like:
>>>
>>> try:
>>>// some code
>>> except MyException, data:
>>>// use data.errorcode, data.errorcategory, data.errorlevel,
>>> data.errormessage and some others
>>>
>>> The question is - how to implement the instance variables with
>>> PyErr_NewException?
>>
>> Using PyErr_NewException is fine. You must understand that an
>> exception is a class, and thus PyErr_NewException creates one for you
>> and returns it.
>> Just like you would do with a class that has __dict__, set some
>> attributes to what you want. That is, use PyObject_SetAttrString or
>> something more appropriated for you.
>
> Ok so I did the following. In init function (forget refcounting and
> error checking for a moment ;-)
>
> PyObject *dict = PyDict_New();
> PyDict_SetItemString(dict, "errorcode", PyInt_FromLong(0));
> static PyObject *myexception =
> PyErr_NewException("module.MyException", NULL, dict);

You do not really have to create a dict here, one will be created for
you if you pass a NULL there.

> PyModule_AddObject(module, "MyException", myexception);
>
> It worked more or less as expected, the help shown:
>
>  |  --
>  |  Data and other attributes defined here:
>  |
>  |  errorcode = 0
>  |
>  |  --
>
> Then I did the following when raising the exception:
>
> PyObject_SetAttrString(myexception, "errorcode", PyInt_FromLong(111));
> PyErr_SetString(myexception, "Bad thing happened");
> return NULL;
>
> and the test code was:
> try:
>do_bad_thing();
> except MyException, data:
>
> and you surely already guessed it -- data.errorcode was 0 Not only
> that, module.MyException.errorcode was also 0...
>
> What I'm doing wrong? I certainly don't get the idea of exceptions in
> Python, especially what is being raised - a class or an instance?

There are two forms raise can take, both will end up involving a class
and a intsance.

> If
> the latter - how's the class instantiated?

You can call a class to instantiate it.

> If not - what about values
> in different threads? The docs are so vague about that...
>
>
> Thanks again in advance,
> Chojrak
>

Again, an exception is a class, so you could create a new type in C,
and do anything you wanted. But you probably don't want to create a
new type to achieve this, so there are two simple ways I'm going to
paste below:

#include "Python.h"

static PyObject *MyErr;

static PyMethodDef module_methods[] = {
{"raise_test", (PyCFunction)raise_test, METH_NOARGS, NULL},
{NULL},
};

PyMODINIT_FUNC
initfancy_exc(void)
{
PyObject *m;

m = Py_InitModule("fancy_exc", module_methods);
if (m == NULL)
return;

MyErr = PyErr_NewException("fancy_exc.err", NULL, NULL);

Py_INCREF(MyErr);
if (PyModule_AddObject(m, "err", MyErr) < 0)
return;
}

the raise_test function is missing, pick one of these:

static PyObject *
raise_test(PyObject *self)
{
PyObject_SetAttrString(MyErr, "code", PyInt_FromLong(42));
PyObject_SetAttrString(MyErr, "category", PyString_FromString("nice 
one"));
PyErr_SetString(MyErr, "All is good, I hope");
return NULL;
}

or

static PyObject *
raise_test(PyObject *self)
{

PyObject *t = PyTuple_New(3);
PyTuple_SetItem(t, 0, PyString_FromString("error message"));
PyTuple_SetItem(t, 1, PyInt_FromLong(10));
PyTuple_SetItem(t, 2, PyString_FromString("category name here"));
PyErr_SetObject(MyErr, t);
Py_DECREF(t);
return NULL;
}

In this second form you check for the args attribute of the exception.

-- 
-- Guilherme H. Polo Goncalves
___
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] [capi-sig] Exceptions with additional instance variables

2008-12-22 Thread Guilherme Polo
On Mon, Dec 22, 2008 at 10:45 AM, Guilherme Polo  wrote:
> On Mon, Dec 22, 2008 at 10:06 AM,   wrote:
>> On Mon, Dec 22, 2008 at 03:29, Guilherme Polo  wrote:
>>> On Sun, Dec 21, 2008 at 11:02 PM,   wrote:
>>>> Hello,
>>>>
>>>> I'm trying to implement custom exception that have to carry some
>>>> useful info by means of instance members, to be used like:
>>>>
>>>> try:
>>>>// some code
>>>> except MyException, data:
>>>>// use data.errorcode, data.errorcategory, data.errorlevel,
>>>> data.errormessage and some others
>>>>
>>>> The question is - how to implement the instance variables with
>>>> PyErr_NewException?
>>>
>>> Using PyErr_NewException is fine. You must understand that an
>>> exception is a class, and thus PyErr_NewException creates one for you
>>> and returns it.
>>> Just like you would do with a class that has __dict__, set some
>>> attributes to what you want. That is, use PyObject_SetAttrString or
>>> something more appropriated for you.
>>
>> Ok so I did the following. In init function (forget refcounting and
>> error checking for a moment ;-)
>>
>> PyObject *dict = PyDict_New();
>> PyDict_SetItemString(dict, "errorcode", PyInt_FromLong(0));
>> static PyObject *myexception =
>> PyErr_NewException("module.MyException", NULL, dict);
>
> You do not really have to create a dict here, one will be created for
> you if you pass a NULL there.
>
>> PyModule_AddObject(module, "MyException", myexception);
>>
>> It worked more or less as expected, the help shown:
>>
>>  |  --
>>  |  Data and other attributes defined here:
>>  |
>>  |  errorcode = 0
>>  |
>>  |  --
>>
>> Then I did the following when raising the exception:
>>
>> PyObject_SetAttrString(myexception, "errorcode", PyInt_FromLong(111));
>> PyErr_SetString(myexception, "Bad thing happened");
>> return NULL;
>>
>> and the test code was:
>> try:
>>do_bad_thing();
>> except MyException, data:
>>
>> and you surely already guessed it -- data.errorcode was 0 Not only
>> that, module.MyException.errorcode was also 0...
>>
>> What I'm doing wrong? I certainly don't get the idea of exceptions in
>> Python, especially what is being raised - a class or an instance?
>
> There are two forms raise can take, both will end up involving a class
> and a intsance.
>
>> If
>> the latter - how's the class instantiated?
>
> You can call a class to instantiate it.
>
>> If not - what about values
>> in different threads? The docs are so vague about that...
>>
>>
>> Thanks again in advance,
>> Chojrak
>>
>
> Again, an exception is a class, so you could create a new type in C,
> and do anything you wanted. But you probably don't want to create a
> new type to achieve this

By creating a type I mean one that involves defining a tp_init, and
everything else your type needs, not about the simple one created by
PyErr_NewException.

> , so there are two simple ways I'm going to
> paste below:
>
> #include "Python.h"
>
> static PyObject *MyErr;
>
> static PyMethodDef module_methods[] = {
>{"raise_test", (PyCFunction)raise_test, METH_NOARGS, NULL},
>{NULL},
> };
>
> PyMODINIT_FUNC
> initfancy_exc(void)
> {
>PyObject *m;
>
>m = Py_InitModule("fancy_exc", module_methods);
>if (m == NULL)
>return;
>
>MyErr = PyErr_NewException("fancy_exc.err", NULL, NULL);
>
>Py_INCREF(MyErr);
>if (PyModule_AddObject(m, "err", MyErr) < 0)
>return;
> }
>
> the raise_test function is missing, pick one of these:
>
> static PyObject *
> raise_test(PyObject *self)
> {
>PyObject_SetAttrString(MyErr, "code", PyInt_FromLong(42));
>PyObject_SetAttrString(MyErr, "category", PyString_FromString("nice 
> one"));
>PyErr_SetString(MyErr, "All is good, I hope");
>return NULL;
> }
>
> or
>
> static PyObject *
> raise_test(PyObject *self)
> {
>
>PyObject *t = PyTuple_New(3);
>PyTuple_SetItem(t, 0, PyString_FromString("error message"));
>PyTuple_SetItem(t, 1, PyInt_FromLong(10));
>PyTuple_SetItem(t, 2, PyString_FromString("category name here"));
>PyErr_SetObject(MyErr, t);
>Py_DECREF(t);
>return NULL;
> }
>
> In this second form you check for the args attribute of the exception.
>
> --
> -- Guilherme H. Polo Goncalves
>



-- 
-- Guilherme H. Polo Goncalves
___
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] operator.itemgetter with a callback method

2009-01-11 Thread Guilherme Polo
On Sun, Jan 11, 2009 at 2:02 PM, Alexandre Fiori  wrote:
>
> hello
>
> i was thinking about a possible improvement for the itemgetter
> the documentation page shows simple examples like sorting a dictionary by
> its integer values

Hi,

Sorry for starting like this but ideas are supposed to be emailed to
the python-ideas maillist.

> .
> .
>
> in order for that sort (and possibly a lot of other things) to work
> properly, we could add
> a callback method for itemgetter, like this:
>
> class itemgetter:
> def __init__(self, index, callback=None):
> self.index = index
> self.callback = callback
>
> def __call__(self, item):
> return self.callback and self.callback(item[self.index]) or
> item[self.index]
>
> so, we could easly sort by the amount of data in each list, like this:
>
 sorted(friends.items(), key=itemgetter(1, callback=len))
> [('john', ['max']), ('alex', ['bob', 'jane']), ('foo', ['bar', 'steve',
> 'linda'])]
>
>
> what do you guys think about it? please correct me if i'm wrong.
>
>

You are not forced to use itemgetter as a key in sorted, you can
provide your own key method, like this:

def x(item):
return len(item[1])

sorted(friends.items(), key=x)

Also, your idea ruins the name "itemgetter" since it is no longer a itemgetter.

-- 
-- Guilherme H. Polo Goncalves
___
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] Broken Test -- test_distutils

2009-01-29 Thread Guilherme Polo
On Thu, Jan 29, 2009 at 9:00 PM, Raymond Hettinger  wrote:
> In the past couple of days, test_distutils started failing.  It looks like a
> pure python error and may have been introduced by guilherme.polo's checkins:
>
>
> File "c:\py27\lib\distutils\tests\test_sdist.py", line 119, in
> test_make_distr
> ibution
>   spawn('tar --help')
>  File "c:\py27\lib\distutils\spawn.py", line 37, in spawn
>   _spawn_nt(cmd, search_path, dry_run=dry_run)
>  File "c:\py27\lib\distutils\spawn.py", line 70, in _spawn_nt
>   cmd = _nt_quote_args(cmd)
>  File "c:\py27\lib\distutils\spawn.py", line 61, in _nt_quote_args
>   args[i] = '"%s"' % args[i]
> TypeError: 'str' object does not support item assignment
>
> 1 test failed:
>   test_distutils
>
>

How did my commits introduced that error ?

>
> Raymond
>


-- 
-- Guilherme H. Polo Goncalves
___
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] regrtest hangs on test_tk_guionly

2009-02-06 Thread Guilherme Polo
On Fri, Feb 6, 2009 at 1:14 PM, Eric Smith  wrote:
> In the trunk, test_tk_guionly

test_ttk_guionly, right ?

> hangs if I run it through regrtest. This is on
> a Fedora Core 6 box, without X installed.
>

Does it hang if you run it alone through regrtest, or, together with
all the other tests ?

> If I run test_tk_guionly directly, it exits saying there's no DISPLAY set,
> which is what I'd expect:
>
> --8<--
> [trunk]$ ./python Lib/test/test_ttk_guionly.py
> Traceback (most recent call last):
>  File "Lib/test/test_ttk_guionly.py", line 11, in 
>raise test_support.TestSkipped("ttk not available: %s" % msg)
> test.test_support.TestSkipped: ttk not available: no display name and no
> $DISPLAY environment variable
> [29788 refs]
> --8<--
>
>
> If I run regrtest with (or without) -v, it hangs without any output from
> test_tk_guionly:
>
> --8<--
> ...
> OK
> test_transformer
> Test multiple targets on the left hand side. ... ok
>
> --
> Ran 1 test in 0.020s
>
> OK
> test_ttk_guionly
> 
> --8<--
>
>
> I'm not seeing a problem in the py3k branch. There, test_tk_guionly is
> skipped:
>
> --8<--
> test_ttk_guionly
> test_ttk_guionly skipped -- ttk not available: no display name and no
> $DISPLAY environment variable
> --8<--
>
> I'm not sure how to further isolate this, since I can't duplicate it when
> running the test by itself. I'm mostly curious if anyone else is seeing this
> problem. If it's just me, I'll just switch to a Mac, where the problem
> doesn't occur (if for no other reason, because ttk is not available). If
> others are seeing a problem, I'll spend some time isolating it.
>
> Is anyone else seeing this problem?
>

I've noticed it, it is on http://bugs.python.org/issue5122

The second part of the issue description is actually unrelated to the
problem (or at least I'm almost sure it is), so you may discard it. I
wasn't able to duplicate it here, but I could try installing fedora
here to try reproducing and see if I can solve it.

> Eric.


-- 
-- Guilherme H. Polo Goncalves
___
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] regrtest hangs on test_tk_guionly

2009-02-06 Thread Guilherme Polo
On Fri, Feb 6, 2009 at 1:14 PM, Eric Smith  wrote:
> If it's just me, I'll just switch to a Mac, where the problem
> doesn't occur (if for no other reason, because ttk is not available). If
> others are seeing a problem, I'll spend some time isolating it.

If you move to Mac then you may end with an abort :)
See 
http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/99/step-test/0

I tried asking emailing noller to ask what tcl is installed on that
mac but I got no answer, so in this case the buildslave serves me no
purpose. Apparently it doesn't happen all the time (after a change on
how the tcl interpreter was being created in the tests) but it still
happens sometimes. I also opened an issue for this, see:
http://bugs.python.org/issue5120, I ended up closing it after checking
that this noller buildslave stopped aborting but it still happens from
time to time.


-- 
-- Guilherme H. Polo Goncalves
___
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] regrtest hangs on test_tk_guionly

2009-02-06 Thread Guilherme Polo
On Fri, Feb 6, 2009 at 1:34 PM, Eric Smith  wrote:
> If you think my issue is related to 5122, I'll reply to that issue and move
> the discussion there. I can test on a Fedora 10 box, too.

Eric, I've followed the "amd64 gentoo trunk" buildslave and noticed it
took a very long time on test_tcl (or test_ttk_guionly) and then ended
up getting the error described in the issue. As I see, the test hanged
and buildslave decided to quit.


-- 
-- Guilherme H. Polo Goncalves
___
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] test_tk failing

2009-02-12 Thread Guilherme Polo
On Thu, Feb 12, 2009 at 6:59 AM, Raymond Hettinger  wrote:
> C:\py27>py27 lib\test\regrtest.py -uall test_tk
> test_tk
> test test_tk failed -- Traceback (most recent call last):
>  File "c:\py27\lib\lib-tk\test\test_tkinter\test_text.py", line 32, in
> test_search
>   self.failUnlessEqual(text.search('-test', '1.0', 'end'), '1.2')
> AssertionError:  != '1.2'
>
> 1 test failed:
>   test_tk
> [35724 refs]
>
>
>
>
> C:\py31>py31 lib\test\regrtest.py -uall test_tk
> test_tk
> test test_tk failed -- Traceback (most recent call last):
>  File "c:\py31\lib\tkinter\test\test_tkinter\test_text.py", line 32, in
> test_search
>   self.failUnlessEqual(text.search('-test', '1.0', 'end'), '1.2')
> AssertionError:  != '1.2'
>
> 1 test failed:
>   test_tk
> [73837 refs]

http://bugs.python.org/issue5193



-- 
-- Guilherme H. Polo Goncalves
___
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] Tkinter problem in Python 3

2009-02-21 Thread Guilherme Polo
On Sat, Feb 21, 2009 at 7:47 AM, Klaus Müller  wrote:
> Hi!
> I am the lead developer of SimPy (http://simpy.sourceforge.net) . Currently,
> I am porting SimPy to Python 3.
>
> SimPy provides Tk/Tkinter-based GUI and plot facilities.
>
> I find that "import Tkinter" does not work in Python 3, only "import
> tkinter".
>
> What are the changes for Tkinter under Python 3?
>

Tkinter lives in a real package now, named "tkinter". Besides that it
hasn't changed much, but this list is inappropriate for this, may I
ask you to move the questions related to tkinter to the
tkinter-discuss list ?

> Thanks for your help!
>
> Klaus Müller


Regards,

-- 
-- Guilherme H. Polo Goncalves
___
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