food for thought as noticed by a coworker who has been profiling some hot
code to optimize a library...
If a function does not have a return statement we return None. Ironically
this makes the foo2 function below faster than the bar2 function at least as
measured using bytecode size:
Python 2.6.2 (r262:71600, Jul 24 2009, 17:29:21)
[GCC 4.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> def foo(x):
... y = x()
... return y
...
>>> def foo2(x):
... return x()
...
>>> def bar(x):
... y = x()
...
>>> def bar2(x):
... x()
...
>>> dis.dis(foo)
2 0 LOAD_FAST 0 (x)
3 CALL_FUNCTION 0
6 STORE_FAST 1 (y)
3 9 LOAD_FAST 1 (y)
12 RETURN_VALUE
>>> dis.dis(foo2)
2 0 LOAD_FAST 0 (x)
3 CALL_FUNCTION 0
6 RETURN_VALUE
>>> dis.dis(bar)
2 0 LOAD_FAST 0 (x)
3 CALL_FUNCTION 0
6 STORE_FAST 1 (y)
9 LOAD_CONST 0 (None)
12 RETURN_VALUE
>>> dis.dis(bar2)
2 0 LOAD_FAST 0 (x)
3 CALL_FUNCTION 0
6 POP_TOP
7 LOAD_CONST 0 (None)
10 RETURN_VALUE
I realized that PyPI accepts MyOpenId and tried to login to the site.
In the process I get this message :
{{{
OpenID provider did not provide your email address
}}}
I mean, is it mandatory to provide the e-mail address in order to bind
a user to an OpenId ?
I'm curious : I'd like to know if there's a reason to do that.
Thnx in advance !
PS: I know is a little bit OT. Hope you dont mind ...
--
Regards,
Olemis.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Featured article:
Call for proposals -- PyCon 2010 -- <http://us.pycon.org/2010/>
===============================================================
Due date: October 1st, 2009
Want to showcase your skills as a Python Hacker? Want to have
hundreds of people see your talk on the subject of your choice? Have some
hot button issue you think the community needs to address, or have some
package, code or project you simply love talking about? Want to launch
your master plan to take over the world with python?
PyCon is your platform for getting the word out and teaching something
new to hundreds of people, face to face.
Previous PyCon conferences have had a broad range of presentations,
from reports on academic and commercial projects, tutorials on a broad
range of subjects and case studies. All conference speakers are volunteers
and come from a myriad of backgrounds. Some are new speakers, some
are old speakers. Everyone is welcome so bring your passion and your
code! We're looking to you to help us top the previous years of success
PyCon has had.
PyCon 2010 is looking for proposals to fill the formal presentation tracks.
The PyCon conference days will be February 19-22, 2010 in Atlanta,
Georgia, preceded by the tutorial days (February 17-18), and followed
by four days of development sprints (February 22-25).
Online proposal submission is open now! Proposals will be accepted
through October 1st, with acceptance notifications coming out on
November 15th. For the detailed call for proposals, please see:
<http://us.pycon.org/2010/conference/proposals/>
For videos of talks from previous years - check out:
<http://pycon.blip.tv>
We look forward to seeing you in Atlanta!
--
Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/
"Look, it's your affair if you want to play with five people, but don't
go calling it doubles." --John Cleese anticipates Usenet
For blender we have a number of types defined in the C/API like
meshes, lamps, metaballs, nurbs etc that dont make sense with some of
richcmp's operations.
A problem I have is that in python 3.1 the Py_CmpToRich function is removed.
Should we copy Py_CmpToRich into our source tree?
Otherwise we have fairly long cmp functions that have Py_CmpToRich inline.
For C extension writers what is the suggested method for comparing
types where Py_LT, Py_GT Py_GE etc are not useful?
Since people sometimes ask why use py3.1, we're doing a rewrite that
wont be ready for quite some time.
--
- Campbell
Hi All,
This is my first post to python-dev so I will briefly introduce myself: My name is Rob Cliffe and I am a commercial programmer living in London, UK. I have some 30 years of programming experience but have only been using Python for a couple of years.
First I want to say what a fantastic language Python is. It is THE best language for development in my opinion, and a joy to use.
My specific issue:
I eventually got my head round decorator syntax and realised that what came after the '@' was (basically) a function that took a function as argument and returned a function as result.
However it seems to me unPythonesque (i.e. an exception to Python's normal consistency) that the syntax of what follows the '@' should be restricted to either a single (function) identifier or a single (function) identifier with an argument list.
The example I tried, which seems not an unreasonable sort of thing to do, was along the lines of:
def deco1(func):
<deco1-suite>
def deco2(func):
<deco2-suite>
DecoList = [deco1, deco2]
@DecoList[0] # NO - CAUSES SYNTAX ERROR
def foo():
pass
I am sure other guys have their own examples.
I am of course not the first person to raise this issue, and I see that Guido has a "gut feeling" against allowing a general expression after the '@'.
BUT - a general expression can be "smuggled in" very easily as a function argument:
def Identity(x): return x
@Identity(DecoList[0]) # THIS WORKS
def foo():
pass
So - the syntax restriction seems not only inconsistent, but pointless; it doesn't forbid anything, but merely means we have to do it in a slightly convoluted (unPythonesque) way. So please, Guido, will you reconsider?
Best wishes
Rob Cliffe
Dear Developers,
I am a Ph.D student from Case Western Reserve University, specialized at
software engineering. Our recent approach analyzes bugs that are being
fixed in the issue database, and tries to discover any latent bug instances
that are the same as the fixed bug but are left unfixed. We have found some
spurious code in your project in this approach, and pointed out these code
by comments (sometimes also with patches) to the fixed bugs in the issue DB
from which it is discovered as follows:
Issue 6817: http://bugs.python.org/issue6817 (A new issue, created following
Amaury's comments)
Issue 2620: http://bugs.python.org/issue2620
Issue 3139: http://bugs.python.org/issue3139
Issue 5705: http://bugs.python.org/issue5705
We hope that we have discovered some real bugs for you. Any comments or
suggestions are GREATLY appreciated, since your opinions are very, very
precious to us.
Boya
--
BOYA SUN
Computer Science Division
Electrical Engineering & Computer Science Department
513 Olin Building
Case Western Reserve University
10900 Euclid Avenue
Cleveland, OH 44106
boya.sun(a)case.edu
I've just had a look on python.org, but couldn't immediately see a
pointer to instructions on what the process is to set up a buildbot.
There's a not on setting things up for pybots, but nothing on the core
buildbot setup.
The reason I'm asking is that I'm thinking of seeing if I could set up
a Windows buildbot of some sort, to offer extra coverage. It's early
days, yet, but I wonder if someone could answer a few questions for
me:
- Is there any documentation on how to set up a buildbot? If so, can
someone give me a pointer?
- What configurations would be most useful? (I've got a 64-bit PC, so
I can theoretically set up 32 or 64 bit VMs with VMWare, and with my
shiny new MSDN subscription, I can set up whatever OS is most useful).
- Is it possible to set up the pull/build/test side of the process
separately, before linking it into the full buildbot farm? That would
let me try things out on my own, and iron out any configuration
glitches before dumping it on the world.
Thanks for any pointers. It's early days yet, so it may be a while
before I have anything properly set up, but I'd like to see what I can
do.
Paul.
hi all:
In the svn thunk tree, I find in file Object/funcobject.c, the two
functions: sm_init and cm_init have a little different. the cm_init
function will check the object is really callable, but the sm_init
don't.
the code like this:
if (!PyCallable_Check(callable)) {
PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
callable->ob_type->tp_name);
return -1;
}
so when use staticmethod and classmethod on a class variable, there
are two different behavior.
class Test(object):
name = "s7v7nislands"
name = classmethod(Test.name) # will raise error.
name = staticmethod(Test.name) # will not raise error.
My idea is: here, the two functions (or maybe classes) should have the
same behavior).
so is this a bug or something I missing ?
thanks!
s7v7nislands
Hi all,
I'm working on http://bugs.python.org/issue6642 for unladen swallow
(because it happens to bite us in a weird way), and Jeff Yasskin told
me to ask python-dev what the proper behavior should be at exit from
the child process of a fork from a spawned thread.
Right now, it seems that there is an assumption that when exiting the
process, control will always return through Py_Main, which in turn
calls Py_Finalize, to do things like GC and calling atexit handlers.
Normally, if you fork a process from the main thread, this assumption
will remain true, because main and Py_Main are still at the bottom of
the stack in the child process. However, if you fork from a spawned
thread, then the root of the stack will be the thread bootstrap
routine for the platform's pythreads implementation.
On one hand, you may not want to call the user's atexit handlers
multiple times from different processes if they have externally
visible effects. On the other hand, people seem to assume that
Py_Finalize will be called at process exit to do various cleanups. On
the third hand, maybe Python could just clear out all the atexit
handlers in the child after a fork. So what should the correct
behavior be?
Thanks,
Reid
There is a standard for encrypting entire zip files. And I was looking at
the zip docs the other day and zipfile can already decrypt but not encrypt
(assuming my memory is accurate; doing this from my phone on vacation).
On Aug 23, 2009 2:10 PM, "Guido van Rossum" <guido(a)python.org> wrote:
On Sun, Aug 23, 2009 at 9:09 AM, Shashank Singh<
shashank.sunny.singh(a)gmail.com> wrote: > There is an...
MvL already asked for a patch so I suppose that means he thinks it's
useful. Personally I've never encountered an encrypted zipfile, so I
just have questions: is there a standard encryption algorithm? What is
encrypted? The entire file or individual members? How are you supposed
to give the password? Also, I suppose there could be (US) export
problems with the code, so it would have to be optional (and we might
not be able to build it into binaries we distribute from python.org).
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev(a)python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/brett%40python.org