Have a nice day.

2011-04-16 Thread Ashraf Ali
Just visit and know the basic information about Bollywood actresses.
You can here Biographies of all bollywood Actresses.
www.bollystarsbiographies.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH

2011-04-16 Thread harrismh777

jmfauth wrote:

I belong to those who are very happy with the Python
installations on Windows platform . . .
I do not see any mess here.


Sorry, I was speaking of a technical mess, not a user's mess.

What I was alluding to specifically is explained very well in PEP 394. 
The technical reasoning the PEP 394 author uses for *not* addressing the 
Windows issue (for 394) is the 'mess'. Its just technically difficult to 
setup easily configured concurrent environments on the Windows platform, 
primarily due to the way the platform was designed--- closed and 
proprietary--- with little to no community input. I think PEP 397 
describes a Windows solution to the problem PEP 394 addresses.


Also, the reason I even mentioned Windows at all, is that I realize that 
more than one platform is active in the Python community. That is a 
difficulty for posting tips without specifying the applicable platform, 
if the tip only applies to *nix for instance. Please, in no way did I 
intend to offend the Windows Python users. Python enhances the life 
experience of Windows users the world over for which I am thankful. Peace.


kind regards,
m harris

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


Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-16 Thread rusi
On Apr 15, 3:22 pm, Aldo Ceccarelli  wrote:
> On 15 Apr, 11:54, frankcui  wrote:
>
>
>
> > On 04/15/2011 05:00 PM, Aldo Ceccarelli wrote:> Hello All,
> > > in my specific problem I will be happy of a response where possible
> > > to:
>
> > > 1. distinguish different operating systems of answering nodes
> > > 2. collect responses of Wyse thin-clients with "Thin OS" to get node
> > > name and MAC address in particular
>
> > > Thanks a lot in advance for any sharing / forward to documentation,
> > > products in the area.
>
> > > KR Aldo
>
> > I think for your interest, if what you described is not a part of your
> > software you are doing but only a specific task, you could use some
> > network scanning tools like nmap to achieve your goals.
>
> > there is also a module called pysnmp and you can look into it to see if
> > it meets your need.
>
> > frank
>
> Thanks Frank! I've browsed pysnmp as you kindly adviced, now looking
> also intohttp://pynetsnmp.sourceforge.net/
> KR Aldo

This is 6-7 year old stale memory (and dont want to start a flame war
but...)
Last I looked at the snmp modules in python I vaguely remember that
the perl modules were so much more feature complete that I had to
switch to perl even though I am generally uncomfortable with perl.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Feature suggestion -- return if true

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 2:21 PM, Gregory Ewing
 wrote:
> My idiom for fetching from a cache looks like this:
>
>  def get_from_cache(x):
>    y = cache.get(x)
>    if not y:
>      y = compute_from(x)
>      cache[x] = y
>    return y
>
> which doesn't require any conditional returns.

There's not a lot of difference between conditionally returning and
conditionally executing all the code between here and the return,
except that when you string three conditional returns together by your
method, it gets three indentations.

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


Re: Python IDE/text-editor

2011-04-16 Thread rusi
On Apr 17, 8:22 am, John Bokma  wrote:
> rusi  writes:
> > On Apr 17, 3:19 am, John Bokma  wrote:
> >> rusi  writes:
> >> > On Apr 16, 9:13 pm, Chris Angelico  wrote:
> >> >> Based on the comments here, it seems that emacs would have to be the
> >> >> editor-in-chief for programmers. I currently use SciTE at work; is it
> >> >> reasonable to, effectively, bill my employer for the time it'll take
> >> >> me to learn emacs?
>
> >> > It takes a day or two to learn emacs.
>
> >> That's an extremely bold statement. I still haven't learned Emacs and
> >> have read most of the Emacs manual, some parts twice.
>
> >> Unless you mean opening a file, saving a file, and some basic cursor
> >> movements.
>
> > Aren't there people (many in fact) who use notepad or equivalent to
> > write programs?
> > How many features do they use?
> > How long would it take to make a map of those same features in emacs?
>
> Yeah, if you bring it down to open a file, save a file, and move the
> cursor around, sure you can do that in a day or two (two since you have
> to get used to the "weird" key bindings).

If all one seeks is 'notepad-equivalence' why use any key-binding?
All this basic ('normal') stuff that other editors do, emacs can also
do from menus alone.

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


Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread OKB (not okblacke)
Phil Winder wrote:

> Hi,
> I'm having a go at using ipython as a command prompt for data
> analysis. Coming from Matlab, I'm used to typing multiple commands on
> the same line then using the up arrow to go through my history.
> How can I write multiple python commands on the same line?
> E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
> error on the 'e' in while.
> 
> Also, how can I produce a new line, without it running the command? I
> would have expected a ctrl-enter or shift-enter to produce the
> expected results.
> E.g. I want:
> "x = 0; 
> while x < 10: 
> x = x + 1; 
> " 
> It seems to work automatically for the "while xxx:", but combinations
> of keys+enter do not work for "normal" lines.

You might want to take a look at DreamPie ( 
http://dreampie.sourceforge.net/ ), which provides the second option you 
indicate (and thus makesthe first unnecessary).  I've found it quite 
convenient for interactive use.


-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
--author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Feature suggestion -- return if true

2011-04-16 Thread Gregory Ewing

Chris Angelico wrote:


def fac(n):
# attempt to get from a cache
return? cache[n]
# not in cache, calculate the value
ret=1 if n<=1 else fac(n-1)*n
# and cache and return it
cache[n]=ret; return ret


My idiom for fetching from a cache looks like this:

  def get_from_cache(x):
y = cache.get(x)
if not y:
  y = compute_from(x)
  cache[x] = y
return y

which doesn't require any conditional returns.

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


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
rusi  writes:

> On Apr 17, 3:19 am, John Bokma  wrote:
>> rusi  writes:
>> > On Apr 16, 9:13 pm, Chris Angelico  wrote:
>> >> Based on the comments here, it seems that emacs would have to be the
>> >> editor-in-chief for programmers. I currently use SciTE at work; is it
>> >> reasonable to, effectively, bill my employer for the time it'll take
>> >> me to learn emacs?
>>
>> > It takes a day or two to learn emacs.
>>
>> That's an extremely bold statement. I still haven't learned Emacs and
>> have read most of the Emacs manual, some parts twice.
>>
>> Unless you mean opening a file, saving a file, and some basic cursor
>> movements.
>
> Aren't there people (many in fact) who use notepad or equivalent to
> write programs?
> How many features do they use?
> How long would it take to make a map of those same features in emacs?

Yeah, if you bring it down to open a file, save a file, and move the
cursor around, sure you can do that in a day or two (two since you have
to get used to the "weird" key bindings).

> And add a handful more to make the switchover worthwhile?

That's somewhat I did: I used TextPad a lot, and at first I looked for
how to do what I could in TextPad in Emacs (hence reading the book). But
that took longer than a day.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Ben Finney
candide  writes:

> Le 16/04/2011 23:13, Ben Finney a écrit :
>
> > The ‘bool’ built-in is not a function.
>
> Oops, unfortunate confusion!! but built-in types and built-in
> functions are sometimes so similar from the user's point of view ;)

Yes, intentionally so, because:

> All the same, you can notice that the official documentation describes
> bool() as a built-in function, cf.
> http://docs.python.org/library/functions.html

sometimes functions are replaced by types, or vice versa, and the user
code doesn't have to know.

Sadly, the result can be that the documentation is sometimes out of date
with the implementation :-)


candide  writes:

> Le 16/04/2011 23:38, Ben Finney a écrit :
>
> > So the answer to the OP's question is no: the function isn't
> > equivalent to the type,
>
> Can bool() type and [my example] bool_equivalent() function return
> different values ?

Why do you need to know? (I should have asked that question earlier.)

> > because the OP's ‘bool_equivalent’ function necessarily uses the
> > built-in ‘bool’ type, while the reverse is not true.
>
> The documentation doesn't seem to state it performs this call.

Right, just as APIs that return strings won't explicitly talk about
calling the ‘str’ type constructor. I don't understand why you expect
that.

-- 
 \   “My business is to teach my aspirations to conform themselves |
  `\  to fact, not to try and make facts harmonise with my |
_o__)   aspirations.“ —Thomas Henry Huxley, 1860-09-23 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread rusi
On Apr 17, 4:12 am, Krzysztof Bieniasz
 wrote:
> > It takes a day or two to learn emacs.
>
> > It takes forever to set it up.
>
> Remember, Emacs is THE way. It's the light in the darkness, it'll save
> your soul and bring you happiness. Isn't it worth the trouble? :)
>
> Seriously though, when I was setting my Emacs to work with Python I
> stumbled upon 
> this:http://pedrokroger.net/2010/07/configuring-emacs-as-a-python-ide-2/

Thanks: Thats a useful link (if it works :D -- I have to try it out)
And this just underscores my earlier point:
Getting emacs to work 'any-old-how' is trivial.
Getting it to work optimally is an unending task.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread rusi
On Apr 17, 3:19 am, John Bokma  wrote:
> rusi  writes:
> > On Apr 16, 9:13 pm, Chris Angelico  wrote:
> >> Based on the comments here, it seems that emacs would have to be the
> >> editor-in-chief for programmers. I currently use SciTE at work; is it
> >> reasonable to, effectively, bill my employer for the time it'll take
> >> me to learn emacs?
>
> > It takes a day or two to learn emacs.
>
> That's an extremely bold statement. I still haven't learned Emacs and
> have read most of the Emacs manual, some parts twice.
>
> Unless you mean opening a file, saving a file, and some basic cursor
> movements.

Aren't there people (many in fact) who use notepad or equivalent to
write programs?
How many features do they use?
How long would it take to make a map of those same features in emacs?
And add a handful more to make the switchover worthwhile?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-16 Thread geremy condra
On Sat, Apr 16, 2011 at 5:31 PM, Chris Angelico  wrote:
> On Sun, Apr 17, 2011 at 9:36 AM, Steven D'Aprano
>  wrote:
>> (If the machine is particularly
>> simple -- you might be able to exactly simulate a lever in pure
>> mathematics, but simulating, say, a nuclear bomb or a dialysis machine in
>> mathematics is more of a challenge...)
>
> I can easily model a massless, frictionless, inelastic, infinitismally
> thin lever. Beyond that, it gets complicated.

With what kind of precision?

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


Re: [OT] Free software versus software idea patents

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 9:36 AM, Steven D'Aprano
 wrote:
> (If the machine is particularly
> simple -- you might be able to exactly simulate a lever in pure
> mathematics, but simulating, say, a nuclear bomb or a dialysis machine in
> mathematics is more of a challenge...)

I can easily model a massless, frictionless, inelastic, infinitismally
thin lever. Beyond that, it gets complicated.

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


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Chris Rebert
On Sat, Apr 16, 2011 at 4:51 PM, candide  wrote:
> Le 16/04/2011 23:38, Ben Finney a écrit :
>
>> So the answer to the OP's question is no: the function isn't equivalent
>> to the type,
>
> Can bool() type and bool_equivalent() function return different values ?

No. The distinction being drawn is rather pedantic, IMO.

>> because the OP's ‘bool_equivalent’ function necessarily
>> uses the built-in ‘bool’ type, while the reverse is not true.
>
> The documentation doesn't seem to state it performs this call.

This is why I used the qualifiers "the equivalent of" and "conceptually".

> I'm referring to
> -- §5.10 Boolean operations in Document Reference Python 2.7
> -- bool()'s description in Library Reference

"bool([x])Convert a value to a Boolean, using the standard truth
testing procedure."

> -- §5.1 Truth Value Testing in Library Reference

This describes "the standard truth testing procedure". Ideally, this
section would be linked to in bool()'s docs.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Python IDE/text-editor

2011-04-16 Thread Colin J. Williams

On 15-Apr-11 23:20 PM, Alec Taylor wrote:
> Good Afternoon,
>
> I'm looking for an IDE which offers syntax-highlighting,
> code-completion, tabs, an embedded interpreter and which is portable
> (for running from USB on Windows).
>
> Here's a mockup of the app I'm looking for: http://i52.tinypic.com
>
> Which would you recommend?
>
> Thanks in advance for any suggestions,
>
> Alec Taylor

Here is an extract from the PyScripter Help:

PyScripter - a Python IDE



PyScripter originally started as a lightweight IDE designed to to serve 
the purpose of providing a strong scripting solution for Delphi 
applications, complementing the excellent Python for Delphi (P4D) 
components.  However, and with the encouragement of the P4D creator 
Morgan Martinez and a few early users, it has now evolved into a 
full-featured stand-alone Python IDE.  It is built in Delphi using P4D 
and the SynEdit component but is extensible using Python scripts. 
Currently, it is only available for Microsoft Windows operating systems 
and  features a modern user-interface. Being built in a compiled 
language is rather snappier than some of the other IDEs   and provides 
an extensive blend of features that make it a productive Python 
development environment.


Why yet another Python IDE?


There are many Python Integrated Development Environments around.  And 
quite a few good ones, for example PythonWin, Boa (a Delphi clone built 
for and with wxPython), SPE and Eric3, not to mention IDLE which is 
included in the standard Python distribution.  So it is reasonable to 
ask why bother to develop yet another Python IDE.  The short answer is 
for the fun of it!  The long answer relates to the ambition to create a 
Python IDE that is competitive with commercial Windows-based IDEs 
available for other languages.


It has the functionality that you seek.

Colin W.




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


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread candide

Le 16/04/2011 23:13, Ben Finney a écrit :


The ‘bool’ built-in is not a function.

 >>>  type(bool)
 




Oops, unfortunate confusion!! but built-in types and built-in functions 
are sometimes so similar from the user's point of view ;)


All the same, you can notice that the official documentation describes 
bool() as a built-in function, cf. 
http://docs.python.org/library/functions.html

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


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread candide

Le 16/04/2011 23:38, Ben Finney a écrit :


So the answer to the OP's question is no: the function isn't equivalent
to the type,



Can bool() type and bool_equivalent() function return different values ?



because the OP's ‘bool_equivalent’ function necessarily
uses the built-in ‘bool’ type, while the reverse is not true.



The documentation doesn't seem to state it performs this call. I'm 
referring to

-- §5.10 Boolean operations in Document Reference Python 2.7
-- bool()'s description in Library Reference
-- §5.1 Truth Value Testing in Library Reference




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


Re: [OT] Free software versus software idea patents

2011-04-16 Thread Steven D'Aprano
On Sat, 16 Apr 2011 00:21:55 -0500, harrismh777 wrote:

> software *is* mathematics

No it isn't.

I might accept an argument that *algorithms* are mathematics, but 
software is not algorithms.

Consider the difference between the mathematical concept of leverage and 
an actual physical lever. We wouldn't say that a physical machine "is" 
mathematics just because we can describe an idealized version of the 
machine in the language of mathematics. (If the machine is particularly 
simple -- you might be able to exactly simulate a lever in pure 
mathematics, but simulating, say, a nuclear bomb or a dialysis machine in 
mathematics is more of a challenge...)

Likewise, we shouldn't try to pretend that an actual software 
implementation of an algorithm, written for an actual hardware machine, 
with all the complications and difficulties that entails, "is" 
mathematics just because we can hypothetically describe an idealized 
version of that algorithm in mathematics. We of all people, being 
programmers, should understand the practical difference between an 
algorithm in a book and the actual code needed to implement that 
algorithm, and not just gloss over the differences with a handwave and a 
confident assertion.



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


Re: Python IDE/text-editor

2011-04-16 Thread Krzysztof Bieniasz
> It takes a day or two to learn emacs.
> 
> It takes forever to set it up.

Remember, Emacs is THE way. It's the light in the darkness, it'll save 
your soul and bring you happiness. Isn't it worth the trouble? :)

Seriously though, when I was setting my Emacs to work with Python I 
stumbled upon this:
http://pedrokroger.net/2010/07/configuring-emacs-as-a-python-ide-2/
Read it and you'll know everything you need to know -- at least to start 
with.

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


Re: Python IDE/text-editor

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 8:31 AM, Westley Martínez  wrote:
>
> Either way doesn't it require python be installed on the system?

Most Python development is going to require that...

I'm rather puzzled by this question; I think I've misunderstood it.
You can't run Python programs without a Python interpreter installed.

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


Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Michael Torrie
On 04/16/2011 02:53 PM, Jean-Paul Calderone wrote:
> On Apr 16, 10:44 am, a...@pythoncraft.com (Aahz) wrote:
>> In article 
>> ,
>> Raymond Hettinger   wrote:
>>
>>
>>
>>> Threading is really only an answer if you need to share data between
>>> threads, if you only have limited scaling needs, and are I/O bound
>>> rather than CPU bound
>>
>> Threads are also useful for user interaction (i.e. GUI apps).  
>>
> 
> I suppose that's why most GUI toolkits use a multithreaded model.

Many GUI toolkits are single-threaded.  And in fact with GTK and MFC you
can't (or shouldn't) call GUI calls from a thread other than the main
GUI thread.  That's not to say GUI programs don't use threads and put
the GUI it its own thread.  But GUI toolkits are often *not*
multithreaded.  They are, however, often asynchronous, which is often
more cost-effective than multi-threaded.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Westley Martínez
On Sat, 2011-04-16 at 17:14 -0500, John Bokma wrote:
> candide  writes:
> 
> > Le 16/04/2011 15:50, Adam Tauno Williams a écrit :
> >
> >> gedit provides a Python interpreter/console 'embedded' in the GUI
> >> (provided the plugin is enabled).
> >>
> >
> >
> > I agree, cf. this screenshot  :
> >
> > http://i52.tinypic.com/snj7a0.jpg
> 
> The name "Terminal" suggests something different, and that can be
> achieved in Emacs as well. Just split a window vertical & horizontal,
> enable tabbar-mode[1], and open a shell in the bottom one, overview of the
> buffers to the left, and your hello_world.py to the top right.
> 
> [1] which is part of the Emacs version I am using, I just learned.
> 
> -- 
> John Bokma   j3b
> 
> Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
> Freelance Perl & Python Development: http://castleamber.com/

Either way doesn't it require python be installed on the system?

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


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
Chris Angelico  writes:

> On Sun, Apr 17, 2011 at 2:32 AM, Andrea Crotti
>  wrote:
>> That of course is an issue, but since you code in many languages I think
>> is really a pretty good investment for your future.
>>
>> And I don't think that you would be unproductive the first weeks with
>> emacs, just a bit slower maybe, and it's not that you can't use anything
>> else in the meanwhile...
>
> Sure, that was a *slight* exaggeration :) but thanks for the advice.
> I'll poke around with it some time.

I tried that several times over years, and never worked. What did the
trick for me was just switching to Emacs, and read the GNU Emacs Manual
thoroughly and making notes. And the next day try what I read the day
before.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
rusi  writes:

> On Apr 16, 9:13 pm, Chris Angelico  wrote:
>> Based on the comments here, it seems that emacs would have to be the
>> editor-in-chief for programmers. I currently use SciTE at work; is it
>> reasonable to, effectively, bill my employer for the time it'll take
>> me to learn emacs?
>
> It takes a day or two to learn emacs.

That's an extremely bold statement. I still haven't learned Emacs and
have read most of the Emacs manual, some parts twice.

Unless you mean openening a file, saving a file, and some basic cursor
movements.

> It takes forever to set it up.

If you mean to make work optimally for your way of editing, probably
true. You can keep fine tuning, adding/testing stuff, etc.


-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
candide  writes:

> Le 16/04/2011 15:50, Adam Tauno Williams a écrit :
>
>> gedit provides a Python interpreter/console 'embedded' in the GUI
>> (provided the plugin is enabled).
>>
>
>
> I agree, cf. this screenshot  :
>
> http://i52.tinypic.com/snj7a0.jpg

The name "Terminal" suggests something different, and that can be
achieved in Emacs as well. Just split a window vertical & horizontal,
enable tabbar-mode[1], and open a shell in the bottom one, overview of the
buffers to the left, and your hello_world.py to the top right.

[1] which is part of the Emacs version I am using, I just learned.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Ben Finney
Chris Rebert  writes:

> That is, `True if x else False` conceptually gets compiled down to
> `True if bool(x) == 1 else False` (but without doing a run-time lookup
> of "bool").

It won't look up the *name* ‘bool’, but it will use that object. Any
boolean expression is going to be calling the built-in ‘bool’ type
constructor.

So the answer to the OP's question is no: the function isn't equivalent
to the type, because the OP's ‘bool_equivalent’ function necessarily
uses the built-in ‘bool’ type, while the reverse is not true.

-- 
 \“Perchance you who pronounce my sentence are in greater fear |
  `\   than I who receive it.” —Giordano Bruno, burned at the stake by |
_o__)  the Catholic church for the heresy of heliocentrism, 1600-02-16 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Ben Finney
candide  writes:

> Is the bool_equivalent() function really equivalent to the bool()
> built-in function ?

The ‘bool’ built-in is not a function.

>>> type(bool)


-- 
 \  “Generally speaking, the errors in religion are dangerous; |
  `\those in philosophy only ridiculous.” —David Hume, _A Treatise |
_o__)   of Human Nature_, 1739 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Chris Rebert
On Sat, Apr 16, 2011 at 1:24 PM, candide  wrote:
> Consider the following code :
>
> # --
> def bool_equivalent(x):
>    return True if x else False
>
>
> # testing ...
>
> def foo(x):
>    return 10*x
>
> class C:
>    pass
>
> for x in [42, ("my","baby"), "baobab", max, foo, C] + [None, 0, "", [],
> {},()]:
>    print bool(x)==bool_equivalent(x)
> # --
>
>
> Is the bool_equivalent() function really equivalent to the bool() built-in
> function ?

The ternary operator, if-statement, and `while` all do the equivalent
of an implicit bool() on their condition, so bool_equivalent() will
always give the same result as bool() because it's indeed using the
moral equivalent of bool() behind the scenes.
That is, `True if x else False` conceptually gets compiled down to
`True if bool(x) == 1 else False` (but without doing a run-time lookup
of "bool").

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Jean-Paul Calderone
On Apr 16, 10:44 am, a...@pythoncraft.com (Aahz) wrote:
> In article ,
> Raymond Hettinger   wrote:
>
>
>
> >Threading is really only an answer if you need to share data between
> >threads, if you only have limited scaling needs, and are I/O bound
> >rather than CPU bound
>
> Threads are also useful for user interaction (i.e. GUI apps).  
>

I suppose that's why most GUI toolkits use a multithreaded model.

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


Equivalent code to the bool() built-in function

2011-04-16 Thread candide

Consider the following code :

# --
def bool_equivalent(x):
return True if x else False


# testing ...

def foo(x):
return 10*x

class C:
pass

for x in [42, ("my","baby"), "baobab", max, foo, C] + [None, 0, "", [], 
{},()]:

print bool(x)==bool_equivalent(x)
# --


Is the bool_equivalent() function really equivalent to the bool() 
built-in function ?




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


Re: Python IDE/text-editor

2011-04-16 Thread candide

Le 16/04/2011 15:50, Adam Tauno Williams a écrit :


gedit provides a Python interpreter/console 'embedded' in the GUI
(provided the plugin is enabled).




I agree, cf. this screenshot  :

http://i52.tinypic.com/snj7a0.jpg

but i'm not sure gedit run easily under Windows.


Kate editor has the same feature.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread wisecracker
Hi Phil...

> How can I write multiple python commands on the same line?
> E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
> error on the 'e' in while.

I don`t think this is possible under any Python version.

There will always be some kind of user intervention required other than
just the single 1, (one), 

E.G...

>>> x = 0
>>> while x < 10: print x; x = x + 1
...
0
1
2
3
4
5
6
7
8
9
>>> 

Ending up with two, (2), lines and three, (3), 

I hope some one can prove me wrong because I would love single line ability 
sometimes.



--
73...

Bazza, G0LCU...

Team AMIGA...

http://homepages.tesco.net/wisecracker/

http://main.aminet.net/search?readme=wisecracker

http://mikeos.berlios.de/

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


Re: Python IDE/text-editor

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 3:07 AM, Andrea Crotti
 wrote:
> The only language where an IDE like eclipse imho is the only way is
> java, but that is because the language sucks so much that without a
> massive help is impossible to write something in a human time.

(Now OT) I used Eclipse once, and yes it was with Java. (Was trying to
build a better MUD client for Android.) It quickly became obvious that
I really didn't need to do any Java development. Ever.

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


Re: Python IDE/text-editor

2011-04-16 Thread Stefaan Himpe

Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png

Which would you recommend?


You drew editra! http://editra.org/preview

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


Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
rusi  writes:

>
> It takes a day or two to learn emacs.
>
> It takes forever to set it up.
>
> [How many shots of cocaine are are needed to de-addict a cocaine
> addict? ]

Not to set it up, but surely to master it.
There are also many people that didn't really learn elisp but still use
emacs taking configuration code from emacswiki or equivalent sites.

> :-)
>
> You are being cute and tart.
>
> But the problem is real:
> 1. emacs can do everything
> 2. It does everything badly
> 3. All the competition does it worse
>
> Frankly Ive thought many times of switching to eclipse but the first
> few screens send a chill (or something such) down my spine and I limp
> back unhappily to emacs...

Why does it do it badly? You just have to configure it better if you
think it does something badly ;)

I also sometimes tried eclipse sometimes, but can't stand it for more
than 4 seconds, and I'm very happy to go back to emacs.

The only language where an IDE like eclipse imho is the only way is
java, but that is because the language sucks so much that without a
massive help is impossible to write something in a human time.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Terry Reedy

On 4/16/2011 3:03 AM, Alec Taylor wrote:

IDLE loses syntax highlighting annoyingly often


Could you exlain?
When does it do that with a file labelled .py?


--
Terry Jan Reedy

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


Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Chris Angelico  writes:

> Sure, that was a *slight* exaggeration :) but thanks for the advice.
> I'll poke around with it some time.
>
> ChrisA

I also suggest to take a look here, there's a quite nice environment
setup for python.
https://github.com/gabrielelanaro/emacs-for-python

The nice thing is that you learn something every day with emacs, even
after years and years, and you become always more productive and fast.

Not to mention that it can evolve with you, and once you change your
way of working you'll know it well enough to change it to your new
requirements.

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


Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Terry Reedy

On 4/16/2011 9:55 AM, Phil Winder wrote:

Hi,
I'm having a go at using ipython as a command prompt for data
analysis. Coming from Matlab, I'm used to typing multiple commands on
the same line then using the up arrow to go through my history.
How can I write multiple python commands on the same line?


You can write multiple *simple* statements using ';'.


E.g. "x = 0; while x<  10: x = x + 1;" returns an "invalid syntax"
error on the 'e' in while.


All compound statements, like while, must start on own line.


Also, how can I produce a new line, without it running the command?


Use an editor, as with IDLE, rather than a shell. Interactive mode runs 
*1* statement (including simple;simple) at a time.



would have expected a ctrl-enter or shift-enter to produce the
expected results.
E.g. I want:
"x = 0;


This is one statement


while x<  10:
 x = x + 1;


This is another.

I can understanding wanting to rerun initialized loops with one enter, 
but you cannot. Sorry.


--
Terry Jan Reedy

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


Re: ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Phil Winder
On Apr 16, 5:29 pm, Andrea Crotti  wrote:
> Phil Winder  writes:
> > Hi,
> > I'm having a go at using ipython as a command prompt for data
> > analysis. Coming from Matlab, I'm used to typing multiple commands on
> > the same line then using the up arrow to go through my history.
> > How can I write multiple python commands on the same line?
> > E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
> > error on the 'e' in while.
>
> > Also, how can I produce a new line, without it running the command? I
> > would have expected a ctrl-enter or shift-enter to produce the
> > expected results.
> > E.g. I want:
> > "x = 0; 
> > while x < 10: 
> >     x = x + 1; 
> > " 
> > It seems to work automatically for the "while xxx:", but combinations
> > of keys+enter do not work for "normal" lines.
>
> > Cheers,
> > Phil
>
> Well when you do something like
>
> while x < 10:
>
> it doesn't execute anything, but goes to newline and waits for the rest.
>
> for
> x = 10
>
> what's the difference for you if it gets evaluated before or after?
> Anyway you can you also %cpaste if you want to write more code
>
> Anyway to me this works perfectly:
> In [1]: x = 0
>
> In [2]: while x < 10: print x; x += 1
>    ...:
> 0
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9

Yes, that does not produce an error, but it does not "work". Please
refer to my first post. Try the first code, you will get a syntax
error. Placing things on one line makes for easy history scrollback.
In your version you will have 2 lines of history for the x = 0 term
and the while ... term. I don't want to have to press up twice,
especially when the code was in the distant past! Also cpaste might be
ok for scripting, but it looks too clumsy to use at the command line.

Cheers,
Phil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread rusi
On Apr 16, 9:13 pm, Chris Angelico  wrote:
> Based on the comments here, it seems that emacs would have to be the
> editor-in-chief for programmers. I currently use SciTE at work; is it
> reasonable to, effectively, bill my employer for the time it'll take
> me to learn emacs?

It takes a day or two to learn emacs.

It takes forever to set it up.

[How many shots of cocaine are are needed to de-addict a cocaine
addict? ]

> I'm using a lot of the same features that the OP
> was requesting (multiple files open at once, etc), plus I like syntax
> highlighting (multiple languages necessary - I'm often developing
> simultaneously in C++, Pike, PHP, and gnu make, as well as Python).
>
> My current "main editors" are SciTE when I have a GUI, and nano when I
> don't (over ssh and such). Mastering emacs would definitely take time;
> I'm not really sure if I can justify it ("Chris, what did you achieve
> this week?" "I learned how to get emacs to make coffee.")...
>
> Chris Angelico

:-)

You are being cute and tart.

But the problem is real:
1. emacs can do everything
2. It does everything badly
3. All the competition does it worse

Frankly Ive thought many times of switching to eclipse but the first
few screens send a chill (or something such) down my spine and I limp
back unhappily to emacs...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 2:32 AM, Andrea Crotti
 wrote:
> That of course is an issue, but since you code in many languages I think
> is really a pretty good investment for your future.
>
> And I don't think that you would be unproductive the first weeks with
> emacs, just a bit slower maybe, and it's not that you can't use anything
> else in the meanwhile...
>

Sure, that was a *slight* exaggeration :) but thanks for the advice.
I'll poke around with it some time.

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


Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 2:29 AM, Andrea Crotti
 wrote:
> for
> x = 10
>
> what's the difference for you if it gets evaluated before or after?

I have the same issue in IDLE sometimes, and the reason it's annoying
relates to the up-arrow key (Alt-P in IDLE). I can retrieve one entire
command, but if that command requires a "prefix statement" to set
things up (like initializing a dictionary to empty), that has to be
separate.

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


Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Chris Angelico  writes:

> Based on the comments here, it seems that emacs would have to be the
> editor-in-chief for programmers. I currently use SciTE at work; is it
> reasonable to, effectively, bill my employer for the time it'll take
> me to learn emacs? I'm using a lot of the same features that the OP
> was requesting (multiple files open at once, etc), plus I like syntax
> highlighting (multiple languages necessary - I'm often developing
> simultaneously in C++, Pike, PHP, and gnu make, as well as Python).
>
> My current "main editors" are SciTE when I have a GUI, and nano when I
> don't (over ssh and such). Mastering emacs would definitely take time;
> I'm not really sure if I can justify it ("Chris, what did you achieve
> this week?" "I learned how to get emacs to make coffee.")...
>
> Chris Angelico

That of course is an issue, but since you code in many languages I think
is really a pretty good investment for your future.

And I don't think that you would be unproductive the first weeks with
emacs, just a bit slower maybe, and it's not that you can't use anything
else in the meanwhile...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Andrea Crotti
Phil Winder  writes:

> Hi,
> I'm having a go at using ipython as a command prompt for data
> analysis. Coming from Matlab, I'm used to typing multiple commands on
> the same line then using the up arrow to go through my history.
> How can I write multiple python commands on the same line?
> E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
> error on the 'e' in while.
>
> Also, how can I produce a new line, without it running the command? I
> would have expected a ctrl-enter or shift-enter to produce the
> expected results.
> E.g. I want:
> "x = 0; 
> while x < 10: 
> x = x + 1; 
> " 
> It seems to work automatically for the "while xxx:", but combinations
> of keys+enter do not work for "normal" lines.
>
> Cheers,
> Phil

Well when you do something like

while x < 10:

it doesn't execute anything, but goes to newline and waits for the rest.

for
x = 10

what's the difference for you if it gets evaluated before or after?
Anyway you can you also %cpaste if you want to write more code

Anyway to me this works perfectly:
In [1]: x = 0

In [2]: while x < 10: print x; x += 1
   ...: 
0
1
2
3
4
5
6
7
8
9

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


Re: Python IDE/text-editor

2011-04-16 Thread Chris Angelico
Based on the comments here, it seems that emacs would have to be the
editor-in-chief for programmers. I currently use SciTE at work; is it
reasonable to, effectively, bill my employer for the time it'll take
me to learn emacs? I'm using a lot of the same features that the OP
was requesting (multiple files open at once, etc), plus I like syntax
highlighting (multiple languages necessary - I'm often developing
simultaneously in C++, Pike, PHP, and gnu make, as well as Python).

My current "main editors" are SciTE when I have a GUI, and nano when I
don't (over ssh and such). Mastering emacs would definitely take time;
I'm not really sure if I can justify it ("Chris, what did you achieve
this week?" "I learned how to get emacs to make coffee.")...

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


Re: Egos, heartlessness, and limitations

2011-04-16 Thread rusi
On Apr 16, 9:27 am, "Littlefield, Tyler"  wrote:
>  >And who pissed in Guido's punch bowl anyway? Why is he such an elitist
>  >now? Why can he not come over once and a while and rub shoulders 
> withhttp://www.youtube.com/watch?v=FMEe7JqBgvg

He he -- Bravo!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Chris Angelico
On Sun, Apr 17, 2011 at 12:44 AM, Aahz  wrote:
> In article ,
> Raymond Hettinger   wrote:
>>
>>Threading is really only an answer if you need to share data between
>>threads, if you only have limited scaling needs, and are I/O bound
>>rather than CPU bound
>
> Threads are also useful for user interaction (i.e. GUI apps).

I agree; user interaction is effectively I/O on, usually, some sort of
event queue that collects from a variety of sources; with the
specialty that, in some GUI environments, the process's first thread
is somehow "special". But ultimately it's still a "worker thread" /
"interaction thread" model, which is quite a good one. The interaction
thread spends most of its time waiting for the user, maybe waiting for
STDIN, maybe waiting for a GUI event, maybe waiting on some I/O device
(TCP socket comes to mind).

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


Re: Python IDE/text-editor

2011-04-16 Thread Verde Denim
On Sat, Apr 16, 2011 at 10:39 AM, craf  wrote:

> Look this:
>
> http://portableapps.com/apps/development/geany_portable
>
>
> Regards.
>
> Cristian
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

All good suggestions. I think it may depend on the level of expertise you're
at. WingIDE is my preferred choice since it offers a lot of help in
developing Py, has a solid debugger, and is available across platforms. But
I'm a novice Py coder. If you're already strong in the coding sense, vi is
my editor of choice, which I use for other languages that I'm intimately
familiar with. Wiki has a pretty good comparison of Py coding editors/IDEs
(wiki search Python development tools). Like many other things Linux, it's
all about choice.

Being a non-free IDE is not a major drawback to Wing (imo). Price is decent,
support is excellent, and upgrades are included through major versions (4
just came out recently). There's also a sizeable community of people using
it. I don't know a whole lot about the company, but it may be one person.
Seems every time I've called I've spoken to same person - not too easy to
understand, but he is very helpful and seems to really know his way around
the tool.

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


Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Aahz
In article ,
Raymond Hettinger   wrote:
>
>Threading is really only an answer if you need to share data between
>threads, if you only have limited scaling needs, and are I/O bound
>rather than CPU bound

Threads are also useful for user interaction (i.e. GUI apps).  

I think that "limited scaling" needs to be defined, too; CherryPy
performs pretty well, and the blocking model does simplify development.

One problem that my company has run into with threading is that it's not
always obvious where you'll hit GIL blocks.  For example, one would
think that pickle.loads() releases the GIL, but it doesn't; you need to
use pickle.load() (and cStringIO if you want to do it in memory).
-- 
Aahz (a...@pythoncraft.com)   <*> http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just
refer to comments in code as 'lies'. :-)"
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread craf
Look this:

http://portableapps.com/apps/development/geany_portable


Regards.

Cristian


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


Re: Python IDE/text-editor

2011-04-16 Thread TP
On Sat, Apr 16, 2011 at 2:32 AM, jacek2v  wrote:
> On Apr 16, 11:18 am, Daniel Kluev  wrote:
>> > Please continue your recommendations.
>>
>> WingIDE has all that and much more, if you are willing to consider
>> non-free IDE.
>> Its multi-threading debugger definitely worth the cost of Pro version for me.
>
> I confirm :)
> --
> http://mail.python.org/mailman/listinfo/python-list
>

I normally use emacs for basic text editing, tried Komodo, Eric, and
IDLE but prefer WingIDE when writing Python code. In particular, the
debugger is really nice. (Of course I also like Visual Studio when
writing/debugging C/C++/C# so maybe I'm just weird).

A new non-free up-and-comer to consider is JetBrain's PyCharm.

And there is PyDev for Eclipse (but I personally tend to avoid Java
based programs).
-- 
http://mail.python.org/mailman/listinfo/python-list


[Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Phil Winder
Hi,
I'm having a go at using ipython as a command prompt for data
analysis. Coming from Matlab, I'm used to typing multiple commands on
the same line then using the up arrow to go through my history.
How can I write multiple python commands on the same line?
E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax"
error on the 'e' in while.

Also, how can I produce a new line, without it running the command? I
would have expected a ctrl-enter or shift-enter to produce the
expected results.
E.g. I want:
"x = 0; 
while x < 10: 
x = x + 1; 
" 
It seems to work automatically for the "while xxx:", but combinations
of keys+enter do not work for "normal" lines.

Cheers,
Phil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Adam Tauno Williams
On Sat, 2011-04-16 at 06:40 -0700, flebber wrote:
> On Apr 16, 3:43 pm, Alec Taylor  wrote:
> > Thanks, but non of the IDEs so far suggested have an embedded python
> > interpreter AND tabs... a few of the editors (such as Editra) have
> > really nice interfaces, however are missing the embedded
> > interpreter... emacs having the opposite problem, missing tabs (also,
> > selecting text with my mouse is something I do often).
> > Please continue your recommendations.

I do most of my coding in Monodevelop, which has good support for Python
[not to mention being a full IDE platform with database browser support,
etc...]



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


Re: Python IDE/text-editor

2011-04-16 Thread Adam Tauno Williams
On Sat, 2011-04-16 at 08:04 -0500, John Bokma wrote:
> Alec Taylor  writes:
> > Thanks, but non of the IDEs so far suggested have an embedded python
> > interpreter 
> Emacs has. Well, it's not embedded as *in* Emacs, but I don't think
> there are many editors that have that besides the ones written in Python.

gedit provides a Python interpreter/console 'embedded' in the GUI
(provided the plugin is enabled).

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


Re: Python IDE/text-editor

2011-04-16 Thread flebber
On Apr 16, 11:07 pm, John Bokma  wrote:
> Jorgen Grahn  writes:
> > If you cannot stand non-tabbed interfaces, you probably can't stand
> > other non-Windows-like features of these two, like their menu systems.
>
> Emacs just has a menu system. Although I rarely use it :-). One of the
> things one learns after some time with either vim or Emacs is that using
> the mouse delays things.
>
> --
> John Bokma                                                               j3b
>
> Blog:http://johnbokma.com/   Facebook:http://www.facebook.com/j.j.j.bokma
>     Freelance Perl & Python Development:http://castleamber.com/

Also Dreampie is a greater interactive shell.

http://dreampie.sourceforge.net/

Features automatic completion of attributes and file names.
Automatically displays function arguments and documentation.
Keeps your recent results in the result history, for later user.
Can automatically fold long outputs, so you can concentrate on what's
important.
Lets you save the history of the session as an HTML file, for future
reference. You can then load the history file into DreamPie, and
quickly redo previous commands.
Automatically adds parentheses and optionally quotes when you press
space after functions and methods. For example, execfile fn
automatically turns into execfile("fn").
Supports interactive plotting with matplotlib. (You have to set
"interactive: True" in the matplotlibrc file for this to work.)
Supports Python 2.5, 2.6, 2.7, Jython 2.5, IronPython 2.6 and Python
3.1.
Works on Windows, Linux and Mac. (Mac support requires MacPorts.)
Extremely fast and responsive.
Free software licensed under GPL version 3.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread flebber
On Apr 16, 3:43 pm, Alec Taylor  wrote:
> Thanks, but non of the IDEs so far suggested have an embedded python
> interpreter AND tabs... a few of the editors (such as Editra) have
> really nice interfaces, however are missing the embedded
> interpreter... emacs having the opposite problem, missing tabs (also,
> selecting text with my mouse is something I do often).
>
> Please continue your recommendations.
>
> Thanks,
>
> Alec Taylor
>
>
>
>
>
>
>
> On Sat, Apr 16, 2011 at 3:29 PM, John Bokma  wrote:
> > Ben Finney  writes:
>
> >> Alec Taylor  writes:
>
> >>> I'm looking for an IDE which offers syntax-highlighting,
> >>> code-completion, tabs, an embedded interpreter and which is portable
> >>> (for running from USB on Windows).
>
> >> Either of Emacs http://www.gnu.org/software/emacs/> or Vim
> >> http://www.vim.org/> are excellent general-purpose editors that
> >> have strong features for programmers of any popular language or text
> >> format.
>
> > I second Emacs or vim. I currently use Emacs the most, but I think it's
> > good to learn both.
>
> > --
> > John Bokma                                                               j3b
>
> > Blog:http://johnbokma.com/   Facebook:http://www.facebook.com/j.j.j.bokma
> >    Freelance Perl & Python Development:http://castleamber.com/
> > --
> >http://mail.python.org/mailman/listinfo/python-list

Editra via shelf has an imbedded interpreter, editra is also working
towards a new python tools plugin that will allow you to change
interpreter jython/python2.7/python3.2 etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
Jorgen Grahn  writes:

> If you cannot stand non-tabbed interfaces, you probably can't stand
> other non-Windows-like features of these two, like their menu systems.

Emacs just has a menu system. Although I rarely use it :-). One of the
things one learns after some time with either vim or Emacs is that using
the mouse delays things.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
Alec Taylor  writes:

> Thanks, but non of the IDEs so far suggested have an embedded python
> interpreter 

Emacs has. Well, it's not embedded as *in* Emacs, but I don't think
there are many editors that have that besides the ones written in Python.

> AND tabs...

Emacs has no tabs per se (although it wouldn't surprise me if there is
an extension that does this) but can show a list of buffers. Also, you
can switch very easily between buffers. I used to work a lot with
Textpad /because/ of the tabs, but don't miss them with Emacs. Another
feature I love is the ability to /split/ a window in 2 parts to have 2
views on the same buffer. And being able to open another window with
another view on the same buffer.


> a few of the editors (such as Editra) have
> really nice interfaces, however are missing the embedded
> interpreter... emacs having the opposite problem, missing tabs (also,
> selecting text with my mouse is something I do often).

You can select text just fine with a mouse in Emacs.

Anyway, checked for tabs.
http://www.emacswiki.org/emacs/TabBarMode

The remark at the bottom states:
  Aquamacs tabbar work with standard emacs.Just check it out. - Emmett

What I love so much about Emacs is that each feature I've wanted so far
is either part of it, or can be installed. Sometimes I have to change
how I think about the feature a bit, but so far, so good.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Colin J. Williams

On 15-Apr-11 23:20 PM, Alec Taylor wrote:

Good Afternoon,

I'm looking for an IDE which offers syntax-highlighting,
code-completion, tabs, an embedded interpreter and which is portable
(for running from USB on Windows).

Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png

Which would you recommend?

Thanks in advance for any suggestions,

Alec Taylor


Here is an extract from the PyScripter Help:

PyScripter - a Python IDE



PyScripter originally started as a lightweight IDE designed to to serve 
the purpose of providing a strong scripting solution for Delphi 
applications, complementing the excellent Python for Delphi (P4D) 
components.  However, and with the encouragement of the P4D creator 
Morgan Martinez and a few early users, it has now evolved into a 
full-featured stand-alone Python IDE.  It is built in Delphi using P4D 
and the SynEdit component but is extensible using Python scripts. 
Currently, it is only available for Microsoft Windows operating systems 
and  features a modern user-interface. Being built in a compiled 
language is rather snappier than some of the other IDEs   and provides 
an extensive blend of features that make it a productive Python 
development environment.


Why yet another Python IDE?


There are many Python Integrated Development Environments around.  And 
quite a few good ones, for example PythonWin, Boa (a Delphi clone built 
for and with wxPython), SPE and Eric3, not to mention IDLE which is 
included in the standard Python distribution.  So it is reasonable to 
ask why bother to develop yet another Python IDE.  The short answer is 
for the fun of it!  The long answer relates to the ambition to create a 
Python IDE that is competitive with commercial Windows-based IDEs 
available for other languages.


It has the functionality that you seek.

Colin W.




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


Re: Is it possible to execute Python code from C++ without writing to a file?

2011-04-16 Thread Anssi Saari
Roger House  writes:

> I tried PyRun_String, but I can't see how it can be used to return a
> tuple (the Py_file_input option always returns None).

There's an example of this at
http://stackoverflow.com/questions/3789881/create-and-call-python-function-from-string-via-c-api

The comments say this took quite a lot of investigation. I believe it
too, since it doesn't exactly leap out from the documentation... The
example returns only a single fixed integer, but changing it to return
a tuple shouldn't be a problem.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Vlastimil Brom
2011/4/16 Alec Taylor :
> Thanks, but non of the IDEs so far suggested have an embedded python
> interpreter AND tabs... a few of the editors (such as Editra) have
> really nice interfaces, however are missing the embedded
> interpreter... emacs having the opposite problem, missing tabs (also,
> selecting text with my mouse is something I do often).
>
> Please continue your recommendations.
>
> Thanks,
>
> Alec Taylor
>
Hi,
I don't use these tools regularly, but judging from your virtual
"screenshot" and featureset, e.g.
UliPad
http://code.google.com/p/ulipad/

or SPE
http://pythonide.blogspot.com/

could fit the bill.
Of course, none of these can be compared with the already suggested
heavier tools in terms of featureset or maturity, but in case you
don't want to learn that programs just now, you can try these simpler
ones to see, if they offer, what you need.

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


Re: Python IDE/text-editor

2011-04-16 Thread Tim Chase

On 04/16/2011 02:17 AM, Ben Finney wrote:

Emacs can run Python in a buffer, and has “tabbar-mode” to
display a row of tabs

Likely the same features are available in Vim, by I've never
used Vim for lots of Python coding.


Vim since v7 has offered tabs, though I personally stick mostly 
to split-panes ("windows" in vim parlance).


  :help tab-page

The GUI version (gvim) offers mouse support; the console version 
supports the mouse as well, but may be a bit more fiddly as 
mouse/console interactions often are.


  :help mouse-using

As for running a python shell within Vim, the idea of an embedded 
pseudo-tty (so that means an embedded console, python shell, or 
just running any other console program) has been pretty 
resolutely rejected by the maintainers.  I think there's an 
unofficial patch[1] to add the support, but most folks just bring 
up a second console/terminal and run things there.  For me, it's 
either using "screen" or just another xterm/rxvt window.


  :help shell-window

That said, Vim does have Python scripting capabilities as well, 
so you can control vim with Python code


  :help python

and Vim can evaluate python if it was built as such (check the 
output of ":version" for "+python").  Additionally, you can 
always run your Vim script and pull the output into a buffer 
somewhere:


  :r !my_script.py
  :r !python my_script.py

(form dependent on whether your script is marked executable)

To the OP, try both Vim & Emacs and see which fits your head 
better.  They're both great editors and will provide a lifetime 
of returns on the time invested learning them.  Vim fits me 
better; Emacs seems to better fit several of the other folks on 
the list who responded.


-tkc

[1]
http://www.wana.at/vimshell/

http://stackoverflow.com/questions/2782752/how-can-i-open-a-shell-inside-a-vim-window




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


Re: Python IDE/text-editor

2011-04-16 Thread Jorgen Grahn
On Sat, 2011-04-16, Alec Taylor wrote:
> On Sat, Apr 16, 2011 at 3:29 PM, John Bokma  wrote:
>> Ben Finney  writes:
>>
>>> Alec Taylor  writes:
>>>
 I'm looking for an IDE which offers syntax-highlighting,
 code-completion, tabs, an embedded interpreter and which is portable
 (for running from USB on Windows).
>>>
>>> Either of Emacs http://www.gnu.org/software/emacs/> or Vim
>>> http://www.vim.org/> are excellent general-purpose editors that
>>> have strong features for programmers of any popular language or text
>>> format.
>>
>> I second Emacs or vim. I currently use Emacs the most, but I think it's
>> good to learn both.

> Thanks, but non of the IDEs so far suggested have an embedded python
> interpreter AND tabs...
> emacs having the opposite problem, missing tabs (also,
> selecting text with my mouse is something I do often).

Does it *have* to be tabs? Why? Both Emacs and Vim can have multiple
files open, and have various powerful ways to navigate between them.

If you cannot stand non-tabbed interfaces, you probably can't stand
other non-Windows-like features of these two, like their menu systems.

/Jorgen

-- 
  // Jorgen GrahnO  o   .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-16 Thread Algis Kabaila
On Saturday 16 April 2011 16:46:10 geremy condra wrote:
> On Fri, Apr 15, 2011 at 10:21 PM, harrismh777
>  wrote:
> 
> 
> 
> This looks to me like an application of the troll motto "if
> you can't dazzle them with brilliance, baffle them with
> bull". It certainly does nothing to prove your claim,
> despite clearly attempting to word-salad your way through an
> argument.
> 
> Geremy Condra

Sounds rather unkindly reaction.  Besides, I like trolls and 
their country of origin - it keeps being classed as the best 
place to live in this earth of ours!

Peace!.  If you ever reach my age, you will appreciate peace.

OldAl.
-- 
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH

2011-04-16 Thread Algis Kabaila
On Saturday 16 April 2011 20:03:22 jmfauth wrote:
> On 16 avr, 06:16, harrismh777  wrote:
> > By default the sys.path always shows the directory python
> > was opened in, usually the users home directory. With
> >  .profile  you can set the path any way you want... most
> > useful for setting up special test directories ahead of
> > the "real" code, or for setting up separate directories
> > for versions--- one for Python26, Python27, and of course
> > Python32.
> > 
> > (there are other ways of accomplishing the same thing, and
> > of course, this one only really works with *nix systems---
> > windows is another mess entirely)
> 
> I belong to those who are very happy with the Python
> installations on Windows platform (thanks MvL, this should
> be said) and I hope it will continue like this.
> 
> I do not see any mess here. Every Python version lives in
> its own isolated directory, including \site-packages.
> That means I can keep, eg, a Python 2.5 application (*) which
> is using PIL, wxPython and numpy in a running state, while
> developping new applications with other Python versions or
> porting that application (*) to another Python version. And
> that on all Windows versions (Win2K, XP, Vista, Win7) modulo
> the underlaying os-libs compatibility, but that's the same
> problem on all os, especially for the GUI libs.
> 
> I'm using Python since ver 1.5.6 and I never set any
> PYTHONPATH environment variable.
> 
> A final word about sys.path. This is is my mind the
> most clever idea of Python. I have the feeling, no
> offense here, you are not understanding it very well.
> The sys.path is some kind of *dynamic* environment
> variable and has basically or primarily nothing to do
> with a user directory.
> 
> jmf

On invocation of IDLE, sys.path does contain the path to home 
directory  (on nix /home/; on my PC it is /home/ak) In 
Bash that home directory is accessible through bash variable 
$HOME.  Once a program is executed from the "Python Shell" (of 
IDLE), the $HOME directory is replace by the directory of the 
program, whatever that is.  Yes, sys.path is dynamic and it can 
be easily changed from Python, but the changes are discarded 
once the Python is restarted.  Hence my interest in shell 
variable PYTHONPATH, accessible from bash as $PYTHONPATH. 

I have no need of Windows and no longer use it at all, yet I 
want my programs to be portable to all main platforms, hence my 
enthusiastic support for all things Python.

Thanks for all contributions and ALL includes windows et al.

OldAl. 
-- 
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH

2011-04-16 Thread jmfauth
On 16 avr, 06:16, harrismh777  wrote:


> By default the sys.path always shows the directory python was opened in,
> usually the users home directory. With  .profile  you can set the path
> any way you want... most useful for setting up special test directories
> ahead of the "real" code, or for setting up separate directories for
> versions--- one for Python26, Python27, and of course Python32.
>
> (there are other ways of accomplishing the same thing, and of course,
> this one only really works with *nix systems--- windows is another mess
> entirely)
>


I belong to those who are very happy with the Python
installations on Windows platform (thanks MvL, this should
be said) and I hope it will continue like this.

I do not see any mess here. Every Python version lives in
its own isolated directory, including \site-packages.
That means I can keep, eg, a Python 2.5 application (*) which
is using PIL, wxPython and numpy in a running state, while
developping new applications with other Python versions or
porting that application (*) to another Python version. And
that on all Windows versions (Win2K, XP, Vista, Win7) modulo
the underlaying os-libs compatibility, but that's the same
problem on all os, especially for the GUI libs.

I'm using Python since ver 1.5.6 and I never set any
PYTHONPATH environment variable.

A final word about sys.path. This is is my mind the
most clever idea of Python. I have the feeling, no
offense here, you are not understanding it very well.
The sys.path is some kind of *dynamic* environment
variable and has basically or primarily nothing to do
with a user directory.

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


Re: Python IDE/text-editor

2011-04-16 Thread Ben Finney
Daniel Kluev  writes:

> […] if you are willing to consider non-free IDE.

I would advise against use of a non-free tool for one's programming,
because the tool's fate is not in the hands of the whole community of
people who use it.

When the party with privileged access to alter the tool makes a change
you don't like, or loses the budget or ability or motivation to continue
maintaining it, you have no option to get someone else to change it for
the better.

Only free software leaves its community of users free to decide what
changes will be made – and what changes will *not* be made – to the tool
over its lifetime.


Since the free-software options for programming tools are so powerful,
there is little good reason to choose non-free tools.

-- 
 \“The difference between religions and cults is determined by |
  `\  how much real estate is owned.” —Frank Zappa |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread jacek2v
On Apr 16, 11:18 am, Daniel Kluev  wrote:
> > Please continue your recommendations.
>
> WingIDE has all that and much more, if you are willing to consider
> non-free IDE.
> Its multi-threading debugger definitely worth the cost of Pro version for me.

I confirm :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Daniel Kluev
On Sat, Apr 16, 2011 at 4:43 PM, Alec Taylor  wrote:
> Thanks, but non of the IDEs so far suggested have an embedded python
> interpreter AND tabs... a few of the editors (such as Editra) have
> really nice interfaces, however are missing the embedded
> interpreter... emacs having the opposite problem, missing tabs (also,
> selecting text with my mouse is something I do often).
>
> Please continue your recommendations.

WingIDE has all that and much more, if you are willing to consider
non-free IDE.
Its multi-threading debugger definitely worth the cost of Pro version for me.

-- 
With best regards,
Daniel Kluev
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can Python control Thuderbird?

2011-04-16 Thread Andrea Crotti
marceepoo  writes:

> I want to control Mozilla Thunderbird using Python.
> Does anyone know if that is that possible?
> I would like to use Python to save email attachments to a specific
> directory, depending on the name of the sender, content in the email,
> etc.--- and to rename the attachment file  -- and to save the email to
> an html file -- and to insert into the email file links to the locally
> saved copies of the attachments.  Is this possible? 
>  If the answer is yes, where could I find information about how to use 
> Python to control Thuderbird (and/or examples of saving attachments to locval 
> filenames,and/or saving emails to htmlfiles and/or connecting to the list of
> contacts) ? 
>While hunting around, I came across "Python 18.4. mailbox — Manipulate 
> mailboxes in various formats — Python v2.7.1 documentation".  I'm so totally 
> ignorant of MAPI that I don't know if that is what I'm looking for.  If it 
> is, does anyone know where I could find some examples of python scripts using 
> the "Python 18.4. mailbox module"?
>
> Thanks,
>
>Marceepoo
>
>
> Thanks for your tme and the knowledge you share,
>
>  Marc

In general I think it would be easier to work directly from the mailbox,
yes, or even the imap folders if you're using imap, but in this case
thunderbird is not part of the equation...

If you want to use thunderbird then I think there are easier solutions
with the internal scripting language (XUL or however it was called...)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Alec Taylor  writes:

> Good Afternoon,
>
> I'm looking for an IDE which offers syntax-highlighting,
> code-completion, tabs, an embedded interpreter and which is portable
> (for running from USB on Windows).
>
> Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png
>
> Which would you recommend?
>
> Thanks in advance for any suggestions,
>
> Alec Taylor

As many others said I suggest emacs, it can do all those things and much
much more, you just need to spend some time.

But the thing is that if you (waste) spend time in learning any
python-only ide
1. you'll be sooner or later disappointed and not able to make it work
   as you want
2. when one day you'll change language you'll have to start again from
   scratch

So it really doesn't make sense in my opinion.  It's true that learning
emacs (or vim) takes some time but it's all time well invested, for you
future productivity and satisfaction.

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


Re: Egos, heartlessness, and limitations

2011-04-16 Thread Jason Swails
On Wed, Apr 13, 2011 at 7:03 PM, Ryan Kelly  wrote:

> It's also an oft-cited troll conspiracy that Guido hangs out on
> python-list and posts under various pseudonyms.  I think it would be
> kinda fun if he did...
>

What if one of those was rr?  I can't imagine he'd have that much time for
self-entertainment, but that would be pretty awesome (terrible?).

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


Re: PYTHONPATH

2011-04-16 Thread Algis Kabaila
On Saturday 16 April 2011 14:16:59 harrismh777 wrote:
> Algis Kabaila wrote:
> > Is PYTHONPATH a system variable that sets the
> > path for several sessions and if so, where in the system is
> > it? Do I need to create one for setting python path for
> > several sessions?
> 
>snip... 
> Of course this only works if the Python folder exists in the
> users ~/ directory tree (or elsewhere, if you code it that
> way).
> 
> By default the sys.path always shows the directory python was
> opened in, usually the users home directory. With  .profile 
> you can set the path any way you want... most useful for
> setting up special test directories ahead of the "real"
> code, or for setting up separate directories for versions---
> one for Python26, Python27, and of course Python32.
> 
> 
> (there are other ways of accomplishing the same thing, and of
> course, this one only really works with *nix systems---
> windows is another mess entirely)
> 
> kind regards,
> m harris

My apologies for not stating that I do use a "nix" system - 
kubuntu 10.10. I switche to ubuntu/kubuntu from suse some time 
ago. Suse had by default a ~/bin directory.  On ubuntu/kubuntu 
the user needs to create it.

Thank you for your contribution - you adressed exactly the issue 
that I wanted to take care of - testing different systems (PyQt 
v. PySide, Python 2.7 v Python 3.2 etc.)  

It is a significant help!

Sorry I can not address you by name, as your signature is 
suggestive that it may start with M and that Harris is your 
surname (or pseudo name).  You have been most helpful!

OldAl.

-- 
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Ben Finney
Alec Taylor  writes:

> Thanks

(Please don't top-post. Instead, follow the normal ordering of a
conversation in text: reply in-line to the parts you're responding to,
and trim the parts you're not responding to.)

> but non of the IDEs so far suggested have an embedded python
> interpreter AND tabs...

Emacs can run Python in a buffer, and has “tabbar-mode” to display a row
of tabs http://amitp.blogspot.com/2007/04/emacs-buffer-tabs.html>.

Likely the same features are available in Vim, by I've never used Vim
for lots of Python coding.

> (also, selecting text with my mouse is something I do often).

Both Emacs and Vim support selecting with the mouse just fine.

> Please continue your recommendations.

Learn a standard mature portable free-software editor – either Emacs or
Vim – and thereby never be without a powerful programming environment
again throughout your career.

-- 
 \  “Compulsory unification of opinion achieves only the unanimity |
  `\of the graveyard.” —Justice Roberts in 319 U.S. 624 (1943) |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread Algis Kabaila
On Saturday 16 April 2011 15:55:59 harrismh777 wrote:
> Alec Taylor wrote:
> > Please continue your recommendations.
> 
> IDLE?
> 
> (works for me)
> 
> 3.2 is working much better for me this week...   :)
> 
> (thanks)
> 
> kind regards,
> m harris

IDLE is ok and it comes by default with Python.  Eric4 for 
Python 2.x and Eric5 for Python 3.x is just great!  Why is Eric 
"great" and IDLE just "ok"?  Eric puts a space by default after 
a ',' and close bracket for evey open bracket typed. Less 
typing, much along the Python effects on source code.

OldAl.
-- 
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread jmfauth
On 16 avr, 05:20, Alec Taylor  wrote:
> Good Afternoon,
>

...

Windows user here.

I'm using SciTE, http://www.scintilla.org/SciTE.html . Portable
(run on/from an usb key), output pane, ...

If you are interested in a portable Interactive Interpreter,
http://spinecho.ifrance.com/psi.html (run on/from an usb
key).


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


Re: Python IDE/text-editor

2011-04-16 Thread Alec Taylor
IDLE loses syntax highlighting annoyingly often, and interpreter isn't embedded.

Boa Constructor gave errors on installation (keys).

Komodo might be good, however isn't free nor can't be run from USB :(

On Sat, Apr 16, 2011 at 4:31 PM, CM  wrote:
> On Apr 16, 1:43 am, Alec Taylor  wrote:
>> Thanks, but non of the IDEs so far suggested have an embedded python
>> interpreter AND tabs... a few of the editors (such as Editra) have
>> really nice interfaces, however are missing the embedded
>> interpreter... emacs having the opposite problem, missing tabs (also,
>> selecting text with my mouse is something I do often).
>
> Boa Constructor has syntax-highlighting, code-completion, tabs, line
> numbers, and an embedded interpreter.  It also does a lot of other
> IDEish stuff and it's a GUI builder, too. I've never tried to run it
> from a USB, though, and the interpreter (the "shell") is in a separate
> tab, not on the bottom as you've drawn it.
>
> You might want to just look at this page for other ideas:
> http://wiki.python.org/moin/IntegratedDevelopmentEnvironments
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list