Re: having both dynamic and static variables

2011-03-05 Thread Steven D'Aprano
On Thu, 03 Mar 2011 06:19:41 -0800, Westley Martínez wrote: > On Wed, 2011-03-02 at 19:45 -0800, Yingjie Lan wrote: >> Hi everyone, >> >> Variables in Python are resolved dynamically at runtime, which comes at >> a performance cost. However, a lot of times we don't need that feature. >> Variables

Re: having both dynamic and static variables

2011-03-05 Thread Steven D'Aprano
On Thu, 03 Mar 2011 08:52:16 -0800, Rafe Kettler wrote: >> Finally, Python 3 introduced type annotations, which are currently a >> feature looking for a reason. > > By type annotations, do you mean function annotations (see PEP 3107, > http://www.python.org/dev/peps/pep-3107/)? Or is this some ot

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
http://www.nga.gov/search/index.shtm http://deyoung.famsf.org/search-collections etc Seems they all offer search only by keywords and this kind. What about to submit e.g. roses2.jpg (copy) and to find its original? Assume we don't know its author neither its title -- http://mail.python.org/mailman

Re: having both dynamic and static variables

2011-03-05 Thread Carl Banks
On Mar 5, 7:46 pm, Corey Richardson wrote: > On 03/05/2011 10:23 PM, MRAB wrote: > > > Having a fixed binding could be useful elsewhere, for example, with > > function definitions: > > [..] > >      fixed PI = 3.1415926535897932384626433832795028841971693993751 > > >      fixed def squared(x): > >

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
On Mar 6, 6:10 am, Mel wrote: > n00m wrote: > > As for using color info... > > my current strong opinion is: the colors must be forgot for good. > > Paradoxically but "profound" elaboration and detailization can/will > > spoil/undermine the whole thing. Just my current imo. > > Yeah.  I guess incl

Re: having both dynamic and static variables

2011-03-05 Thread Santoso Wijaya
Shouldn't this go to python-ideas? Anyway, I'm partial to "static". ~/santa On Sat, Mar 5, 2011 at 8:33 PM, Westley Martínez wrote: > On Sat, 2011-03-05 at 18:37 -0800, John Nagle wrote: > > On 3/2/2011 9:27 PM, Steven D'Aprano wrote: > > > On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrot

Re: having both dynamic and static variables

2011-03-05 Thread John Nagle
On 3/5/2011 7:46 PM, Corey Richardson wrote: On 03/05/2011 10:23 PM, MRAB wrote: Having a fixed binding could be useful elsewhere, for example, with function definitions: [..] fixed PI = 3.1415926535897932384626433832795028841971693993751 fixed def squared(x): return x * x

Re: having both dynamic and static variables

2011-03-05 Thread Westley Martínez
On Sat, 2011-03-05 at 18:37 -0800, John Nagle wrote: > On 3/2/2011 9:27 PM, Steven D'Aprano wrote: > > On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote: > > > >> Hi everyone, > >> > >> Variables in Python are resolved dynamically at runtime, which comes at > >> a performance cost. However, a l

Re: ImSim: Image Similarity

2011-03-05 Thread Mel
n00m wrote: > As for using color info... > my current strong opinion is: the colors must be forgot for good. > Paradoxically but "profound" elaboration and detailization can/will > spoil/undermine the whole thing. Just my current imo. Yeah. I guess including color info cubes the complexity of th

Re: having both dynamic and static variables

2011-03-05 Thread Santoso Wijaya
A function object can get bound to a name, too: def foo(x): return x + 1 foo = lambda x: x - 1 assert foo(1) == 0 ~/santa On Sat, Mar 5, 2011 at 7:46 PM, Corey Richardson wrote: > On 03/05/2011 10:23 PM, MRAB wrote: > > Having a fixed binding could be useful elsewhere, for example, with

Re: having both dynamic and static variables

2011-03-05 Thread Corey Richardson
On 03/05/2011 10:23 PM, MRAB wrote: > Having a fixed binding could be useful elsewhere, for example, with > function definitions: > [..] > fixed PI = 3.1415926535897932384626433832795028841971693993751 > > fixed def squared(x): > return x * x This question spawns from my ignora

Re: having both dynamic and static variables

2011-03-05 Thread MRAB
On 06/03/2011 02:37, John Nagle wrote: On 3/2/2011 9:27 PM, Steven D'Aprano wrote: On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote: Hi everyone, Variables in Python are resolved dynamically at runtime, which comes at a performance cost. However, a lot of times we don't need that feature

Re: having both dynamic and static variables

2011-03-05 Thread Littlefield, Tyler
> It's worth having some syntax for constants. I'd suggest >using "let": >let PI = 3.1415926535897932384626433832795028841971693993751 in to many languages, let is just a setter. why not just const pye = 3.14... -- http://mail.python.org/mailman/listinfo/python-list

Re: Absolutely Insane Problem with Gmail

2011-03-05 Thread Littlefield, Tyler
>ourEmail = ' myemaila...@gmail.com' >ourEmail = ' q...@xxx.com' You redefine this twice. You also don't define a variable down lower. ># to_address = ourEmail, > from_address = ourEmail, > to_address = emailText, I could be wrong, but emailText isn't defined. Perhaps a better var

Re: having both dynamic and static variables

2011-03-05 Thread John Nagle
On 3/2/2011 9:27 PM, Steven D'Aprano wrote: On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote: Hi everyone, Variables in Python are resolved dynamically at runtime, which comes at a performance cost. However, a lot of times we don't need that feature. Variables can be determined at compile

One popular idea, for the christian louboutin salesfood family style. In t

2011-03-05 Thread shoesbuy
One popular idea, for the christian louboutin salesfood family style. In this type of party, all of the food is put on the table, in large record transfer, rather than focusing on a waiter to all guest personal plate of food. Family style service cannot be frowsty than traditional plating dinners,

Absolutely Insane Problem with Gmail

2011-03-05 Thread Victor Subervi
Hi; I have this code: #!/usr/bin/python import sys, os, string import cgitb; cgitb.enable() import cgi cwd = os.getcwd() dirs = string.split(cwd, '/') dirs = dirs[1:-1] backLevel = '/' + string.join(dirs, '/') sys.path.append(cwd) sys.path.append(backLevel) import string form = cgi.FieldStorage()

Re: having both dynamic and static variables

2011-03-05 Thread Gregory Ewing
BartC wrote: I got the impression the OP was talking about simply pinning down certain variables, so that a runtime name lookup (if that's in fact what Python does) was not necessary. A problem with this is that lexical name lookups are a relatively small proportion of the looking up that goe

Re: 2to3 and maketrans

2011-03-05 Thread Gregory Ewing
Martin v. Löwis wrote: Whether a GUI library is application programming or systems programming, I don't know. Neither do I, but it doesn't really matter. In my case the string is definitely text (although it will always be ascii) and therefore unicode is the right representation to use in 3.x.

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-05 Thread John Nagle
On 3/5/2011 12:05 PM, Paul Rubin wrote: Ravi writes: I can extend dictionary to allow for the my own special look-up tables. However now I want to be able to define multidimensional dictionary which supports look-up like this: d[1]['abc'][40] = 'dummy' Why do that anyway? You can use a tupl

Re: getting text out of an xml string

2011-03-05 Thread björn lundin
> Next time you need to extract some data from an xml file, please (for > your own good) don't do whatever you did in that code -- note that the > unicode equivalent of "<" is u"\u003c", NOT u"\u3c00"; I wasn't joking > when I said it had been FU. Is that perhaps the doing of going from littleEnd

Re: how to read the last line of a huge file???

2011-03-05 Thread Terry Reedy
On 3/5/2011 1:21 PM, tkp...@hotmail.com wrote: Thanks for the pointer. Yes, it is a text file, but the mystery runs deeper: I later found that it works perfectly as written when I run it from IDLE or the Python shell, but it fails reliably when I run it from PyScripter 2.4.1 (an open source Pytho

Re: how to read the last line of a huge file???

2011-03-05 Thread John Nagle
On 3/5/2011 10:21 AM, tkp...@hotmail.com wrote: Question: how do I use f.tell() to identify if an offset is legal or illegal? Read backwards in binary mode, byte by byte, until you reach a byte which is, in binary, either 0xxx 11xx You are then at the beginning of a

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-05 Thread Paul Rubin
Ravi writes: > I can extend dictionary to allow for the my own special look-up > tables. However now I want to be able to define multidimensional > dictionary which supports look-up like this: > > d[1]['abc'][40] = 'dummy' Why do that anyway? You can use a tuple as a subscript: d[1,'abc',40]

Re: What do I need to know in order to write a web application in python?

2011-03-05 Thread geremy condra
On Sat, Mar 5, 2011 at 3:49 AM, ErichCart ErichCart wrote: > Visual Python seems to be exactly what I want. But it doesn't seem > very popular. Perhaps it means that there are not many people who will > be able to help if I have problems with it. Also judging by the amount > of ads at visualpython

Re: What do I need to know in order to write a web application in python?

2011-03-05 Thread OKB (not okblacke)
Grumman wrote: > On 3/4/2011 16:48, ErichCart ErichCart wrote: >> >> In fact this doesn't necessary need to be web application. For >> example I have a friend who uses Delphi, and he can create all >> sorts of windows applications easily, like he can see the window >> on the screen and he can plac

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
PS For some reason they don't update the link to the last version. It's _20110306, here: http://sourceforge.net/projects/imsim/files/ I use Python 2.5 & PIL for Python 2.5 -- http://mail.python.org/mailman/listinfo/python-list

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
> > Is it better than this? > - scale each image to 100x100 > - go black&white in such a way that half the pixels are black > - XOR the images and count the mismatches It's *much* better but I'm not *much* about to prove it. > I'm sure there are better, > well-known algorithms. The best well

Re: how to read the last line of a huge file???

2011-03-05 Thread tkp...@hotmail.com
Thanks for the pointer. Yes, it is a text file, but the mystery runs deeper: I later found that it works perfectly as written when I run it from IDLE or the Python shell, but it fails reliably when I run it from PyScripter 2.4.1 (an open source Python IDE)! So I suspect there's a PyScripter issue l

Re: ImSim: Image Similarity

2011-03-05 Thread Jorgen Grahn
On Sat, 2011-03-05, Grigory Javadyan wrote: > At least you could've tried to make the script more usable by adding > the possibility to supply command line arguments, instead of editing > the source every time you want to compare a couple of images. > > On Sat, Mar 5, 2011 at 11:23 AM, n00m wrote:

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-05 Thread Peter Otten
Ravi wrote: > I found a solution here: > > http://parand.com/say/index.php/2007/07/13/simple-multi-dimensional- dictionaries-in-python/ > > Please tell how good is it? Follow the link to the cookbook and read Andrew Dalke's comment ;) To spell it out: >>> class D(dict): ... def __missing_

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-05 Thread Ravi
I found a solution here: http://parand.com/say/index.php/2007/07/13/simple-multi-dimensional-dictionaries-in-python/ Please tell how good is it? -- http://mail.python.org/mailman/listinfo/python-list

Extending dict (dict's) to allow for multidimensional dictionary

2011-03-05 Thread Ravi
I can extend dictionary to allow for the my own special look-up tables. However now I want to be able to define multidimensional dictionary which supports look-up like this: d[1]['abc'][40] = 'dummy' and if d[1] and d[1][abc] raise KeyError just create them. for d[1] I can override __getitem__

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
On Mar 5, 7:10 pm, Mel wrote: > n00m wrote: > > > I uploaded a new version of the subject with a > > VERY MINOR correction in it. Namely, in line #55: > > >     print '%12s %7.2f' % (db[k][1], db[k][0] / 3600.0,) > > > instead of > > >     print '%12s %7.2f' % (db[k][1], db[k][0] * 0.001,) > > > I

Re: ImSim: Image Similarity

2011-03-05 Thread Mel
n00m wrote: > > I uploaded a new version of the subject with a > VERY MINOR correction in it. Namely, in line #55: > > print '%12s %7.2f' % (db[k][1], db[k][0] / 3600.0,) > > instead of > > print '%12s %7.2f' % (db[k][1], db[k][0] * 0.001,) > > I.e. I normalized it to base = 100. > No

Re: ImSim: Image Similarity

2011-03-05 Thread n00m
I uploaded a new version of the subject with a VERY MINOR correction in it. Namely, in line #55: print '%12s %7.2f' % (db[k][1], db[k][0] / 3600.0,) instead of print '%12s %7.2f' % (db[k][1], db[k][0] * 0.001,) I.e. I normalized it to base = 100. Now the values of similarity can't be g

Re: What do I need to know in order to write a web application in python?

2011-03-05 Thread CM
On Mar 5, 6:49 am, ErichCart ErichCart wrote: > Regarding Boa constructor, it is very old, isn't it? The latest news > from this project date to the end of 2006. I don't expect it to > support python 3 any time soon. The website is incredibly out of date, but the last major update was July 2007.

RE: python xmp toolkit question

2011-03-05 Thread jyoung79
>In article <20110304161955.LI5T1.94538.root at cdptpa-web16-z02>, > wrote: >> Is anyone here using the Python XMP Toolkit? I'm trying to install >> this and having problems. >> > I have no experience with either but I would guess that the two > configure options are for building with Boost

Re: What do I need to know in order to write a web application in python?

2011-03-05 Thread Corey Richardson
On 03/05/2011 06:49 AM, ErichCart ErichCart wrote: > So, "Glade", is this what everybody uses? I mean programmers don't > just use text editors to make GUI applications, do they? I usually see people using Qt and QtDesigner over Gtk and Glade. And actually, yes, I'm sure lots of people besides me

Re: Problem with python 3.2 and circular imports

2011-03-05 Thread Rafael Durán Castañeda
Thank you for your answer Frank, I think I've found the problem. I was calling modules from inside subpackages, and I need to use them from outside, so I have package in PYTHONPATH. is that correct? But now I have another question: Can I execute an script inside subpackage1 importig modules from su

Re: Problems of Symbol Congestion in Computer Languages

2011-03-05 Thread Albert van der Horst
In article , Dotan Cohen wrote: >You miss the canonical bad character reuse case: = vs ==. > >Had there been more meta keys, it might be nice to have a symbol for >each key on the keyboard. I personally have experimented with putting >the symbols as regular keys and the numbers as the Shifted ver

Re: Generate PDF with Tamil font problem

2011-03-05 Thread Tom Zych
sathe...@e-ndicus.com wrote: >I am using python's reportlab to print some unicode Tamil characters > 'பே'. I added necessary unicode font to reportlab. But It > prints the output as 'ேப' (in reverse order). This issue > happens for multi-byte characters, whereas for character 'ப' is > printed a

Re: What do I need to know in order to write a web application in python?

2011-03-05 Thread ErichCart ErichCart
Visual Python seems to be exactly what I want. But it doesn't seem very popular. Perhaps it means that there are not many people who will be able to help if I have problems with it. Also judging by the amount of ads at visualpython.org, it also doesn't seem very serious. I looked into pyGTK, and I

Re: getting text out of an xml string

2011-03-05 Thread John Machin
On Mar 5, 8:57 am, JT wrote: > On Mar 4, 9:30 pm, John Machin wrote: > > > Your data has been FUABARred (the first A being for Almost) -- the > > "\u3c00" and "\u3e00" were once "<" and ">" respectively. You will > > Hi John, > >    I realized that a few minutes after posting.  I then realized th

Re: Problems of Symbol Congestion in Computer Languages

2011-03-05 Thread Xah Lee
On Mar 1, 3:40 pm, Chris Jones wrote: > At first it looks like something MS (Morgan Stanley..) dumped into the > OSS lap fifteen years ago and nobody ever used it or maintained it.. so > it takes a bit of digging to make it.. sort of work in current GNU/linux > distributions.. especially since it

Re: questions about multiprocessing

2011-03-05 Thread Vincent Ren
Got it. After putting commas, it works (The 'o' was a mistake when I posted, sorry about it ). Thanks to all of you :) On Mar 5, 5:12 pm, Dennis Lee Bieber wrote: > On Fri, 4 Mar 2011 20:08:21 -0800 (PST), Vincent Ren > declaimed the following in > gmane.comp.python.general: > > > Hello, every

Re: Fun with 'str' and 'bytes'

2011-03-05 Thread Frank Millman
On Mar 4, 6:40 pm, nn wrote: > On Mar 4, 7:32 am, "Frank Millman" wrote: > > > Hi all > > > I want to create a cookie containing a session id. In python 2.6 I had the > > following - > > > from __future__ import unicode_literals > > session_id = b64encode(urandom(20)) > > response_headers.append(

Re: ImSim: Image Similarity

2011-03-05 Thread Grigory Javadyan
At least you could've tried to make the script more usable by adding the possibility to supply command line arguments, instead of editing the source every time you want to compare a couple of images. On Sat, Mar 5, 2011 at 11:23 AM, n00m wrote: > Let me present my newborn project (in Python) ImSi