Re: Problem with python 3.2 and circular imports

2011-03-06 Thread Frank Millman


Rafael Durán Castañeda rafadurancastan...@gmail.com wrote...


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 subpackage2?


Hi Rafael

I am no expert, so I cannot answer you directly.

In my case, my program started as a single module.

As it grew, I started to split some parts off and store them in separate 
modules in the same directory. I placed 'import' statements in the main 
module, and it worked.


Then I found the need for some modules to refer to objects in other modules, 
so I needed 'import' statements within the modules. I found myself hitting 
problems with circular imports from time to time, but with some help from 
this group and re-reading the docs I got over this hurdle.


Only recently has my project got big enough to start thinking about 
packages. It adds complexity, but by reading the docs again, and thinking 
carefully about the structure, I have so far managed to handle the problems 
that occur.


I found the 'modules' chapter in the tutorial a good place to start. Once 
you have fully grasped the contents, PEP 328 is a good resource for 
understanding what has changed in python 3.x.


BTW, this group prefers 'bottom posting'. You will see that I have placed my 
response below yours. If you want to reply to this, please follow the same 
practice.


Hope this helps to get you started.

Frank


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


Re: having both dynamic and static variables

2011-03-06 Thread Steven D'Aprano
On Sat, 05 Mar 2011 20:33:49 -0800, Westley Martínez wrote:

 On Sat, 2011-03-05 at 18:37 -0800, John Nagle wrote:
 It's worth having some syntax for constants.  I'd suggest
 using let:

+1 on syntax for constants. -0 for let. I'd prefer something more 
explicit, like const.

 I'm against constants, for the purpose of programmers should be smart
 enough to not set a variable to another value that should be static,

Most programmers are smart enough not to rebind names which should be 
constant. The problem is, how do you know which names should be constant?

A naming convention like ALL_CAPITALS helps, but not everybody sticks to 
the convention. Also, if constants are enforced by the compiler, that 
opens the door for many optimizations that currently Python can't do even 
in principle.



 but if Python were to have constants I think it would be better to use
 something more descriptive than 'let'. Also, because the defined
 constant is static, I think it would be better to use 'is' instead of
 '='. Example:

No, we're talking about assignment, not a comparison operator. The `is` 
operator is equivalent to `==`, equals, not assignment.


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


Re: I'm happy with Python 2.5

2011-03-06 Thread Steven D'Aprano
On Thu, 03 Mar 2011 11:43:12 -0700, Ian Kelly wrote:

 On Sun, Feb 27, 2011 at 7:15 AM, n00m n...@narod.ru wrote:
 http://www.spoj.pl/problems/TMUL/

 Python's print a * b gets Time Limit Exceeded.
 
 If speed is the only thing you care about, then you can forget about
 fretting over whether 2.5 or 3.1 is faster.  You're using the wrong
 language to begin with.

Surely that depends on whether you care about execution speed or 
development speed.



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


c++ data types in python script

2011-03-06 Thread Arthur Mc Coy
Hi people,

I've used SWIG module to embed python inside c++ app. I pass a list of
objects (with lots of different properties of types string, float,
custom types like URL, Software and finally of list of strings).

Now I'm in python. URL and Software has str() method that converts
their value to string recognizable by JSON. But the problem is with
list of strings.

So, as I said I passed std::liststd::string myObjects to python
function.
Then I iterate it and for each object in myObjects I create a python
copy (serialize it) to be able to put into JSON format and store in
appropriate file.

object has property benchmarks of type liststring.
I do:
...
class PythonObject:
def __init__(self, object):
self.benchmarks = list()
for s in object.benchmarks:
self.benchmarks.append(s)
...
and it fails, also I do:
...
class PythonObject:
def __init__(self, object):
self.benchmarks = [unicode(s) for s in object.benchmarks]
...
and it fails, also I do:
...
class PythonObject:
def __init__(self, object):
for s in object.benchmarks:
print s[0] + s[1] + s[2]
print type(s)
...
and it fails printing
   wor
   type 'str'
   Segmentation fault (core dumped)
$
also I do:
...
class PythonObject:
def __init__(self, object):
self.benchmarks = unicode(object.benchmarks)
...
and it does not fail, instead it puts in JSON this string:
...
benchmarks: mymodule.StringList; proxy of Swig Object of type
'std::list std::string, std::allocator std::string   *' at
0xb63ed4e8,
...
but it is not what I need

What I'm trying to stress is that c++ objects should be converted
(serialized) before putting them into json. Otherwise type errors
occur and process fails.


I love learning python and hope somebody may suggest me or tell
something.

Thank you all anyway!

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


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

2011-03-06 Thread ErichCart ErichCart
QT Designer looks very nice.
I hope I can use it with PySide. I would rather use PySide than PyQT,
because PyQT is not under LGPL license.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: c++ data types in python script

2011-03-06 Thread Arthur Mc Coy
Great!

The solution is to use self.benchmarks = list(object.benchmarks).

Now I'm battling with time_t type. C++ time_t converts to python int
but it causes memore leaks due to destructor absence. I'm trying to
figure it out. If anyone know, please share your thoughts.

Be happy :)

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


下载 below Download, in python.org site menu

2011-03-06 Thread Alex Willmer
On the English version of http://python.org I'm seeing 下载 as a menu
item between Download and Community. AFAICT it's Simplified Chinese
for 'download'. Is it's appearance intentional, or a leak through from
a translation of the entire page?

Regards, Alex

PS Tested with 10.0.648.114 (75702) and Firefox 3.6.14 on Ubuntu 10.10/
en_GB locale.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 下载 below Download, in python.org site menu

2011-03-06 Thread Martin v. Loewis
Am 06.03.2011 12:18, schrieb Alex Willmer:
 On the English version of http://python.org I'm seeing 下载 as a menu
 item between Download and Community. AFAICT it's Simplified Chinese
 for 'download'. Is it's appearance intentional, or a leak through from
 a translation of the entire page?

It's intentional. Notice that it goes to a different URL than the
English download link. Chinese readers will know when to use it.

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


Re: I'm happy with Python 2.5

2011-03-06 Thread Tom Zych
Steven D'Aprano wrote:
 On Thu, 03 Mar 2011 11:43:12 -0700, Ian Kelly wrote:
 If speed is the only thing you care about, then you can forget about
 fretting over whether 2.5 or 3.1 is faster.  You're using the wrong
 language to begin with.

 Surely that depends on whether you care about execution speed or 
 development speed.

s/care/care more/. People generally care about both to /some/ extent.
(Probably being over-pedantic again...)

-- 
Tom Zych / freethin...@pobox.com
Would you like a lovely fluffy little white rabbit, little girl,
or a cutesy wootesly little brown rabbit?
Actually, I don't think my python would notice.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2011-03-06 Thread Ravi
That's a very nice suggestion. Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Absolutely Insane Problem with Gmail

2011-03-06 Thread Victor Subervi
On Sat, Mar 5, 2011 at 11:11 PM, Littlefield, Tyler ty...@tysdomain.comwrote:

 ourEmail = '
 myemaila...@gmail.com'

 ourEmail = '
 q...@xxx.com'

   You redefine this twice.


Right. The second definition, of course, overwrites the first. That is
deliberate. I simply comment out the second when I'm testing. The second is,
of course, bogus. But it works while the first doesn't!!! WHY???


 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.


No, in fact, emailText *is* defined. And it, too, works, *unless* it's going
to a gmail address!! In fact, I just now tested it, commenting out the
second bogus email address, and using another gmail address but different
than the one defined as ourEmail, and everything works as expected.
Therefore, it appears that gmail, for whatever reason, filters out emails
send to the same address from which they are sent.
Thanks,
Beno
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2011-03-06 Thread John Pinner
On Mar 5, 7:42 pm, geremy condra debat...@gmail.com wrote:
 On Sat, Mar 5, 2011 at 3:49 AM, ErichCart ErichCart erichc...@gmail.com 
 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.org, it also doesn't seem very serious.

  I looked into pyGTK, and I found something called Glade, which seems
  to be something similar to visual python. The latest version of Glade
  was released just this month, so it seems to be actively developed.

  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.

  So, Glade, is this what everybody uses? I mean programmers don't
  just use text editors to make GUI applications, do they?

 Yes, they do. It isn't that bad once you get used to it,

Agreed.

 and it beats
 the snot out of trying to maintain the insensible gibberish that some
 of the autogen tools put out.

I have a lot of experience with Qt Designer, I don't know about any of
the other tools:

1. Qt Designer produces sensible well-formed XML, not gibberish.
2. The whole point of the tool is that you should _never_ have to edit
the code it
   produces - if you need to extend ui designs, you do this by sub-
classing.

 On a side note, you should check out pygui[0]- very, very nice GUI toolkit.

Yay, looks good. Thanks, Greg.

John
--

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


How Translate This PHP

2011-03-06 Thread Victor Subervi
Hi;
How do I translate this PHP code?

if($ok){
echo returnValue=1;
}else{
echo returnValue=0;
}

In other words, when the email successfully sends, send back both the name
of the variable and its value.
TIA,
Beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How Translate This PHP

2011-03-06 Thread Noah Hall
On Sun, Mar 6, 2011 at 2:45 PM, Victor Subervi victorsube...@gmail.com wrote:
 Hi;
 How do I translate this PHP code?

 if($ok){
     echo returnValue=1;
 }else{
     echo returnValue=0;
 }

From the code provided -

if ok:
print 'returnValue=1'
else:
print 'returnValue=0'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How Translate This PHP

2011-03-06 Thread Victor Subervi
On Sun, Mar 6, 2011 at 10:53 AM, Noah Hall enali...@gmail.com wrote:

 On Sun, Mar 6, 2011 at 2:45 PM, Victor Subervi victorsube...@gmail.com
 wrote:
  Hi;
  How do I translate this PHP code?
 
  if($ok){
  echo returnValue=1;
  }else{
  echo returnValue=0;
  }

 From the code provided -

 if ok:
print 'returnValue=1'
 else:
print 'returnValue=0'


Ah. I thought I had to return something! Thanks,
Beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How Translate This PHP

2011-03-06 Thread Littlefield, Tyler

How do I translate this PHP code?
if($ok){
echo returnValue=1;
}else{
echo returnValue=0;
}
print(return value = +str(ok));
--
http://mail.python.org/mailman/listinfo/python-list


Re: How Translate This PHP

2011-03-06 Thread Noah Hall
On Sun, Mar 6, 2011 at 3:11 PM, Victor Subervi victorsube...@gmail.com wrote:
 Ah. I thought I had to return something!

Well, based on what you asked, you would've, but based on the code,
all it was doing is printing returnValue - value

Of course, a better way of doing it would be to use formatting -

For example,

print 'returnValue=%d' % ok
-- 
http://mail.python.org/mailman/listinfo/python-list


python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Hi all,


Ok, I managed to work with c++ data types in python and can store
serialize c++ objects to store in json.

Now the task is backward. I wrote a c++ code to get the list of
objects using again python interface. The list of objects is returned.
PyList.

But I can't see how to convert PyObject as element of PyList to c++
data type or even how to convert or iterate PyList which is PyObject
too.


Please, whisper me the proper way I will go for.
Be happy :)

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


Re: ImSim: Image Similarity

2011-03-06 Thread n00m
Obviously if we'd use it in practice (in a web-museum ?)
all pic's matrices should be precalculated only once and
stored in a table with fourty fields v00 ... v93 like:

---
pic_title  v00v01v02... v93
---
bears2.jpg1234   4534   8922... 333
...
...
---

Then SQL query will look like this:

select top 3 pic_title from table
order by
abs(v00 - w[0][0]) +
abs(v01 - w[0][1]) +
... +
abs(v93 - w[9][3])

here w[][] is the matrix of a newly-entering picture.


P.S.
If someone will encounter 2 apparently unrelated pics
but for which ImSim gives value of their mutual diff.
*** less than 20% *** please emailed them to me.

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


Re: I'm happy with Python 2.5

2011-03-06 Thread Michael Torrie
On 02/27/2011 06:57 AM, n00m wrote:
 Steve, see a list of accepted langs there, in bottom dropdown:
 http://www.spoj.pl/submit/ There *was* Python 2.6.
 Then admins shifted back to 2.5. People vote by their legs.

rr, is that you?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python data types in c++ code

2011-03-06 Thread Stefan Behnel

Arthur Mc Coy, 06.03.2011 17:40:

Ok, I managed to work with c++ data types in python and can store
serialize c++ objects to store in json.

Now the task is backward. I wrote a c++ code to get the list of
objects using again python interface. The list of objects is returned.
PyList.

But I can't see how to convert PyObject as element of PyList to c++
data type or even how to convert or iterate PyList which is PyObject
too.

Please, whisper me the proper way I will go for.


You mentioned using SWIG, but I'd actually suggest using Cython instead. It 
will make it a lot easier (and faster) for you to convert data types 
between Python and C/C++ (and will also allow you to skip over most 
ref-counting problems). Since you appear to know C++ anyway, you should be 
able to get comfortable with it quite quickly.


http://cython.org

Stefan

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


Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Ok people,


I do:
for (Py_ssize_t i = 0; i PyList_Size(py_list); ++i) {
 PuObject* obj = PyList_GetItem(py_list, i);
 if (obj != NULL) {
   // howto get obj properties of different types
(map, list, string, int, bool) ?
 }
}

Very clear code. The question is in the comment :)
Let's play more,
it's like jazz,
let's explore,
Baby baby baby bass


Keep yourselves,
Arthur
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Stefan, great suggestion !!

I will definitely bookmark this page and consider later. But my
project dictate me use SWIG. I'm almost near the happy subend. Very
curios on question I asked in previous message.

Dear all, I love you too much :)

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


Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Stephan, you are lead developer over there :))) It's marketing,
however very nice solution.. I will propose my bosses to rediscover
their world assumptions. You know, they are still using SVN, they are
very loosely coupled to the past. I have to wash their brains...

Meantime still battling with PyObject properties which are so diverse
and disperse that I don't know...


Keep talking guys


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


Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
In short, the answer is to use PyObject dictionary ?
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2011-03-06 Thread Dan Stromberg
On Fri, Mar 4, 2011 at 6:07 PM, Paul Rubin no.email@nospam.invalid wrote:

 ErichCart ErichCart erichc...@gmail.com writes:
  By real-time, I mean that I want it to be similar to the way instant
  online chess works. Something like here: instantchess.com, but for
  RISK.

 If you want to do that in a web browser, the main technique for it is
 called AJAX and you'd write your application in Javascript.


Pyjamas could probably do this nicely.

It's a python - javascript translator, along with a set of widgets that
allow you to write AJAX web interfaces and desktop applications - from the
same codebase, just a different runtime.  The feel of such coding is
purportedly very much like writing a desktop application.

Only thing is, the tests don't currently work that well in Google Chrome.
But for Firefox and IE, it's already supposed to be pretty good.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python data types in c++ code

2011-03-06 Thread Stefan Behnel

Arthur Mc Coy, 06.03.2011 19:07:

Stephan, you are lead developer over there :))) It's marketing,


Let's say, as a core developer of Cython, I'm well aware of it's virtues, 
and I can tell you that my suggestion is actually well backed by the user 
feedback we get. You will find some of it on the right side of cython.org. 
The selection there is obviously biased, but I can confirm that it really 
matches with most of the non-technical feedback we get. Cython has a lot of 
happy users, and that's very rewarding to its core developers.


Stefan

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


Re: ImSim: Image Similarity

2011-03-06 Thread John Bokma
n00m n...@narod.ru writes:

 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

Title: TinEye, author: http://ideeinc.com/
Search: http://www.tineye.com/

Example: 
  http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/

Notice how it finds modified images.

-- 
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: I'm happy with Python 2.5

2011-03-06 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 10:43 AM, Ian Kelly ian.g.ke...@gmail.com wrote:

 On Sun, Feb 27, 2011 at 7:15 AM, n00m n...@narod.ru wrote:
  http://www.spoj.pl/problems/TMUL/
 
  Python's print a * b gets Time Limit Exceeded.

 If speed is the only thing you care about, then you can forget about
 fretting over whether 2.5 or 3.1 is faster.  You're using the wrong
 language to begin with.


Actually, in my current project, Pypy's performance is bordering on
stellar.  It's much faster than CPython 2.x, CPython 3.x, CPython
2.x+Cython, CPython 3.x+Cython, CPython 2.x+Psyco or Jython.  Interestingly,
CPython 3.x+Cython (pyx) is the next best.

I've placed a graph contrasting Python runtime performance for this project
at http://stromberg.dnsalias.org/~dstromberg/backshift/

Yes, of course, this is just for this one project, and only for this
project's critical section (which I'm optimizing relatively early to
decrease the duration of my lengthy tests).  Yours would almost certainly
give a different graph.

The problem being solved is a byte-at-a-time variable-length,
shift-resistant blocking (checksum).

BTW, about runtime vs compiler optimization: A JIT can theoretically give
better performance than an optimizing compiler, because the optimizing
compiler only has access to compile-time info, while the JIT has access to
what's really happening, as it happens - so for example, branch prediction
can be more accurate with the JIT, once you burn past the JIT'ing overhead.
-- 
http://mail.python.org/mailman/listinfo/python-list


new to python, trying to choose a book.

2011-03-06 Thread sogeking99
hey. been looking into book for learning python(or what ever resource
really) two books are frequently recommended, learn python the hard
way and think python. i have also been recommended dive into python by
one person, who said it was fantastic. but another person said it was
dated and even when it was made, it wasn't very good.

i have some experience with programming (not much) i know the basics
of java like control flow and inheritance. but thats about it

is head first python a good book? i quite liked what i read of head
first python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm happy with Python 2.5

2011-03-06 Thread geremy condra
On Sun, Feb 27, 2011 at 6:27 AM, Tom Zych freethin...@pobox.com wrote:
 n00m wrote:
 Am I turmoiling your wishful thinking?
 You may nourish it till the end of time.

 Let us cease to nourish those fabled ones who dwell under bridges.

+1 QOTW.

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


Re: ImSim: Image Similarity

2011-03-06 Thread n00m
On Mar 6, 8:55 pm, John Bokma j...@castleamber.com wrote:
 n00m n...@narod.ru writes:
 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

 Title: TinEye, author:http://ideeinc.com/
 Search:http://www.tineye.com/

 Example:
  http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/

 Notice how it finds modified images.

 --
 John Bokma                                                               j3b

 Blog:http://johnbokma.com/   Facebook:http://www.facebook.com/j.j.j.bokma
     Freelance Perl  Python Development:http://castleamber.com/


It's for kids.
Such trifles can easily be cracked by e.g. Jorgen Grahn's algo (see
his message)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
On Mar 6, 7:25 pm, Michael Torrie torr...@gmail.com wrote:
 On 02/27/2011 06:57 AM, n00m wrote:

  Steve, see a list of accepted langs there, in bottom dropdown:
 http://www.spoj.pl/submit/There *was* Python 2.6.
  Then admins shifted back to 2.5. People vote by their legs.

 rr, is that you?

Are you asking me?
If so, my account there is http://www.spoj.pl/users/zzz/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ImSim: Image Similarity

2011-03-06 Thread n00m
On Mar 6, 10:17 pm, n00m n...@narod.ru wrote:
 On Mar 6, 8:55 pm, John Bokma j...@castleamber.com wrote:



  n00m n...@narod.ru writes:
  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

  Title: TinEye, author:http://ideeinc.com/
  Search:http://www.tineye.com/

  Example:
   http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/

  Notice how it finds modified images.

  --
  John Bokma                                                               j3b

  Blog:http://johnbokma.com/  Facebook:http://www.facebook.com/j.j.j.bokma
      Freelance Perl  Python Development:http://castleamber.com/

 It's for kids.
 Such trifles can easily be cracked by e.g. Jorgen Grahn's algo (see
 his message)


Even his algo will be an overhead.
Comparing meta-data/EXIF of image files will be enough in 99% cases.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
PS
The winner (just a schoolboy) of IOI 2009 lives in my town,
not very far from my house. I'm proud to have such a neibour.
His account on spoj: http://www.spoj.pl/users/tourist/
Of course he's also registered on many other online judge systems,
incl. www.topcoder.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: having both dynamic and static variables

2011-03-06 Thread Westley Martínez
On Sun, 2011-03-06 at 07:58 +, Steven D'Aprano wrote:
 On Sat, 05 Mar 2011 20:33:49 -0800, Westley Martínez wrote:
 
  On Sat, 2011-03-05 at 18:37 -0800, John Nagle wrote:
  It's worth having some syntax for constants.  I'd suggest
  using let:
 
 +1 on syntax for constants. -0 for let. I'd prefer something more 
 explicit, like const.
 
  I'm against constants, for the purpose of programmers should be smart
  enough to not set a variable to another value that should be static,
 
 Most programmers are smart enough not to rebind names which should be 
 constant. The problem is, how do you know which names should be constant?
 
 A naming convention like ALL_CAPITALS helps, but not everybody sticks to 
 the convention. Also, if constants are enforced by the compiler, that 
 opens the door for many optimizations that currently Python can't do even 
 in principle.
 
 
 
  but if Python were to have constants I think it would be better to use
  something more descriptive than 'let'. Also, because the defined
  constant is static, I think it would be better to use 'is' instead of
  '='. Example:
 
 No, we're talking about assignment, not a comparison operator. The `is` 
 operator is equivalent to `==`, equals, not assignment.
 
 
 -- 
 Steven
I'm confused. Can someone tell me if we're talking about constant as in
'fixed in memory' or as in 'you can't reassign' or both?

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


Re: ImSim: Image Similarity

2011-03-06 Thread John Bokma
n00m n...@narod.ru writes:

 On Mar 6, 10:17 pm, n00m n...@narod.ru wrote:
 On Mar 6, 8:55 pm, John Bokma j...@castleamber.com wrote:



  n00m n...@narod.ru writes:
  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

  Title: TinEye, author:http://ideeinc.com/
  Search:http://www.tineye.com/

  Example:
   http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/

  Notice how it finds modified images.

  --
  John Bokma                                                               
  j3b

  Blog:http://johnbokma.com/  Facebook:http://www.facebook.com/j.j.j.bokma
      Freelance Perl  Python Development:http://castleamber.com/

 It's for kids.
 Such trifles can easily be cracked by e.g. Jorgen Grahn's algo (see
 his message)


 Even his algo will be an overhead.
 Comparing meta-data/EXIF of image files will be enough in 99% cases.

Yes, yes, we get it. You're so much smarter (but not smart enough to not
quote a signature...). Anyway, I guess that's the reason big names use
tineye and not your algorithm...

-- 
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: new to python, trying to choose a book.

2011-03-06 Thread Westley Martínez
On Sun, 2011-03-06 at 11:21 -0800, sogeking99 wrote:
 hey. been looking into book for learning python(or what ever resource
 really) two books are frequently recommended, learn python the hard
 way and think python. i have also been recommended dive into python by
 one person, who said it was fantastic. but another person said it was
 dated and even when it was made, it wasn't very good.
 
 i have some experience with programming (not much) i know the basics
 of java like control flow and inheritance. but thats about it
 
 is head first python a good book? i quite liked what i read of head
 first python.
I tried to read Dive into Python; it was boring.

Firstly, there's the official Python tutorial, which I've only glanced
over.

Swaroop C H's A Byte of Python was the (e)book I read to learn
programming. It's incredibly simple, which is why it's fantastic.

For a more comprehensive tour of Python, I like Mark Lutz's books.

I'm sure there are other great books, but that's all I've read on Python
so far.

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


Re: new to python, trying to choose a book.

2011-03-06 Thread Brandon LaRocque
I'd suggest Zed Shaw's amazing Learn Python The Hard Way [1] (which
isn't as hard as it sounds) - and it's free over the web (but, I
believe - you can buy a copy). I dislike Pilgrim's Dive Into Python,
but that's just me (though I thoroughly recommend Dive Into HTML5 to
anyone interested in HTML5) - many disagree. Haven't read Head First
Python.

[1] - http://learnpythonthehardway.org/index

On Sun, Mar 6, 2011 at 2:21 PM, sogeking99 neilalt300...@gmail.com wrote:
 hey. been looking into book for learning python(or what ever resource
 really) two books are frequently recommended, learn python the hard
 way and think python. i have also been recommended dive into python by
 one person, who said it was fantastic. but another person said it was
 dated and even when it was made, it wasn't very good.

 i have some experience with programming (not much) i know the basics
 of java like control flow and inheritance. but thats about it

 is head first python a good book? i quite liked what i read of head
 first python.
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: ImSim: Image Similarity

2011-03-06 Thread n00m

As for proper quoting: I read/post to this group via my web-browser.
And for me everything looks OK. I don't even quite understand what
exactly
do you mean by your remark. I'm not a facebookie/forumish/twitterish
thing.
Btw I don't know what is the twitter. I don't need it, neither to know
nor
to use it. Oh... Pres. Medvedev knows what is the twitter and uses it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fun with 'str' and 'bytes'

2011-03-06 Thread Nicholas Devenish

On 04/03/2011 16:40, nn wrote:

As far as I know, that is pretty much it. Also see:

http://bugs.python.org/issue3982


That is a depressing bug report, and really comes across as people who 
don't use networking commenting on the requirements of people who write 
networking code.


It's good to see that the idea was getting a bit more treatment last yeat.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is the best book to learn Python from Perl and C++ background

2011-03-06 Thread Nicholas Devenish

On 04/03/2011 17:49, Ignoramus20691 wrote:

I bought a Hello World! book for my 9 year old son. The book teached
programming for kids and it does it in Python.

I do not know any Python, but I am very comfortable with C++ and perl.
I wrote a little over 100k lines of perl.

I want to learn Python quickly to help him with his studies/fun.

I would prefer a no shit book that quickly teaches a language to
programmers.


I moved to python after a heavy C++ background - I boosted myself to 
self-supporting status with OReilleys Learning Python on and off over 
the course of a weekend, skipping the parts that looked familiar.


For some reason I didn't use the official python tutorial, though I have 
used it as a semi-reference on occasion since - it might be a good idea 
to start with that and see if it is efficient enough for you.

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


Re: my computer is allergic to pickles

2011-03-06 Thread Bob Fnord
Miki Tebeka miki.teb...@gmail.com wrote:

  I'm using python to do some log file analysis and I need to store
  on disk a very large dict with tuples of strings as keys and
  lists of strings and numbers as values.
 I recommend that you'll use the shelve module. It stores data on disk and is 
 more memory efficient than in-memory pickle objects.

OK, I got this to work with marshal. What makes shelve better?

Or, which situations does shelve suit better and which does
marshal suit better?

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


Re: ImSim: Image Similarity

2011-03-06 Thread John Bokma
n00m n...@narod.ru writes:

 As for proper quoting: I read/post to this group via my web-browser.
 And for me everything looks OK. I don't even quite understand what
 exactly
 do you mean by your remark. I'm not a facebookie/forumish/twitterish
 thing.

Exactly. It's Usenet, something I've been using for, oh, just over 20
years now, and even then it was not new. You know, before the web thing
you're talking about...

-- 
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


Cluto like library for Python

2011-03-06 Thread Ravi
I like Cluto as a data clustering software a lot. But its library binding is 
available only in C.

Is there any python library which is similar to Cluto?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: having both dynamic and static variables

2011-03-06 Thread Gregory Ewing

John Nagle wrote:


let allows the usual optimizations - constant folding, hoisting
out of loops, compile time arithmetic, unboxing, etc.


Only if the compiler knows the value of the constant,
which it won't if it's defined in a different module.

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


Re: 下载 below Download, in python.org site menu

2011-03-06 Thread Terry Reedy
On 3/6/2011 6:42 AM, Martin v. Loewis wrote:
 Am 06.03.2011 12:18, schrieb Alex Willmer:
 On the English version of http://python.org I'm seeing 下载 as a menu
 item between Download and Community. AFAICT it's Simplified Chinese
 for 'download'. Is it's appearance intentional, or a leak through from
 a translation of the entire page?
 
 It's intentional. Notice that it goes to a different URL than the
 English download link.

Which is a synonym for the English download link (/getit is /download at
present)
Perhaps a translated page is planned?

 Chinese readers will know when to use it.

Why a special link just for Chinese and not several other languages?

-- 
Terry Jan Reedy


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


Re: Fun with 'str' and 'bytes'

2011-03-06 Thread Terry Reedy

On 3/6/2011 4:55 PM, Nicholas Devenish wrote:

On 04/03/2011 16:40, nn wrote:

As far as I know, that is pretty much it. Also see:

http://bugs.python.org/issue3982


That is a depressing bug report, and really comes across as people who
don't use networking commenting on the requirements of people who write
networking code.

It's good to see that the idea was getting a bit more treatment last yeat.


I added the following note to that issue.

struct.pack, not mentioned here, is a binary bytes formatting function. 
It can do ascii bytes mixed with binary octets. It works the same in 
Python 2 and 3.


Str.bytes does two things: convert objects to strings according to the 
contents of field specifiers; interpolate the resulting strings into a 
template string according to the locations of the field specifiers. If 
desired bytes represent encoded text, then encoding computed text is the 
obvious Py3 solution.


For some mixed ascii-binary uses, struct.pack is not as elegant as a 
bytes.format might be. But I think such a method should use struct 
format codes within field specifiers to convert objects into binary 
bytes rather than text.


Note that struct codes include s = C char[] = Py bytes of possibly 
unspecified length copied unchanged.


--
Terry Jan Reedy

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


Re: 下载 below Download, in python.org site menu

2011-03-06 Thread Martin v. Loewis

It's intentional. Notice that it goes to a different URL than the
English download link.


Which is a synonym for the English download link (/getit is /download at
present)
Perhaps a translated page is planned?


No, translation is not the motivation at all.


  Chinese readers will know when to use it.

Why a special link just for Chinese and not several other languages?


Because only Chinese users may have to bypass URL filters that 
selectively censor content from python.org. Let's see how long

censors need to pick up this discussion and ban more of Python
across the Great Firewall :-(

Regards,
Martin

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


Re: Cluto like library for Python

2011-03-06 Thread Miki Tebeka
You have several option for interfacing with C libraries: Cython, swig, 
boost-python, ctypes ...

You can find several machine learning packages mentioned at 
http://web.media.mit.edu/~stefie10/technical/pythonml.html, I have no 
experience with any of them so I can't recommend any.

HTH
--
Miki Tebeka miki.teb...@gmail.com
http://pythonwise.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: my computer is allergic to pickles

2011-03-06 Thread Miki Tebeka
 Or, which situations does shelve suit better and which does
 marshal suit better?
shelve ease of use and the fact it uses the disk to store objects makes it a 
good choice if you have a lot of object, each with a unique string key (and a 
tuple of strings can be converted to and from a string).

db = shelve.open(/tmp/foo.db)
db[key1] = (1, 2, 3)
...

Marshal is faster and IIRC more geared toward network operations. But I haven't 
used it that much ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python data types in c++ code

2011-03-06 Thread Miki Tebeka
// howto get obj properties of different types
 (map, list, string, int, bool) ?
Python's C API is very well documented. You can use 
http://docs.python.org/c-api/object.html?highlight=pyobject#PyObject_GetAttr to 
get attributes or 
http://docs.python.org/c-api/object.html?highlight=pyobject#PyObject_GetItem to 
get items (from dictionaries and maps).

HTH
--
Miki Tebeka miki.teb...@gmail.com
http://pythonwise.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


paypal payment cheap wholesale soccer jersey baseball jerseys basketball jerseys NFL NBA MLB NHL jersey

2011-03-06 Thread DG Shoes Paypal wholesaler
paypal payment cheap wholesale soccer jersey baseball jerseys
basketball jerseys NFL NBA MLB NHL jersey free shipping
AAA quality clothes cheap wholesale .
NFL jersey wholesale
NFL NBA MLB NHL soccer  soccer jerseys
nike brand,MLB jerseys china supplier
MLB jerseys china wholesaler.
wholesale MLB jerseys.
NFL shop,,NFL NBA MLB NHL jerser wholesale,NFL NBA MLB NHL
alibaba,wholesale NFL NBA MLB NHL jerseys.
soccer jersey china supplier
soccer jerseys china wholesale.
wholesale soccer jersey,supply soccer jerseys
NFL NBA MLB NHL copy jersey
paypal payment jerseys from china NFL jerseys from china.
NBA paypal payment shop NFL jersey wholesale womens NBA jersey  NBA
jersey
http://www.24hours-online.com
-- 
http://mail.python.org/mailman/listinfo/python-list


PyWeek 12 (April 2011) is registration is open!

2011-03-06 Thread Richard Jones
The 12th Python Game Programming Challenge (PyWeek) is almost upon us.
It'll run from the 3rd to the 10th of April. Registration for teams
and individuals is now open on the website:

   http://pyweek.org/

The PyWeek challenge:

- Invites entrants to write a game in one week from scratch either as
an individual or in a team,
- Is intended to be challenging and fun,
- Will hopefully increase the public body of game tools, code and expertise,
- Will let a lot of people actually finish a game, and
- May inspire new projects (with ready made teams!)

If you've never written a game before and would like to try things out
then perhaps you could try either:

The tutorial I presented at LCA 2010, Introduction to Game Programming:
  http://www.lca2010.org.nz/wiki/Tutorials/Introduction_to_game_programming

The book Invent Your Own Computer Games With Python:
  http://inventwithpython.com/


   Richard Jones
   http://pyweek.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: my computer is allergic to pickles

2011-03-06 Thread Bob Fnord
GSO gso...@yahoo.co.uk wrote:

 On 5 March 2011 02:14, MRAB pyt...@mrabarnett.plus.com wrote:
 ...
  Any comments, suggestions?
 
 
 You obviously can't feed your computer pickles then.
 
 How about a tasty tidbit of XML?  Served up in a main dish of DOM, or
 serially if preferred?

Well, right now it takes three lines to save the dict object:

data_file = open(data_filename, 'wb')
marshal.dump(analysis, file, 2)
data_file.close()

and three to load it.  I doubt I could do it that easily in XML
_and_ the data file would be enormous. (XML always is, let's be
honest. The file doesn't need to be human readable or editable.)

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


Re: having both dynamic and static variables

2011-03-06 Thread Steven D'Aprano
On Sun, 06 Mar 2011 12:59:55 -0800, Westley Martínez wrote:

 I'm confused. Can someone tell me if we're talking about constant as in
 'fixed in memory' or as in 'you can't reassign' or both?

Python already has fixed in memory constants. They are immutable objects 
like strings, ints, floats, etc. Once you create a string spam, you 
cannot modify it. This has been true about Python forever.

What Python doesn't have is constant *names*. Once you bind an object to 
a name, like this:

s = spam

you can't modify the *object*, but you can rebind the name:

s = Nobody expects the Spanish Inquisition!

and now your code that expects s to be spam will fail. So the only new 
feature under discussion is a way to bind-once names, which many people 
call constants.

Perhaps the name is not the best, since I'm sure some people will be 
surprised that you can do this:

# hypothetical example
const L = [1, 2, 3]
L.append(4)  # works
del L[:]  # works
L = []  # fails

but I call that a feature, not a bug. If you want an immutable constant, 
use a tuple, not a list.




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


Re: python data types in c++ code

2011-03-06 Thread Dan Stromberg
On Sun, Mar 6, 2011 at 10:07 AM, Arthur Mc Coy 1984docmc...@gmail.comwrote:

 You know, they are still using SVN, they are
 very loosely coupled to the past.


Cython's very nice if you don't plan to do more than C/C++ with Python.
SWIG might be better if you intend to do more VHLL's than Python alone.

But about SVN: I'm not sure it's really dying.  Yes, a lot of distributed
development has moved off of SVN, and is better off for having done so, but
I believe some environments (especially corporate environments) just prefer
having a central server.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: questions about multiprocessing

2011-03-06 Thread Vincent Ren
I've got some new problems and I tried to search on Google but got no
useful information.


I want to download some images with multiprocessing.pool
In my class named Renren, I defined two methods:

def getPotrait(self, url):
# get the current potraits of a friend on Renren.com
try:
r = urllib2.urlopen(url)
except urllib2.URLError:
print Time out

tmp = re.search('large_[\d\D]*.jpg', url)
image_name = tmp.group()

img = r.read()
output = open(image_name, 'wb')
output.write(img)
output.close()

def getLargePotraits(self):

tasks = self.makeTaskList()
pool = Pool(processes = 3)
pool.map(self.getPotrait, tasks)


tasks is a list of URLs of images, I want to download these images and
save them locally.

In another python file, I wrote this:

   from renren import Renren

   # get username and password for RenRen.com
   username = raw_input('Email: ')
   password = raw_input('Password: ')
   print


   a = Renren(username, password)
   a.login()
   a.getLargePotraits()



However, when I try to run this file, I received an error message:

Exception in thread Thread-1:
Traceback (most recent call last):
  File /usr/lib/python2.6/threading.py, line 532, in
__bootstrap_inner
self.run()
  File /usr/lib/python2.6/threading.py, line 484, in run
self.__target(*self.__args, **self.__kwargs)
  File /usr/lib/python2.6/multiprocessing/pool.py, line 225, in
_handle_tasks
put(task)
PicklingError: Can't pickle type 'instancemethod': attribute lookup
__builtin__.instancemethod failed


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


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

2011-03-06 Thread Grant Edwards
On 2011-03-05, ErichCart ErichCart erichc...@gmail.com 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.org, it also doesn't seem very serious.

 I looked into pyGTK, and I found something called Glade, which seems
 to be something similar to visual python. The latest version of Glade
 was released just this month, so it seems to be actively developed.

 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.

 So, Glade, is this what everybody uses? I mean programmers don't
 just use text editors to make GUI applications, do they?

I've been doing (mostly smallish) GUI programs on and off for 20
years, and that's all I've ever used.  I tried the point-and-grunt
method a couple and found it to be time consuming and the results
to be bad (resizing never worked right).

-- 
Grant

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


Re: I'm happy with Python 2.5

2011-03-06 Thread alex23
On Feb 27, 11:57 pm, n00m n...@narod.ru wrote:
 http://www.spoj.pl/

There's your problem. I'd say most Python 3.x adopters are using it
for something other than working out whose performance dick is the
longest.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm happy with Python 2.5

2011-03-06 Thread Steven D'Aprano
On Sun, 06 Mar 2011 20:28:19 -0800, alex23 wrote:

 On Feb 27, 11:57 pm, n00m n...@narod.ru wrote:
 http://www.spoj.pl/
 
 There's your problem. I'd say most Python 3.x adopters are using it for
 something other than working out whose performance dick is the longest.

In fairness, the Python Dev team is very aware of the risk of performance 
degradation. Performance is important, but it is not *so important* that 
it outweighs everything else.

The question that needs to be asked is not Is Python 3 fast?, but 
instead Is Python 3 fast enough?.


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


PAYPAL WHOLESALE all BRAND(UGG BOOTS, SHOES, CLOTHES, HANDBAG, WATCH, JEANS, JERSEY, T-SHIRT, SHIRTS, HOODY, EYEGLASS, CAP, SHAWL, WALLT) and so on http://www.24hours-online.com/.

2011-03-06 Thread amy
PAYPAL payment wholesale SHOES(UGG BOOTS, Timberland boots ,Munich
shoes,NIKE,ADIDAS,LV,GUCCI,CHANEL,PRADA,POLO,DG,DIOR AND SO ON)
http://www.24hours-online.com/
PAYPAL payment wholesale CLOTHING and jeans(Franklin Marshall,Moncler
eiderdown,Nike,ADIDAS,AF,DG,ED
HARDAY,BAPE,BBC,LV,GUCCI,ARMANI,POLO,POUL SMITH AND SO ON)
http://www.24hours-online.com/
PAYPAL payment WATCH(ROLEX,OMEGA,CHANEL,LV,CARTIER,IWC,GUCCI,RADO AND
SO ON)
PAYPAL payment
HANDBAG(LV,GUCCI,CHANEL,PRADA,POLO,COACH,FENDI,CHLOE,BUBERRY,JUICY AND
SO ON)
paypal payment brand cap,shawl,belt,wallet,under wear,and so on.

More detail land, address:http://www.24hours-online.com/

PAYPAL WHOLESALE all BRAND(UGG
BOOTS,SHOES,CLOTHES,HANDBAG,WATCH,JEANS,JERSEY,T-
SHIRT,SHIRTS,HOODY,EYEGLASS,CAP,SHAWL,WALLT) and so on 
http://www.24hours-online.com/.

PAYPAL payment wholesale SHOES(UGG BOOTS, Timberland boots ,Munich
shoes,NIKE and so on) free shipping http://www.24hours-online.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


AW: import python module from C++ code

2011-03-06 Thread Markus Schaber
Hi,

 von Arthur Mc Coy:

 Still need the answer to the question:  howto embed given python file
 (which contains python class and its members) into the c++ application
? 

There is no straight way of embedding a Python module into a c++
application.

You will have to embed the python interpreter, and command it to load
the module in question and execute the code you want.

 I have to pass the arguments from c++ to python and back so I need to
do
 conversions. They are ok. Fails PyImport_Import(my_module) call saying
No
 module called mymodule. Then I need to create a mymodule based on
given
 python file (its name mymodule.py). Can it be achieved using SWIG ?

Did you configure the module search path properly?

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


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

2011-03-06 Thread Javier
Looks a good idea.  I use this kind of recursive dicts to represent
tree like datastruct in python.  Like:

car[ford][taurus][price]=...
car[toyota][corolla][mpg]=...
car[toyota][corolla][price]=...


It would be good if it could be combined with class2dict (converting
dict elemnets into attributes of a class/instance), 

http://vsbabu.org/mt/archives/2003/02/13/joy_of_python_classes_and_dictionaries.html

so the former would look a bit nicer:

car.toyota.corolla.mpg=...
car.toyota.corolla.price=...

Does anybody have  another idea for representing tree-like data?  Is
there another type for trees in python?



Ravi ra.ravi@gmail.com 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?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm happy with Python 2.5

2011-03-06 Thread n00m
http://www.spoj.pl/forum/viewtopic.php?f=20t=8264
That's all what I meant to say in here.
User numerix (German?) knows ropes of Python miles
far better than e.g. me.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator

2011-03-06 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4806
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7689] Pickling of classes with a metaclass and copy_reg

2011-03-06 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7689
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11400] Remove reference to pre 1.5 assignment behavior

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in f7e04a9566c4.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11400
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11337] Nothing refers to footnote [1] on page 6. Simple Statements in Language Reference

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in 949a099a87ca.  The detection of unused footnotes would be a docutils 
thing, not a Sphinx thing.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11338] No list of Python hg repositories

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Does this need any more action?

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11392] Turtle - better explain 'chaos' demo

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Applied in e6d9a8e38cc8.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11392
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11405] Wrong reference to string module in tutorial/inputoutput.rst

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in 59e464a1bbf0.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11405
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11373] Fix 2 new typos in the docs

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed the built-in spelling in 13bc0511b3d3.  I did not do the other change; 
having two-level relative clauses is not really readable.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11412] Section numbers in the Library Reference have a trailing period

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

This looks fine to me -- isn't it a mere stylistic issue?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11412
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11223] interruption of locks by signals not guaranteed when the semaphore implementation is not used

2011-03-06 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +neologix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11223
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11227] [DOC] asyncore - use 'Host' header in HTTP example

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in b630a135a86c.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11227
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11239] regexp-howto - add missing } to metachars

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in 3ec0a764ab5c.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11395] print(s) fails on Windows with long strings

2011-03-06 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I did some tests: os.write(1, b'X'*length) does always fail with length = 
63842. It does sometimes fail with length  35000. The maximum looks completly 
random: as written in Microsoft documentation, The maximum size of the buffer 
will depend on heap usage...

32000 looks arbitrary. I would prefer 2^15-1 (32767) because it looks less 
magical :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11395
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11292] Curses - add A_REVERSE to attributes table

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in d9292abe80da.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11292
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11294] Locale - update uniform ERA_*_FMT doc

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in 6f861f98a3c5.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11294
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11239] regexp-howto - add missing } to metachars

2011-03-06 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Actually '}' is not a metachar, the metachars should be only |()[{.+*?^$\.

 re.match('^a+(}+)b+$', '}bbb')
_sre.SRE_Match object at 0xb77aa860
 re.match('^a+(}+)b+$', '}bbb').group(1)
'}'

--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11239] regexp-howto - add missing } to metachars

2011-03-06 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Since ] was in the list, I've added } as well.  (It's never a bad idea to quote 
] and } unconditionally.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11410] Use GCC visibility attrs in PyAPI_*

2011-03-06 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Why the cygwin changes? Are they related? Also, is the change in 
Python/getargs.c necessary?

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11410
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11410] Use GCC visibility attrs in PyAPI_*

2011-03-06 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
stage:  - patch review
type:  - feature request
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11410
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11185] test_wait4 error on AIX

2011-03-06 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

If test_wait3 and test_fork1 pass, then yes, it's probably an issue with AIX's 
wait4.
See http://fixunix.com/aix/84872-sigchld-recursion.html:


Replace the wait4() call with a waitpid() call...
like this:
for(n=0;waitpid(-1, status, WNOHANG)  0; n++) ;

Or, compile the existing code with the BSD library:
cc -o demo demo.c -D_BSD -lbsd

Both will work...

The current problem is that child process is not seen by the wait4()
call,
so that when signal is rearmed, it immediately goes (recursively)
into the
child_handler() function.


So it seems that under AIX, posix_wait4 should be compiled with -D_BSD -lbsd.
Could you try this ?

If this doesn't do the trick, then avoiding passing WNOHANG could be the second 
option.

--
nosy: +neologix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11185
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11413] Idle doesn't start

2011-03-06 Thread Chris

New submission from Chris ceonnbo...@yahoo.com:

Hi, I just installed Python 3.1.1 via link in the book Python Programming for 
the absolute beginner third edition. But Idle won't start. When I try to open 
Idle the Windows hourglass just flash briefly but nothing happens after that. 
No error messages.

My operating system is XP Professional Version 2002 Service Pack 3.

I have uninstalled and reinstalled several times but nothing changes. I select 
Install for All Users during the installation.

I have also tried installing instead the 3.2 version from the python.org 
website but the same issue arises - idle doesn't launch. 

Does anyone know what the problem is? Really want to get going with the program!

--
components: IDLE
messages: 130165
nosy: Chris
priority: normal
severity: normal
status: open
title: Idle doesn't start
type: behavior
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11413
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11411] Fix typo in Makefile

2011-03-06 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Looks fine, please commit.

--
assignee:  - twouters
nosy: +pitrou
stage:  - commit review
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11411
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11406] There is no os.listdir() equivalent returning generator instead of list

2011-03-06 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com added the comment:

Generator listdir() could be useful if I have a directory with several millions 
of files and I what to process just a hundred.

--
nosy: +nvetoshkin

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator

2011-03-06 Thread Daniel Urban

Daniel Urban urban.dani...@gmail.com added the comment:

I think the patch isn't entirely correct.  It uses PyIter_Check for detecting 
the case when an *iterable* raises TypeError, but that function actually checks 
for an *iterator*.  The check on the tp_iter member mentioned by Amaury Forgeot 
d'Arc probably would be better, but even that wouldn't detect every iterable: 
Its presence normally signals that the instances of this type are iterable 
(although sequences may be iterable without this function). 
(http://docs.python.org/dev/py3k/c-api/typeobj.html#PyTypeObject.tp_iter)  
(Apparently any object with a __getitem__ is iterable.  By the way, 
collections.abc.Iterable also doesn't detect this case.)

--
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4806
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5800] make wsgiref.headers.Headers accept empty constructor

2011-03-06 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Here's the single-file patch against the revision.

--
Added file: http://bugs.python.org/file21016/issue5800.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5800
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5800] make wsgiref.headers.Headers accept empty constructor

2011-03-06 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file19681/test_wsgiref.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5800
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5800] make wsgiref.headers.Headers accept empty constructor

2011-03-06 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file19797/headers.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5800
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5800] make wsgiref.headers.Headers accept empty constructor

2011-03-06 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file19804/wsgiref.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5800
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11387] Tkinter, callback functions

2011-03-06 Thread Nikolay Fomichev

Nikolay Fomichev morphsa...@gmail.com added the comment:

Here it is... 


import sys
if sys.version_info[0] == 3:
import tkinter as tk
from tkinter import messagebox
from tkinter import filedialog
else:
import Tkinter as tk
import tkMessageBox as messagebox
import tkFileDialog as filedialog

class App():  
def __init__(self):
self.root = tk.Tk()

self.btnMsg = tk.Button(self.root, text='Click me')
self.btnMsg.pack()
self.btnMsg.bind('Button-1', self.clickMsg)

self.btnFd = tk.Button(self.root, text='Click me too')
self.btnFd.pack()
self.btnFd.bind('Button-1', self.clickFd)

self.btnCommand = tk.Button(self.root, text='And now click me')
self.btnCommand.pack()
self.btnCommand.config(command=self.clickCommand)

self.root.mainloop()

def clickMsg(self, event):
messagebox.showerror(title='Error!', message='The button is sunken!')
   
def clickFd(self, event):
filedialog.askdirectory(title='Choose a directory')

def clickCommand(self):
messagebox.showinfo(title='Success!', message='The button is raised.')

App()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11387
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-03-06 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Above-mentioned fix was commited in rev 62994662676a

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10924
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-03-06 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Above-mentioned fix was committed in 0586c699d467 and 62994662676a

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10924
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-03-06 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
Removed message: http://bugs.python.org/msg130171

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10924
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11387] Tkinter, callback functions

2011-03-06 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

I have a different problem here on Mac, but I can manage to reproduce
your issue if I apply the following patch:

Index: Lib/tkinter/__init__.py
===
--- Lib/tkinter/__init__.py (revision 88757)
+++ Lib/tkinter/__init__.py (working copy)
@@ -920,9 +920,9 @@
 self.tk.call('bindtags', self._w, tagList)
 def _bind(self, what, sequence, func, add, needcleanup=1):
 Internal function.
-if isinstance(func, str):
-self.tk.call(what + (sequence, func))
-elif func:
+#if isinstance(func, str):
+#self.tk.call(what + (sequence, func))
+if func:
 funcid = self._register(func, self._substitute,
 needcleanup)
 cmd = ('%sif {[%s %s] == break} break\n'

This should help someone else to produce a patch for this problem you
reported. It is interesting that this same patch fixes the problem I
have here (I get a SIGSEGV if I click the cancel button side the
askdirectory dialog).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11387
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11290] ttk.Combobox['values'] String Conversion to Tcl

2011-03-06 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Does the attached patch work for you ?

--
keywords: +patch
Added file: http://bugs.python.org/file21017/patch11290.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11290
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4350] Remove dead code from Tkinter.py

2011-03-06 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

If we consider the meaning of dead code as that used in compilers, then I 
meant out of date code.

If you want to add support for tk::ButtonEnter then I believe you should open a 
new issue and raise your points there. Anyway, have you read 
http://www.mail-archive.com/python-list@python.org/msg210494.html ? Does it 
relate to your use case ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4350
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >