ANN: Portable Pyhon 3.2.0.1 released

2011-04-17 Thread Perica Zivkovic
All, I would like to announce new release of Portable Python based on Python 3.2. Included in this release: - * PyScripter 2.4.1 * NetworkX 1.4 * RPyC 3.0.7 Installation and use: - After downloading, run the installer, select the packages you

pytest-2.0.3: bug fixes and speed ups

2011-04-17 Thread holger krekel
py.test 2.0.3: bug fixes and speed ups === Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest, a mature testing tool for Python, supporting CPython 2.4-3.2, Jython and latest PyPy interpreters. See the

[ANN] Python 2.5.6 Release Candidate 1

2011-04-17 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm happy to announce the release candidate 1 of Python 2.5.6. This is a source-only release that only includes security fixes. The last full bug-fix release of Python 2.5 was Python 2.5.4. Users are encouraged to upgrade to the

Re: PYTHONPATH

2011-04-17 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

Have a nice day.

2011-04-17 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: Python IDE/text-editor

2011-04-17 Thread Jorgen Grahn
On Sat, 2011-04-16, 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? I'm using a lot of the

Re: Python IDE/text-editor

2011-04-17 Thread Chris Angelico
On Sun, Apr 17, 2011 at 5:17 PM, Jorgen Grahn grahn+n...@snipabacken.se wrote: (That should really be a new job title. Just as there are aerobics instructors or whatever at the gyms to help you use the equipment there safely and efficiently, there should be text editor instructors!) You nearly

Re: Python IDE/text-editor

2011-04-17 Thread Bastian Ballmann
Am Sat, 16 Apr 2011 22:22:19 -0500 schrieb John Bokma j...@castleamber.com: 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). Sorry but learning the basic stuff

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

2011-04-17 Thread candide
Le 17/04/2011 04:39, Ben Finney a écrit : Why do you need to know? (I should have asked that question earlier.) First because I was doubting the true interest of the bool() type. In fact, it appears that it's _semantically_ a shortcut for True if x else False. I could't imagine a builtin

Re: PYTHONPATH

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 01:14:54 -0500, harrismh777 wrote: 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 believe that

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

2011-04-17 Thread Chris Angelico
On Sun, Apr 17, 2011 at 6:38 PM, candide candide@free.invalid wrote: I also try to consider how essential the bool() type is. Again compare with int() or str() types. Well, of course you can always implement bool as an int; C has done this for decades, and it hasn't killed it. You can also

Re: Feature suggestion -- return if true

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 16:21:53 +1200, Gregory Ewing wrote: 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

Re: Feature suggestion -- return if true

2011-04-17 Thread Chris Angelico
On Sun, Apr 17, 2011 at 6:45 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 17 Apr 2011 16:21:53 +1200, Gregory Ewing wrote: Chris Angelico wrote: def fac(n):     # attempt to get from a cache     return? cache[n]     # not in cache, calculate the value     ret=1

Make Python portable by default! (Re: Python IDE/text-editor)

2011-04-17 Thread Wolfgang Keller
You can't run Python programs without a Python interpreter installed. Wrong. See e.g. http://www.portablepython.com/ BTW: Imho, the Python interpreter should be made portable (zero-install) _by default_. Installing it should be purely optional. Sincerely, Wolfgang Keller --

Re: Make Python portable by default! (Re: Python IDE/text-editor)

2011-04-17 Thread Chris Angelico
On Sun, Apr 17, 2011 at 7:13 PM, Wolfgang Keller felip...@gmx.net wrote: You can't run Python programs without a Python interpreter installed. Wrong. See e.g. http://www.portablepython.com/ Uhm... how does that disprove? Whatever language you distributed code is in, you need something on the

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

2011-04-17 Thread Ben Finney
candide candide@free.invalid writes: First because I was doubting the true interest of the bool() type. In fact, it appears that it's _semantically_ a shortcut for True if x else False. That bends my brain. Both ‘True’ and ‘False’ are instances of the ‘bool’ type. So of course the ‘bool’

Re: Python IDE/text-editor

2011-04-17 Thread Alec Taylor
Thanks for all the replies (I love the python mailing-list!) I've tried all the IDEs/text-editors mentioned. PyScripter is great, however is unmaintained thus doesn't support 64-bit :[ (and is a little buggy) Also, it requires network connectivity, which could prove troublesome on my locked-down

Re: Feature suggestion -- return if true

2011-04-17 Thread Martin v. Loewis
be expanded to _temp = expr if _temp: return _temp This could be simplified to just: return expr or None No, it can't be simplified in this way. If there is code after that snippet, then it will get executed in the original version if _temp is false, but won't get executed in

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

2011-04-17 Thread Daniel Kluev
On Sun, Apr 17, 2011 at 7:38 PM, candide candide@free.invalid wrote: I could't imagine a builtin function having a so trivial implementation. As it was pointed out, its not function, its type, SETBUILTIN(bool, PyBool_Type); While its __new__ is indeed trivial (in essence, it

Re: Python IDE/text-editor

2011-04-17 Thread Ben Finney
Alec Taylor alec.tayl...@gmail.com writes: I've tried all the IDEs/text-editors mentioned. Great! Experimenting with them is valuable if you have the time. Emacs and vim are good, however I often find myself on a workstation without direct console access. I don't understand this; both of

Re: TextWrangler run command not working properly

2011-04-17 Thread Fabio
In article mailman.371.1302815698.9059.python-l...@python.org, Ernest Obusek ern...@willowfalls.net wrote: I'm not a python expert, but you might trying running 'print sys.path' inside your script and run that from TextWrangler to see where it's looking for modules. - Ernest Hi

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

2011-04-17 Thread Andrea Crotti
Phil Winder philipwin...@gmail.com writes: 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

An unusual question...

2011-04-17 Thread wisecracker
Hi coders... Before I start I don`t expect an easy answer except No it can`t be done!. I have not tried it yet, I`m only asking for opinions ATM. (Except on the classic AMIGA and it DOES work for that!) I only want it to work in Linux/?IX. Windblows does not interest me at all. OK here we

Re: Python IDE/text-editor

2011-04-17 Thread Andrea Crotti
Ben Finney ben+pyt...@benfinney.id.au writes: As many others in this thread have said, the learning curve pays off in access to a powerful general-purpose tool that you can apply to an enormous range of programming tasks. A reason Vim and Emacs survive while so many thousands of other

Re: Feature suggestion -- return if true

2011-04-17 Thread D'Arcy J.M. Cain
On Sun, 17 Apr 2011 16:21:53 +1200 Gregory Ewing greg.ew...@canterbury.ac.nz 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 I prefer not to create and

Re: An unusual question...

2011-04-17 Thread Miki Tebeka
If I wrote an Assembly(/Assembler) routine to call this binary code using say the JMP instruction or using PUSH absolute value and RET, and, call these Jump using:- os.system(/full//path/to/Jump address_of_binary_in_ascii) This is calling a different *program* outside of the current

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H chris.humph...@windsorcircle.com wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)?  Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Google search?  If

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 16, 4:59 am, David Cournapeau courn...@gmail.com wrote: My experience is that if you are CPU bound, asynchronous programming in python can be  more a curse than a blessing, mostly because the need to insert scheduling points at the right points to avoid blocking and because profiling

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 12:10 am, Michael Torrie torr...@gmail.com wrote: 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. Most of them (if not all?) have a single GUI thread, and a mechanism by which

Re: Feature suggestion -- return if true

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 08:33:47 -0400, D'Arcy J.M. Cain wrote: On Sun, 17 Apr 2011 16:21:53 +1200 Gregory Ewing greg.ew...@canterbury.ac.nz 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)

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread Ian
On 15/04/2011 20:17, Dan Stromberg wrote: On Fri, Apr 15, 2011 at 9:33 AM, Chris H chris.humph...@windsorcircle.com wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)? Is this really an issue for multi-threaded web services as seems to be

Re: An unusual question...

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 13:15:01 +0100, wisecracker wrote: OK here we go... I can easily place a machine code, PURE binary, routine into Python. What do you mean by into Python? Do you mean patching the Python compiler? Injecting code into the runtime interpreter? Storing a bunch of bytes in

Re: Feature suggestion -- return if true

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 19:07:03 +1000, Chris Angelico wrote: If there's the possibility of _ANY_ value coming back from the computation, then it would need to be done as: if x in cache: return cache[x] Or you can create a sentinel value that is guaranteed to never appear anywhere else:

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Miki... os.system(/full//path/to/Jump address_of_binary_in_ascii) This is calling a different *program* outside of the current Python process. I don't think it'll do what you want (different memory segments). That is what I assumed, that an os.system() call would run in a subshell.

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 15, 6:33 pm, Chris H chris.humph...@windsorcircle.com wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)?  Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Google search?  If

Re: Questions about GIL and web services from a n00b

2011-04-17 Thread sturlamolden
On Apr 17, 5:15 pm, Ian hobso...@gmail.com wrote: 5) Even in CPython, I/O-bound processes are not slowed significantly by the GIL.  It's really CPU-bound processes that are. Its ONLY when you have two or more CPU bound threads that you may have issues. And when you have a CPU bound

Re: Python IDE/text-editor

2011-04-17 Thread sal migondis
On Apr 17, 7:09 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Alec Taylor alec.tayl...@gmail.com writes: [..] whereas nano, and all the text-editors/IDEs above are user-friendly. No they're not 'user-friendly'. They are a user's worst enemy. What's the point of a computer if all you can

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
rusi rustompm...@gmail.com writes: [ Notepad - Emacs ] 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. OK, true. Anyway, I highly doubt anyone using Notepad as an editor is going to

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
Bastian Ballmann ba...@chaostal.de writes: Am Sat, 16 Apr 2011 22:22:19 -0500 schrieb John Bokma j...@castleamber.com: 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

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
Alec Taylor alec.tayl...@gmail.com writes: Emacs and vim are good, however I often find myself on a workstation without direct console access. Emacs and vim can also work in a GUI enviroment. GVim leaves a lot aesthetically desired. Ditto for Emacs. It misses the bling bling. But are you

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 2:15 pm, wisecrac...@tesco.net wrote: I can also find out where it is EXACTLY just as easily so this is not my problem. The problem is calling it! You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call

Re: An unusual question...

2011-04-17 Thread wisecracker
Hello Steven... I read the whole of your post first and you come across one abrasive character. I can easily place a machine code, PURE binary, routine into Python. What do you mean by into Python? Do you mean patching the Python compiler? Injecting code into the runtime interpreter? No and

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Sturla... You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call mprotect to make it executable. Copy your binary code into this buffer. Then you will need to do some magic with ctypes, Cython or C to call it;

Re: An unusual question...

2011-04-17 Thread Chris Angelico
It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: An unusual question...

2011-04-17 Thread rusi
On Apr 17, 9:37 pm, wisecrac...@tesco.net wrote: Hi Sturla... You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call mprotect to make it executable. Copy your binary code into this buffer. Then you will need

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 7:25 pm, Chris Angelico ros...@gmail.com wrote: It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. He might. But this also has reputable use,

Re: An unusual question...

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 10:30:01 -0700, rusi wrote: [...] If you make it work (and prove Steve wrong :-) ) please post your how/ what/where here -- I'm always happy to be proven wrong. If I was right all the time, that would mean I'd run out of things to learn, and where's the fun in that? --

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Chris... It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. No, not even remotely close... ;o) Note that the idea works on an AMIGA without an MMU. The

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Sturla... He might. But this also has reputable use, such as implementing a JIT compiler. E.g. this is what Psyco and PyPy does. I`ll contact you privately... Gimme a bit of time to type a monologue... ;o) -- 73... Bazza, G0LCU... Team AMIGA... http://homepages.tesco.net/wisecracker/

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

2011-04-17 Thread Phil Winder
On Apr 17, 1:11 pm, Andrea Crotti andrea.crott...@gmail.com wrote: Phil Winder philipwin...@gmail.com writes: 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

Namespaces in functions vs classes

2011-04-17 Thread Gerald Britton
I apologize if this has been answered before or if it is easy to find in the docs. (I couldn't find it but might have missed it) I'm trying to understand the differences between namespaces in class definitions vs. function definitions. Consider this function: def a(): ... foo = 'foo' ...

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

2011-04-17 Thread Alexander Kapps
On 17.04.2011 20:40, Phil Winder wrote: Ok, thanks all. It's a little disappointing, but I guess that you always have to work in a different way when you move to a new language. Andrea's %edit method is probably the best compromise, but this now means that I will have to learn all the (obscure)

Re: Namespaces in functions vs classes

2011-04-17 Thread Chris Rebert
On Sun, Apr 17, 2011 at 12:30 PM, Gerald Britton gerald.brit...@gmail.com wrote: I apologize if this has been answered before or if it is easy to find in the docs. (I couldn't find it but might have missed it) I'm trying to understand the differences between namespaces in class definitions

Re: Python IDE/text-editor

2011-04-17 Thread Westley Martínez
On Sat, 2011-04-16 at 23:12 +, 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

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

2011-04-17 Thread Rajendra prasad Gottipati
Phil, there is one more way you can run all commands as in linux shell.. import commands s, o = commands.getstatusoutput('x=10;for i in $(seq $x); do echo $i ; done') print o 1 2 3 4 5 6 7 8 9 10 On Sun, Apr 17, 2011 at 11:40 AM, Phil Winder philipwin...@gmail.comwrote: On Apr 17, 1:11

Re: Python IDE/text-editor

2011-04-17 Thread Westley Martínez
On Sun, 2011-04-17 at 09:08 +1000, Chris Angelico wrote: On Sun, Apr 17, 2011 at 8:31 AM, Westley Martínez aniko...@gmail.com 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;

Re: Namespaces in functions vs classes

2011-04-17 Thread Ethan Furman
Gerald Britton wrote: However, I would like a deeper understanding of why I cannot use foo as an unqualified variable inside the method in the class. If Python allowed such a thing, what problems would that cause? 8 script with possible

Re: Python IDE/text-editor

2011-04-17 Thread Cameron Simpson
On 16Apr2011 10:59, Jorgen Grahn grahn+n...@snipabacken.se wrote: | On Sat, 2011-04-16, Alec Taylor wrote: | 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

Re: Namespaces in functions vs classes

2011-04-17 Thread Ethan Furman
Gerald Britton wrote: For my final attempt, I add the prefix a. to my use of foo class a(): ... foo = 'foo' ... def g(x): ... return a.foo ... The first parameter to any method in a class* is going to be the instance of that class, and is usually named 'self'. So your

Re: Python IDE/text-editor

2011-04-17 Thread egbert
In http://docs.python.org/using/unix.html#editors you can read: Geany is an excellent IDE with support for a lot of languages. For more information, read: http://geany.uvena.de/ I followed that suggestion, and am very happy with Geany. But I confess that I am not a sophisticated user. Why does

Re: Python IDE/text-editor

2011-04-17 Thread Ben Finney
Westley Martínez aniko...@gmail.com writes: On Sat, 2011-04-16 at 23:12 +, Krzysztof Bieniasz wrote: 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? :) […] No, it's not. Vim is THE way. Clearly

[ANN] Python 2.5.6 Release Candidate 1

2011-04-17 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm happy to announce the release candidate 1 of Python 2.5.6. This is a source-only release that only includes security fixes. The last full bug-fix release of Python 2.5 was Python 2.5.4. Users are encouraged to upgrade to the

Re: Python IDE/text-editor

2011-04-17 Thread Tim Chase
On 04/17/2011 04:19 PM, Ben Finney wrote: No, it's not. Vim is THE way. Clearly there is only one standard text editor, and that's ‘ed’ While it's funny, I'm curious how many folks on c.l.p have done any/much python coding in ed. I've had to do a bit on a router running an embedded Linux

Re: Feature suggestion -- return if true

2011-04-17 Thread Greg Ewing
D'Arcy J.M. Cain wrote: On Sun, 17 Apr 2011 16:21:53 +1200 Gregory Ewing greg.ew...@canterbury.ac.nz wrote: def get_from_cache(x): y = cache.get(x) if not y: y = compute_from(x) cache[x] = y return y I prefer not to create and destroy objects needlessly. How does

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

2011-04-17 Thread candide
Le 17/04/2011 11:46, Ben Finney a écrit : candidecandide@free.invalid writes: First because I was doubting the true interest of the bool() type. In fact, it appears that it's _semantically_ a shortcut for True if x else False. That bends my brain. Both ‘True’ and ‘False’ are instances of

Re: Feature suggestion -- return if true

2011-04-17 Thread James Mills
On Sun, Apr 17, 2011 at 8:03 PM, Martin v. Loewis mar...@v.loewis.de wrote: No, it can't be simplified in this way. If there is code after that snippet, then it will get executed in the original version if _temp is false, but won't get executed in your simplification. Martin, we've been over

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

2011-04-17 Thread Daniel Kluev
On Sun, Apr 17, 2011 at 8:38 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: 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

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

2011-04-17 Thread Ben Finney
candide candide@free.invalid writes: Le 17/04/2011 11:46, Ben Finney a écrit : What is the “shortcut” you refer to? bool(x) is nothing more than a shortcut for the following expression : True if x else False. We're going around in circles. I've already pointed out that ‘bool(x)’ is what

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

2011-04-17 Thread Gregory Ewing
candide wrote: bool(x) is nothing more than a shortcut for the following expression : True if x else False. It's a much shorter and easier-to-read shortcut. Also keep in mind that if-else expressions are quite a recent addition to the language. Before that, we had 'not not x' as another

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

2011-04-17 Thread Gregory Ewing
Chris Angelico wrote: Well, of course you can always implement bool as an int; Which Python used to do once upon a time -- and still does in a way, because bool is a subclass of int. The bool type was added mainly to provide a type that prints out as 'True' or 'False' rather than 1 or 0.

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

2011-04-17 Thread Steven D'Aprano
On Mon, 18 Apr 2011 01:22:59 +0200, candide wrote: What is the “shortcut” you refer to? bool(x) is nothing more than a shortcut for the following expression : True if x else False. Nothing more? That's completely incorrect. bool is a type object, not an expression, so you can do

Re: Feature suggestion -- return if true

2011-04-17 Thread Gregory Ewing
Steven D'Aprano wrote: I'm sure you realise that that snippet needlessly recalculates any cached result that happens to be false, but others reading might not. I only use it as written when I'm dealing with types that don't have false values. If I did need to cache such a type, I would use a

Re: An unusual question...

2011-04-17 Thread Rhodri James
On Sun, 17 Apr 2011 17:17:02 +0100, wisecrac...@tesco.net wrote: I`ll give you a clue... id(some_object) is close enough but NOT that close. You do realise that what id() returns is implementation-dependent, don't you? In particular, what IronPython returns isn't an address. -- Rhodri

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

2011-04-17 Thread Ben Finney
Daniel Kluev dan.kl...@gmail.com writes: Actually, as I was curious myself, I've checked sources and found that `True if x else False` will _not_ call bool(), it calls PyObject_IsTrue() pretty much directly. Sure. By ‘bool(x)’ I'm referring only to the implementation inside that constructor.

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

2011-04-17 Thread Chris Angelico
On Mon, Apr 18, 2011 at 10:22 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: types = [str, complex, float, bool] [f(x) for f, x in zip(types, (1, 2, 3, 4))] ['1', (2+0j), 3.0, True] I believe this one would work fine with a function defined as per OP - zip takes callables,

Re: Namespaces in functions vs classes

2011-04-17 Thread Richard Thomas
On Apr 17, 8:56 pm, Chris Rebert c...@rebertia.com wrote: On Sun, Apr 17, 2011 at 12:30 PM, Gerald Britton gerald.brit...@gmail.com wrote: I apologize if this has been answered before or if it is easy to find in the docs. (I couldn't find it but might have missed it) I'm trying

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

2011-04-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Daniel Kluev wrote: On Sun, Apr 17, 2011 at 8:38 AM, Ben Finneyben+pyt...@benfinney.id.au wrote: 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

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

2011-04-17 Thread Chris Angelico
On Mon, Apr 18, 2011 at 11:46 AM, Dave Angel da...@ieee.org wrote: bool = int Any language that allows you to do this is either awesome or terrifying. Come to think of it, there's not a lot of difference. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Angelico wrote: snip Sure. In my (somewhat contrived) example of factorials, that's going to be true (apart from 0! = 0); and if the function returns a string or other object rather than an integer, same thing. If there's the Just to be pedantic, by any

Re: Feature suggestion -- return if true

2011-04-17 Thread Chris Angelico
On Mon, Apr 18, 2011 at 12:04 PM, Dave Angel da...@ieee.org wrote: On 01/-10/-28163 02:59 PM, Chris Angelico wrote:  snip Sure. In my (somewhat contrived) example of factorials, that's going to be true (apart from 0! = 0); and if the function returns a string or other object rather than an

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

2011-04-17 Thread Daniel Kluev
On Mon, Apr 18, 2011 at 12:46 PM, Dave Angel da...@ieee.org wrote: He didn't say that the function will call the bool() type (constructor), but that it will use the bool type; Actually, he did say exactly that Any boolean expression is going to be _calling the built-in ‘bool’ type

Re: PYTHONPATH

2011-04-17 Thread harrismh777
Steven D'Aprano wrote: In my opinion, a better explanation for the difficulty faced by Windows users is that this is a side-effect of Windows starting life as a single-user operating system. Yes, that is my opinion as well. Windows for better or worse is plagued by cruft that dates back to

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

2011-04-17 Thread Ned Deily
Chris Angelico: Dave Angel: bool = int Any language that allows you to do this is either awesome or terrifying. Come to think of it, there's not a lot of difference. Even better: $ python2.7 -c 'False = True; print False' True Alas: $ python3 -c 'False = True; print(False)' File string,

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

2011-04-17 Thread Chris Angelico
On Mon, Apr 18, 2011 at 2:40 PM, Ned Deily n...@acm.org wrote: Chris Angelico:  Dave Angel: bool = int Any language that allows you to do this is either awesome or terrifying. Come to think of it, there's not a lot of difference. Even better: $ python2.7 -c 'False = True; print False'

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

2011-04-17 Thread Chris Rebert
On Sun, Apr 17, 2011 at 9:53 PM, Chris Angelico ros...@gmail.com wrote: On Mon, Apr 18, 2011 at 2:40 PM, Ned Deily n...@acm.org wrote: snip Even better: $ python2.7 -c 'False = True; print False' True http://bofh.ch/bofh/bofh13.html Alas: $ python3 -c 'False = True; print(False)'  File

[issue9041] raised exception is misleading

2011-04-17 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9041 ___ ___ Python-bugs-list

[issue11860] reference 2.3 has text that runs past the page

2011-04-17 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11860 ___ ___

[issue9896] Introspectable range objects

2011-04-17 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Now that the moratorium has already ended, I'll try again. I've updated the patch. It seems, that this idea has already came up in the past: Guido in msg70525 said: I also think ranges should be introspectable, exposing their start,

[issue11861] 2to3 fails with a ParseError

2011-04-17 Thread Vinay Sajip
New submission from Vinay Sajip vinay_sa...@yahoo.co.uk: 2to3 fails on boto/rds/__init__.py with a ParseError: vinay@eta-natty:~/tools/boto$ 2to3 boto/rds/__init__.py RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping

[issue11859] test_interrupted_write_text() of test_io failed of Python 3.3 on FreeBSD 7.2

2011-04-17 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Agreed with your analysis. The problem is that the signal module doesn't expose pthread_sigmask. We could grab Jean-Paul's implementation from http://bazaar.launchpad.net/~exarkun/python-signalfd/trunk/view/head:/signalfd/_signalfd.c (although

[issue11861] 2to3 fails with a ParseError

2011-04-17 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +benjamin.peterson, ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11861 ___

[issue11276] 2to3: imports fixer doesn't update references to modules specified without attributes

2011-04-17 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Another example: when processing if hasattr(httplib, 'ssl'): pass It doesn't spot that httplib should be changed to http.client. -- nosy: +vinay.sajip ___ Python tracker

[issue9762] PEP 3149 related build failures

2011-04-17 Thread Jan Groenewald
Jan Groenewald jan.groenew...@gmail.com added the comment: I am trying to build www.sagemath.org on ubuntu 10.04 natty beta 2 for amd64. Bear with me. Sage includes a patched version of python2.6.4, and it fails to build modules nis and crypt. Upstream python 2.6.4, 2.6.6, and 2.7.1 fail to

[issue9762] PEP 3149 related build failures

2011-04-17 Thread Jan Groenewald
Jan Groenewald jan.groenew...@gmail.com added the comment: Oops, correction. Ubuntu 11.04 beta 2 for amd64. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9762 ___

[issue10271] warnings.showwarning should allow any callable object

2011-04-17 Thread lekma
lekma lekma...@gmail.com added the comment: - split the patch between the actual fix and the test - rewrote the test a little bit (I'm not sure it's even needed, hence the split) - rediff against 3.3 (should still apply cleanly on top of 3.2 (modulo offset)) -- versions: +Python 3.3

[issue10271] warnings.showwarning should allow any callable object

2011-04-17 Thread lekma
Changes by lekma lekma...@gmail.com: Added file: http://bugs.python.org/file21695/Issue10271.33.test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10271 ___

[issue9762] PEP 3149 related build failures

2011-04-17 Thread Barry A. Warsaw
Barry A. Warsaw ba...@python.org added the comment: On Apr 17, 2011, at 01:46 PM, Jan Groenewald wrote: Jan Groenewald jan.groenew...@gmail.com added the comment: I am trying to build www.sagemath.org on ubuntu 10.04 natty beta 2 for amd64. Bear with me. As described in your follow up, the

[issue11849] ElementTree memory leak

2011-04-17 Thread Charles-Francois Natali
Charles-Francois Natali neolo...@free.fr added the comment: The problem is not with Python, but with your libc. When a program - such as Python - returns memory, it uses the free(3) library call. But the libc is free to either return the memory immediately to the kernel using the relevant

[issue11849] ElementTree memory leak

2011-04-17 Thread Charles-Francois Natali
Changes by Charles-Francois Natali neolo...@free.fr: -- keywords: +patch Added file: http://bugs.python.org/file21696/gc_trim.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11849 ___

[issue828450] sdist generates bad MANIFEST on Windows

2011-04-17 Thread higery
Changes by higery shoulderhig...@gmail.com: Removed file: http://bugs.python.org/file21691/change_path_separator_in_MANIFEST.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue828450 ___

  1   2   >