Re: Is Python a commercial proposition ?

2012-08-24 Thread Chris Withers

On 30/07/2012 03:31, Rodrick Brown wrote:

Hence the reason why no one will seriously look at Python for none
glue work or simple web apps.  When it comes to designing complex
applications that need to exploit large multicore systems Python just
isn't an option.

Its still not possible to be a pure Python developer and find gainful
employment today.


Oh come on, are you *actually* serious?

Pretty much everything you've said is nothing but inept bullshit.
Please stop.

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Antoon Pardon
On 23-08-12 01:58, Ben Finney wrote:
>
> You haven't discovered anything about types; what you have discovered is
> that Python name bindings are not variables.
>
> In fact, Python doesn't have variables – not as C or Java programmers
> would understand the term. What it has instead are references to objects
> (with names as one kind of reference).
>
> The documentation unfortunately calls these references “variables” in
> various places, which IMO compounds the confusion in newcomers
> experienced with other languages. It's best, I think, to reject the idea
> that Python has variables, and think in terms of references instead.
>   
Why should we reject the idea that python has variables? Python
variables are a lot like scheme or smalltalk variables and I never
heard anyone having a problem considering these languages
having variables.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Antoon Pardon
On 24-08-12 09:38, Antoon Pardon wrote:
> On 23-08-12 01:58, Ben Finney wrote:
>   
>> You haven't discovered anything about types; what you have discovered is
>> that Python name bindings are not variables.
>>
>> In fact, Python doesn't have variables – not as C or Java programmers
>> would understand the term. What it has instead are references to objects
>> (with names as one kind of reference).
>>
>> The documentation unfortunately calls these references “variables” in
>> various places, which IMO compounds the confusion in newcomers
>> experienced with other languages. It's best, I think, to reject the idea
>> that Python has variables, and think in terms of references instead.
>>   
>> 
> Why should we reject the idea that python has variables? Python
> variables are a lot like scheme or smalltalk variables and I never
> heard anyone having a problem considering these languages
> having variables.
>   
Never mind. I missed the reactions already dealing with this.

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


Re: Data cleaning workouts

2012-08-24 Thread Mark Lawrence
Elevated Python types don't get their hands dirty top posting, but I'm 
certain that they would when talking data or there wouldn't be so many 
debates on which data type to use :)


On 24/08/2012 07:48, Fg Nu wrote:



Thanks. I will try the SciPy list. It was a bit of a hail mary anyway. Pretty 
sure elevated Python types don't actually get their hands dirty with data. ;)



- Original Message -
From: rusi 
To: python-list@python.org
Cc:
Sent: Thursday, August 23, 2012 11:01 PM
Subject: Re: Data cleaning workouts

On Aug 23, 12:52 pm, Fg Nu  wrote:

List folk,

I am a newbie trying to get used to Python. I was wondering if anyone knows of 
web resources that teach good practices in data cleaning and management for 
statistics/analytics/machine learning, particularly using Python.

Ideally, these would be exercises of the form: here is some horrible raw data 
--> here is what it should look like after it has been cleaned. Guidelines 
about steps that should always be taken, practices that should be avoided; 
basically, workflow of data analysis in Python with special emphasis on the 
cleaning part.


Since no one has answered, I suggest you narrow your searching from
'python' to 'scipy' (or 'numpy').
Also perhaps ipython.
And then perhaps try those specific mailing lists/fora.

Since I dont know this area much, not saying more.




--
Cheers.

Mark Lawrence.

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


Re: Does a wxPython program not run on 64bit Windows?

2012-08-24 Thread Mark Lawrence

On 24/08/2012 06:37, Levi Nie wrote:

Does  a wxPython  program not run on 64bit Windows?

I saw this “
wxPython is a cross-platform toolkit. This means that the same program
will run on multiple platforms without modification. Currently
supported platforms are 32-bit Microsoft Windows, most Unix or
unix-like systems, and Macintosh OS X.
”





Why don't you try it and see what happens?

--
Cheers.

Mark Lawrence.

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


Re: Does a wxPython program not run on 64bit Windows?

2012-08-24 Thread Laszlo Nagy

On 2012-08-24 07:37, Levi Nie wrote:

Does  a wxPython  program not run on 64bit Windows?
Did you at least try to download wxPython? Because the download page 
shows the 64bit and the 32bit versions as well. :-)


http://wxpython.org/download.php

By the way, the 32bit version will gladly run on a 64bit Windows. 
However, you will have to install the 32bit version of Python for that. 
(And yes, 32bit Python also runs on 64bit Windows.)


wxPython also runs on OS X, and probably on any platform that runs gtk. 
(Practically, all popular unices.)

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


Re: Re: Objects in Python

2012-08-24 Thread Evan Driscoll
On 8/23/2012 22:17, alex23 wrote:
> But Roy's point was that referring to 'a' as a 'variable' makes no
> sense, as it's not an allocated piece of memory.

Does the computer just remember what 'a' refers to by keeping notes
about it in Narnia?

Put it this way. If C removed the & operator -- and thus you couldn't
tell what address a variable (or "variable instance", if you prefer) was
at -- would "int x;" cease to be a variable?

Evan




signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Steven D'Aprano
On Fri, 24 Aug 2012 04:14:27 -0500, Evan Driscoll wrote:

> On 8/23/2012 22:17, alex23 wrote:
>> But Roy's point was that referring to 'a' as a 'variable' makes no
>> sense, as it's not an allocated piece of memory.
> 
> Does the computer just remember what 'a' refers to by keeping notes
> about it in Narnia?

No. The compiler remembers the address of 'a' by keeping notes about it 
somewhere in memory during the compilation process. When you run the 
compiled program, there is no longer any reference to the name 'a'.

(Many compilers give you the option to keep variable names, but that's 
additional debugging data, not an essential part of the execution model.)

The mapping of name:address is part of the *compilation* process -- the 
compiler knows that variable 'x' corresponds to location 12345678, but 
the compiled code has no concept of anything called 'x'. It only knows 
about locations. The source code 'x = 42' is compiled into something like 
'store 42 into location 12345678'. (Locations may be absolute or 
relative.)

In languages with name bindings, the compiler doesn't need to track 
name:address pairs. The compiled application knows about names, but not 
about addresses. The source code 'x = 42' is compiled into something like 
'store 42 into the namespace using key "x"'.

Python gives you no way to peek at an address. It's not even clear what 
the address of the variable would be, because there are *at least three* 
things it could be:

1) the address of the key field in the namespace (where the name lives);

2) the address of the value field in the namespace (where the pointer to 
the object lives);

3) the address of the object itself.

And any of these are free to move around during the lifetime of the 
application. (E.g. in Jython, which runs under the JVM, objects don't 
have a fixed location.)


> Put it this way. If C removed the & operator -- and thus you couldn't
> tell what address a variable (or "variable instance", if you prefer) was
> at -- would "int x;" cease to be a variable?

Not at all. Just because the public interface of the language doesn't 
give you any way to view the fixed locations of variables, doesn't mean 
that variables cease to have fixed locations.



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


Identity function id() [was Re: Objects in Python]

2012-08-24 Thread Steven D'Aprano
On Thu, 23 Aug 2012 20:36:27 -0400, Roy Smith wrote:

> The id has changed!  Now, we all know that the id of an object is its
> memory address (that's not guaranteed, but in the standard C
> implementation of Python, that's what it is).

It's not only "not guaranteed", it is *explicitly* noted as an 
implementation detail. The id of the object is an arbitrary number 
guaranteed to be unique during the lifetime of that object. It just 
happens that CPython currently uses the memory address as the id. Jython 
does not:

steve@runes:~$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[OpenJDK Client VM (Sun Microsystems Inc.)] on java1.6.0_18
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
1


Nor does IronPython:

steve@runes:~$ ipy
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
43



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


Installation of yappi (timing module)

2012-08-24 Thread Virgil Stokes
I have been doing some experiments with different modules for the timing of 
functions and code segments. One module I would like to test is yappi (thread 
aware timer) which is listed at PyPI. However, I have been unable to install it 
on Windows Vista and Windows 7 (Python 2.7 on both). I have tried both 
easy_install and pip (as suggested at http://code.google.com/p/yappi/). Here is 
what happens with easy_install


C:\Users\Virgil>easy_install yappi
Searching for yappi
Reading http://pypi.python.org/simple/yappi/
Reading http://yappi.googlecode.com/
Best match: yappi 0.62
Downloading http://yappi.googlecode.com//files/yappi-0.62.tar.gz
Processing yappi-0.62.tar.gz
Writing 
c:\users\virgil\appdata\local\temp\easy_install-tzt5gl\yappi-0.62\setup.cfg
Running yappi-0.62\setup.py -q bdist_egg --dist-dir 
c:\users\virgil\appdata\local\temp\easy_install-tzt5gl\yappi-0.62\egg-dist-tmp-t3qodo

In file included from D:\python27\include\Python.h:8,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\pyconfig.h:68: io.h: No such file or directory
D:\python27\include\pyconfig.h:296: stdio.h: No such file or directory
In file included from config.h:4,
 from _yappi.c:10:
D:\python27\include\Python.h:19: limits.h: No such file or directory
D:\python27\include\Python.h:22: #error "Something's broken.  UCHAR_MAX should 
be defined in limits.h."
D:\python27\include\Python.h:26: #error "Python's source code assumes C's 
unsigned char is an 8-bit type."

D:\python27\include\Python.h:33: stdio.h: No such file or directory
D:\python27\include\Python.h:35: #error "Python.h requires that stdio.h define 
NULL."

D:\python27\include\Python.h:38: string.h: No such file or directory
D:\python27\include\Python.h:40: errno.h: No such file or directory
D:\python27\include\Python.h:42: stdlib.h: No such file or directory
D:\python27\include\Python.h:49: stddef.h: No such file or directory
D:\python27\include\Python.h:56: assert.h: No such file or directory
In file included from D:\python27\include\Python.h:58,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\pyport.h:306: stdlib.h: No such file or directory
D:\python27\include\pyport.h:312: math.h: No such file or directory
D:\python27\include\pyport.h:325: time.h: No such file or directory
D:\python27\include\pyport.h:377: sys\stat.h: No such file or directory
In file included from D:\python27\include\Python.h:85,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\unicodeobject.h:4: stdarg.h: No such file or directory
D:\python27\include\unicodeobject.h:57: ctype.h: No such file or directory
D:\python27\include\unicodeobject.h:120: wchar.h: No such file or directory
In file included from D:\python27\include\Python.h:94,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\stringobject.h:10: stdarg.h: No such file or directory
In file included from D:\python27\include\Python.h:98,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\bytearrayobject.h:9: stdarg.h: No such file or directory
In file included from D:\python27\include\Python.h:121,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\pyerrors.h:319: stdarg.h: No such file or directory
In file included from D:\python27\include\Python.h:126,
 from config.h:4,
 from _yappi.c:10:
D:\python27\include\modsupport.h:10: stdarg.h: No such file or directory
In file included from _yappi.c:10:
config.h:15: stdint.h: No such file or directory
In file included from _yappi.c:23:
timing.h:8: windows.h: No such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1

And pip fails with similar problems (same pyconfig errors where C++ header files 
are not found). In both cases yappi-0.62.tar.gz was downloaded.Note: 1) I also 
tried to install from the source which also failed with similar problems, 2) I 
have both cygwin and MinGW gcc compilers on my systems and they do contain in 
their include folder these "missing" header files.


Any suggestions on how yappi can be installed would be appreciated.

--V :-)



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


Re: Is Python a commercial proposition ?

2012-08-24 Thread lipska the kat

On 23/08/12 22:46, Chris Withers wrote:

On 30/07/2012 03:31, Rodrick Brown wrote:

Hence the reason why no one will seriously look at Python for none
glue work or simple web apps. When it comes to designing complex
applications that need to exploit large multicore systems Python just
isn't an option.

Its still not possible to be a pure Python developer and find gainful
employment today.


Oh come on, are you *actually* serious?

Pretty much everything you've said is nothing but inept bullshit.
Please stop.


OK, well excuse me for butting in but it's obvious from your website 
that you have some experience with Python in the 'real world' I'd be 
most interested to hear if you have experience of or have heard of 
Python being used in any of the following circumstances.


Critical Systems:

wikipedia does a better job than I on the definition of a critical 
system although I'm not suggesting that everything in this article 
refers to a potential software system but it's a good illustration.


http://en.wikipedia.org/wiki/Life-critical_system

Real time systems:

An example of a real time system in this context is
an odds arbitrage back end publishing to the WWW via a
collection of web services, of course this is just one possible 
interface, it could publish to another computer system or another HCI
This requirement of course implies a complete decoupling of view and 
implementation. For more on odds arbitrage


http://en.wikipedia.org/wiki/Arbitrage_betting

It's 'real time' because publishing incorrect odds could cost someone a 
great deal of money, the odds need to be available for manipulation by 
the arbitrage engine as soon as they appear on the relevant bookies 
website (in fact I've had them appearing _before_ this as I managed to 
process them before the bookies web site did :-).


http://www.python.org/about/success/#real-time has a few examples
but I'd be interested to hear 'from the horses mouth'

Again, wikipedia is your friend
http://en.wikipedia.org/wiki/Real-time_computing

What is the largest Python project you have experience of, you can use 
any metric you want, a simple KLOC, function point or cost analysis will 
be fine.


This is a genuine enquiry and not designed to 'diss' Python in any way.


Many thanks

lipska
--
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
--
http://mail.python.org/mailman/listinfo/python-list


squeeze install python-gi

2012-08-24 Thread contro opinion
我发现squeeze 不能安装python-gi,没有squeeze的版本


from gi.repository import Gtk

def destroy_cb(widget):
Gtk.main_quit()

w = Gtk.Window()
w.connect('destroy', destroy_cb)

l = Gtk.Label()
l.set_text("Hello World!")
w.add(l)

w.show_all()
Gtk.main()

这样简单的代码,无法在squeeze里面运行?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Objects in Python

2012-08-24 Thread wu wei
On Fri, Aug 24, 2012 at 7:14 PM, Evan Driscoll  wrote:

> On 8/23/2012 22:17, alex23 wrote:
> > But Roy's point was that referring to 'a' as a 'variable' makes no
> > sense, as it's not an allocated piece of memory.
>
> Does the computer just remember what 'a' refers to by keeping notes
> about it in Narnia?
>

You're correct. It will be, on some level, a piece of memory. But I don't
recall seeing any guarantee that the memory used to hold the dictionary key
of 'a' in one scope would be re-used if 'a' was first deleted and then
re-created. It's an implementation detail about the language that we don't
care about.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: protobuf + pypy

2012-08-24 Thread Pedro Larroy
_with pypy_

On Wed, Aug 22, 2012 at 12:16 AM, Mark Lawrence  wrote:
> On 21/08/2012 22:55, Pedro Larroy wrote:
>>
>> Hi
>>
>> Anyone knows if it's possible to use protobuffers with pypy?   Seems
>> there isn't much info on the web about this.
>>
>> Pedro.
>>
>
> Did you mean this, in which case there loads on the web
> http://code.google.com/p/protobuf/ ?
>
> --
> Cheers.
>
> Mark Lawrence.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Alexander Blinne
On 23.08.2012 20:30, Dennis Lee Bieber wrote:
> On Thu, 23 Aug 2012 15:33:33 +1000, Chris Angelico 
> declaimed the following in gmane.comp.python.general:
>> x = 1;
>>
>> In C, this means: Assign the integer 1 to the variable x (possibly
>> with implicit type casting, eg to floating point).
>>
>   Or, at an even lower level...
> 
>   Convert the decimal literal "1" to binary (including type casting)
> to the predeclared type given to the variable "x", and store that binary
> value into the predetermined memory associated with "x".

Not really the way i would view it. The conversion to binary of the
string "1" is part of the parsers and compilers work in order to do what
the language reference says about the meaning of x=1;. The resulting
code would simply store the binary value of an integer 1 (which is
contained in the code as is, nothing has to be converted or typecasted)
into the location corresponding to the variable x. So in C x=1; really
means store integer 1 to the variable x.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Grant Edwards
On 2012-08-24, Steven D'Aprano  wrote:
> On Fri, 24 Aug 2012 04:14:27 -0500, Evan Driscoll wrote:
>
>> On 8/23/2012 22:17, alex23 wrote:
>>> But Roy's point was that referring to 'a' as a 'variable' makes no
>>> sense, as it's not an allocated piece of memory.
>> 
>> Does the computer just remember what 'a' refers to by keeping notes
>> about it in Narnia?
>
> No. The compiler remembers the address of 'a' by keeping notes about it 
> somewhere in memory during the compilation process.

Ah, but as we are always fond of saying in this group "that's an
implementation detail, and not part of the language definition".  The
model where a compiler is "keeping notes about it in Narnia" is also
perfectly valid. However, RAM is easier to find than magic wardrobes,
so the "notes" are usually kept in RAM these days.

-- 
Grant Edwards   grant.b.edwardsYow! You mean you don't
  at   want to watch WRESTLING
  gmail.comfrom ATLANTA?
-- 
http://mail.python.org/mailman/listinfo/python-list


python-list@python.org

2012-08-24 Thread Prasad, Ramit
Ulrich Eckhardt wrote:
> A good tool would reduce the effort and guide users, like e.g. giving
> them a hint if they leave the whole mail they're replying to as copy.
> Several corporate email solutions (like MS Outlook/Exchange) put very
> little emphasis on communication efficiency but only on eye-candy
> features. Their popularity and the resulting influence on people has
> caused decay in average communication culture, and that is what I blame
> them for.

True, but it is by no means impossible or very difficult. It just requires
some effort. I blame the user more and the software less because of quotes 
like below.

[ Not Ulrich ]
> GMail uses top-posting by default. 


[ Back to Ulrich ]
> BTW: You omitted the attribution line for the text you quoted, whom do
> you blame for that? That said, "Nonsense" is a strong enough word to
> start a flamewar... not nice.
Fair enough. I typically leave off attribution because I would rather
to discuss things with quotes instead of he-said and she-said. The
focus should be on the idea/conversation and less about attributing
"blame" to someone (and it is invariably more often negative attribution
than positive). If attribution is preferred, I suppose I could always 
add it back in. Ironically, this is one of the things I wish Outlook
was better about.

Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


python-list@python.org

2012-08-24 Thread Ramchandra Apte
As BFDL, I hereby command everybody to stop the discussion.
lets put time on useful stuff

i am using google groups (i think it knows what to do)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: squeeze install python-gi

2012-08-24 Thread Ramchandra Apte
On Friday, 24 August 2012 17:17:15 UTC+5:30, contro opinion  wrote:
> 我发现squeeze 不能安装python-gi,没有squeeze的版本
> 
> 
> from gi.repository import Gtk
> 
> def destroy_cb(widget):
> Gtk.main_quit()
> 
> w = Gtk.Window()
> w.connect('destroy', destroy_cb)
> 
> l = Gtk.Label()
> 
> l.set_text("Hello World!")
> w.add(l)
> 
> w.show_all()
> Gtk.main()
> 
> 这样简单的代码,无法在squeeze里面运行?

English translation by Google translate (machine translated):
I found that the squeeze can not install python-gi, squeeze version 


from gi.repository import Gtk 

def destroy_cb(widget): 
Gtk.main_quit() 

w = Gtk.Window() 
w.connect('destroy', destroy_cb) 

l = Gtk.Label() 
l.set_text("Hello World!") 
w.add(l) 

w.show_all() 
Gtk.main() 

This simple code, unable to squeeze inside run?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Built-in open() with buffering > 1

2012-08-24 Thread Ramchandra Apte
`f._CHUNK_SIZE = 5` is modifying Python's internal variables - don't do that
google buffering to find out what it is
buffering is how much Python will keep in memory
f.read(1) will actually read `buffering` bytes of memory so that when you read 
later, the reading can be done from memory
On Friday, 24 August 2012 10:51:36 UTC+5:30, Marco  wrote:
> On 08/24/2012 06:35 AM, Marco wrote:
> 
> > Please, can anyone explain me the meaning of the
> 
> > "buffering > 1" in the built-in open()?
> 
> > The doc says: "...and an integer > 1 to indicate the size
> 
> > of a fixed-size chunk buffer."
> 
> 
> 
> Sorry, I get it:
> 
> 
> 
>  >>> f = open('myfile', 'w', buffering=2)
> 
>  >>> f._CHUNK_SIZE = 5
> 
>  >>> for i in range(6):
> 
> ... n = f.write(str(i))
> 
> ... print(i, open('myfile').read(), sep=':')
> 
> ...
> 
> 0:
> 
> 1:
> 
> 2:
> 
> 3:
> 
> 4:
> 
> 5:012345

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


python-list@python.org

2012-08-24 Thread Mark Lawrence

On 24/08/2012 15:23, Ramchandra Apte wrote:

As BFDL, I hereby command everybody to stop the discussion.
lets put time on useful stuff


Well I didn't vote for you :)



i am using google groups (i think it knows what to do)




--
Cheers.

Mark Lawrence.

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


Re: Flexible string representation, unicode, typography, ...

2012-08-24 Thread Ramchandra Apte
On Thursday, 23 August 2012 18:17:29 UTC+5:30, (unknown)  wrote:
> This is neither a complaint nor a question, just a comment.
> 
> 
> 
> In the previous discussion related to the flexible
> 
> string representation, Roy Smith added this comment:
> 
> 
> 
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/2645504f459bab50/eda342573381ff42
> 
> 
> 
> Not only I agree with his sentence:
> 
> "Clearly, the world has moved to a 32-bit character set."
> 
> 
> 
> he used in his comment a very intersting word: "punctuation".
> 
> 
> 
> There is a point which is, in my mind, not very well understood,
> 
> "digested", underestimated or neglected by many developers:
> 
> the relation between the coding of the characters and the typography.
> 
> 
> 
> Unicode (the consortium), does not only deal with the coding of
> 
> the characters, it also worked on the characters *classification*.
> 
> 
> 
> A deliberatly simplistic representation: "letters" in the bottom
> 
> of the table, lower code points/integers; "typographic characters"
> 
> like punctuation, common symbols, ... high in the table, high code
> 
> points/integers. 
> 
> 
> 
> The conclusion is inescapable, if one wish to work in a "unicode
> 
> mode", one is forced to use the whole palette of the unicode
> 
> code points, this is the *nature* of Unicode.
> 
> 
> 
> Technically, believing that it possible to optimize only a subrange
> 
> of the unicode code points range is simply an illusion. A lot of
> 
> work, probably quite complicate, which finally solves nothing.
> 
> 
> 
> Python, in my mind, fell in this trap.
> 
> 
> 
> "Simple is better than complex."
> 
>   -> hard to maintained
> 
> "Flat is better than nested." 
> 
>   -> code points range
> 
> "Special cases aren't special enough to break the rules."
> 
>   -> special unicode code points?
> 
> "Although practicality beats purity."
> 
>  -> or the opposite?
> 
> "In the face of ambiguity, refuse the temptation to guess."
> 
>   -> guessing a user will only work with the "optimmized" char subrange.
> 
> ...
> 
> 
> 
> Small illustration. Take an a4 page containing 50 lines of 80 ascii
> 
> characters, add a single 'EM DASH' or an 'BULLET' (code points > 0x2000),
> 
> and you will see all the optimization efforts destroyed.
> 
> 
> 
> >> sys.getsizeof('a' * 80 * 50)
> 
> 4025
> 
> >>> sys.getsizeof('a' * 80 * 50 + '•')
> 
> 8040
> 
> 
> 
> Just my 2 € (code point 0x20ac) cents.
> 
> 
> 
> jmf

The zen of python is simply a guideline
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Ramchandra Apte
On Wednesday, 22 August 2012 22:13:04 UTC+5:30, Terry Reedy  wrote:
> On 8/22/2012 3:30 AM, Mark Lawrence wrote:
> 
> > On 22/08/2012 06:46, Terry Reedy wrote:
> 
> >> On 8/21/2012 11:43 PM, mingqiang hu wrote:
> 
> >>> why filter is bad when use lambda ?
> 
> >>
> 
> >> Inefficient, not 'bad'. Because the equivalent comprehension or
> 
> >> generator expression does not require a function call.
> 
> 
> 
> for each item in the iterable.
> 
> 
> 
> > A case of premature optimisation? :)
> 
> 
> 
> No, as regards my post. I simply made a factual statement without 
> 
> advocating a particular action.
> 
> 
> 
> filter(lambda x: , iterable)
> 
> (x for x in iterable if )
> 
> 
> 
> both create iterators that produce the items in iterable such that 
> 
> bool() is true. The following, with output rounded, shows 
> 
> something of the effect of the extra function call.
> 
> 
> 
>  >>> timeit.timeit("list(i for i in ranger if False)", "ranger=range(0)")
> 
> 0.91
> 
>  >>> timeit.timeit("list(i for i in ranger if False)", "ranger=range(20)")
> 
> 1.28
> 
>  >>> timeit.timeit("list(filter(lambda i: False, ranger))", 
> 
> "ranger=range(0)")
> 
> 0.83
> 
>  >>> timeit.timeit("list(filter(lambda i: False, ranger))", 
> 
> "ranger=range(20)")
> 
> 2.60
> 
> 
> 
> Simply keeping true items is faster with filter -- at least on my 
> 
> particular machine with 3.3.0b2.
> 
> 
> 
>  >>> timeit.timeit("list(filter(None, ranger))", "ranger=range(20)")
> 
> 1.03
> 
> 
> 
> Filter is also faster if the expression is a function call.
> 
> 
> 
>  >>> timeit.timeit("list(filter(f, ranger))", "ranger=range(20); 
> 
> f=lambda i: False")
> 
> 2.5033614114454394
> 
>  >>> timeit.timeit("list(i for i in ranger if f(i))", "ranger=range(20); 
> 
> f=lambda i: False")
> 
> 3.2394095327040304
> 
> 
> 
> ---
> 
> Perhaps or even yes as regards the so-called rule 'always use 
> 
> comprehension'. If one prefers filter as more readable, if one only 
> 
> wants to keep true items, if the expression is a function call, if 
> 
> evaluating the expression takes much more time than the extra function 
> 
> call so the latter does not matter, if the number of items is few enough 
> 
> that the extra time does not matter, then the rule is not needed or even 
> 
> wrong.
> 
> 
> 
> So I think PyLint should be changed to stop its filter fud.
> 
> 
> 
> -- 
> 
> Terry Jan Reedy

When filtering for true values, filter(None,xxx) can be used
Your examples with lambda i:False are unrealistic - you are comparing `if 
False` vs (xx) - function call vs boolean check
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: psphere: how to make thread safe

2012-08-24 Thread Ramchandra Apte
On Wednesday, 22 August 2012 17:33:48 UTC+5:30, sajuptpm  wrote:
> Hi,
> 
> 
> 
> psphere: Python interface for the VMware vSphere Web Services SDK
> 
> 
> 
> I already developed an app using https://bitbucket.org/jkinred/psphere. But 
> getting lot of errors since psphere is not thread safe (I think). So i wrote 
> couple of scripts to test it (See attached files) and found that caching 
> mechanism used by psphere is not thread safe. Could someone please give me 
> some suggestion to make it thread safe.
> 
> 
> 
> 
> 
> ===Test Code 
> 
> 
> 
> import psphere
> 
> from psphere.client import Client
> 
> from psphere.managedobjects import HostSystem, VirtualMachine, ComputeResource
> 
> client = Client("192.168.0.114", "root", "vmware1") ##vCenter
> 
> print "\nSucessfully connected to vCenter.\n"
> 
> 
> 
> from threading import Thread
> 
> 
> 
> def myfunc(i):
> 
>   host1 = HostSystem.get(client, name="192.168.0.134")
> 
>   host2 = HostSystem.get(client, name="192.168.0.113")
> 
>   print "i--",i
> 
>   while True:
> 
>   #host1.update(properties=["config", "vm"])
> 
>   #host2.update(properties=["config", "vm"])
> 
>   c = type(host1.config.network)
> 
>   v = type(host2.config.network)
> 
>   for vm in host1.vm:
> 
>   k = vm.config.template
> 
>   for vm in host2.vm:
> 
>   p = vm.config.template
> 
> 
> 
> 
> 
> for i in range(10):   
> 
> t = Thread(target=myfunc, args=(i,))
> 
> t.start()
> 
> 
> 
> 
> 
> """
> 
> OUTPUT 
> 
> ===
> 
> Sucessfully connected to vCenter.
> 
> 
> 
> i-- 1
> 
> i-- 3
> 
> i-- 5
> 
> i-- 0
> 
>  i-- 4
> 
> i-- 2i-- 7
> 
> i-- 
> 
> 9
> 
> i-- 6
> 
> i-- 8
> 
> Exception in thread Thread-4:
> 
> Traceback (most recent call last):
> 
>   File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
> 
> self.run()
> 
>   File "/usr/lib/python2.7/threading.py", line 504, in run
> 
> self.__target(*self.__args, **self.__kwargs)
> 
>   File "vcenter_test1.py", line 19, in myfunc
> 
> k = vm.config.template
> 
>   File "/home/saju/cvt/trunk/src/cvt/web/cvt/psphere/__init__.py", line 79, 
> in __get__
> 
> value = self.fget(inst)
> 
>   File "/home/saju/cvt/trunk/src/cvt/web/cvt/psphere/managedobjects.py", line 
> 1236, in config
> 
> return self._get_dataobject("config", False)
> 
>   File "/home/saju/cvt/trunk/src/cvt/web/cvt/psphere/__init__.py", line 116, 
> in _get_dataobject
> 
> return self._cache[name][0]
> 
> KeyError: 'config'
> 
> 
> 
> Exception in thread Thread-6:
> 
> Traceback (most recent call last):
> 
>   File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
> 
> self.run()
> 
>   File "/usr/lib/python2.7/threading.py", line 504, in run
> 
> self.__target(*self.__args, **self.__kwargs)
> 
>   File "vcenter_test1.py", line 17, in myfunc
> 
> v = type(host2.config.network)
> 
> AttributeError: VirtualMachineConfigInfo instance has no attribute 'network'
> 
> 
> 
> 
> 
> 
> 
> """

use locks please on the cache
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: something about split()???

2012-08-24 Thread Laszlo Nagy

On 2012-08-15 07:33, Ramchandra Apte wrote:

filter is bad when you use lambda with it
there are (good) cases for filter

On 14 August 2012 22:39, Jean-Michel Pichavant > wrote:


Ramchandra Apte wrote:

(Much) more Pythonic solution:
>>> filter(None,"|".split("|"))

On 14 August 2012 15:14, Andreas Tawn
mailto:andreas.t...@ubisoft.com>
>> wrote:

> I have a question about the split function? surpose a =
"|",and
when I use a.split("|") , I got the list
> ['"",""] ,but I want to get the empty list,what should I
do ?



Too many top posters again :-(

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


python-list@python.org

2012-08-24 Thread rusi
On Aug 24, 7:23 pm, Ramchandra Apte  wrote:
> As BFDL, I hereby command everybody to stop the discussion.
> lets put time on useful stuff
>
> i am using google groups (i think it knows what to do)

Your posts are coming in doubles.
And the quoted lines are coming double-spaced!

Actually the 'new' google groups is considerably more messed up than
the old.
And usually its hard to choose the old.

No offense intended... Just that since I was the one to recommend you
use gg, I feel obliged on conscience to mention this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Terry Reedy

On 8/24/2012 10:44 AM, Ramchandra Apte wrote:

On Wednesday, 22 August 2012 22:13:04 UTC+5:30, Terry Reedy  wrote:



  >>> timeit.timeit("list(i for i in ranger if False)", "ranger=range(0)")

>>

0.91

  >>> timeit.timeit("list(i for i in ranger if False)", "ranger=range(20)")

1.28

  >>> timeit.timeit("list(filter(lambda i: False, ranger))",

"ranger=range(0)")

0.83

  >>> timeit.timeit("list(filter(lambda i: False, ranger))",

"ranger=range(20)")

2.60


Your mail agent in inserting blank lines in quotes -- google?
See if you can turn that off.


Your examples with lambda i:False are unrealistic - you are comparing

> `if False` vs (xx) - function call vs boolean check

That is exactly the comparison I wanted to make. The iteration + boolean 
check takes .37 for 20 items, the iteration + call 1.77.


--
Terry Jan Reedy

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


Re: Flexible string representation, unicode, typography, ...

2012-08-24 Thread rusi
On Aug 24, 12:22 am, Ian Kelly  wrote:
> On Thu, Aug 23, 2012 at 12:33 PM,   wrote:
> >> >>> sys.getsizeof('a' * 80 * 50)
>
> >> > 4025
>
> >>  sys.getsizeof('a' * 80 * 50 + '•')
>
> >> > 8040
>
> >>     This example is still benefiting from shrinking the number of bytes
>
> >> in half over using 32 bits per character as was the case with Python 3.2:
>
> >>  >>> sys.getsizeof('a' * 80 * 50)
>
> >> 16032
>
> >>  >>> sys.getsizeof('a' * 80 * 50 + '•')
>
> >> 16036
>
> > Correct, but how many times does it happen?
> > Practically never.
>
> What are you talking about?  Surely it happens the same number of
> times that your example happens, since it's the same example.  By
> dismissing this example as being too infrequent to be of any
> importance, you dismiss the validity of your own example as well.
>
> > In this unicode stuff, I'm fascinated by the obsession
> > to solve a problem which is, due to the nature of
> > Unicode, unsolvable.
>
> > For every optimization algorithm, for every code
> > point range you can optimize, it is always possible
> > to find a case breaking that optimization.
>
> So what?  Similarly, for any generalized data compression algorithm,
> it is possible to engineer inputs for which the "compressed" output is
> as large as or larger than the original input (this is easy to prove).
>  Does this mean that compression algorithms are useless?  I hardly
> think so, as evidenced by the widespread popularity of tools like gzip
> and WinZip.
>
> You seem to be saying that because we cannot pack all Unicode strings
> into 1-byte or 2-byte per character representations, we should just
> give up and force everybody to use maximum-width representations for
> all strings.  That is absurd.
>
> > Sure, it is possible to optimize the unicode usage
> > by not using French characters, punctuation, mathematical
> > symbols, currency symbols, CJK characters...
> > (select undesired characters here:http://www.unicode.org/charts/).
>
> > In that case, why using unicode?
> > (A problematic not specific to Python)
>
> Obviously, it is because I want to have the *ability* to represent all
> those characters in my strings, even if I am not necessarily going to
> take advantage of that ability in every single string that I produce.
> Not all of the strings I use are going to fit into the 1-byte or
> 2-byte per character representation.  Fine, whatever -- that's part of
> the cost of internationalization.  However, *most* of the strings that
> I work with (this entire email message, for instance) -- and, I think,
> most of the strings that any developer works with (identifiers in the
> standard library, for instance) -- will fit into at least the 2-byte
> per character representation.  Why shackle every string everywhere to
> 4 bytes per character when for a majority of them we can do much
> better than that?

Actually what exactly are you (jmf) asking for?
Its not clear to anybody as best as we can see...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unittest - testing for filenames and filesize

2012-08-24 Thread Tigerstyle
Thank you guys, Roy and Terry.

I has been great help.

I still need some help. Here is the updated code:


Demostration of setUp and tearDown.
The tests do not actually test anything - this is a demo.
"""
import unittest
import tempfile
import shutil
import glob
import os

class FileTest(unittest.TestCase):

def setUp(self):
self.origdir = os.getcwd()
self.dirname = tempfile.mkdtemp("testdir")
os.chdir(self.dirname)

def test_1(self):
"Verify creation of files is possible"
filenames = {"this.txt", "that.txt", "the_other.txt"} 
for filename in filenames: 
f = open(filename, "w")
f.write("Some text\n")
f.close()
self.assertTrue(f.closed)
dir_names = set(os.listdir('.')) 
self.assertEqual(set(dir_names), set(filenames)) 

def test_2(self):
"Verify that current directory is empty"
self.assertEqual(glob.glob("*"), [], "Directory not empty")

def test_3(self):
f = open("test.dat", "wb")
filesize = b"0"*100
f.write(filesize)
f.close()
self.assertEqual(os.stat, filesize)
def tearDown(self):
os.chdir(self.origdir)
shutil.rmtree(self.dirname

The test_3 is to test if the created binary file har the size of 1 million 
bytes. Somehow it is not working. Any suggestions?
 
Thanks

T

kl. 21:06:29 UTC+2 torsdag 23. august 2012 skrev Roy Smith følgende:
> On Thursday, August 23, 2012 1:29:19 PM UTC-4, Terry Reedy wrote:
> 
> 
> 
> > One can start with a set rather than tuple of file names.
> 
> >  filenames = {"this.txt", "that.txt", "the_other.txt"}
> 
> 
> 
> Yeah, that's even cleaner.  Just be aware, the set notation above is only 
> available in (IIRC), 2.7 or above.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for duplicate modules

2012-08-24 Thread rusi
On Aug 23, 8:30 pm, Roy Smith  wrote:
> We got burned yesterday by a scenario which has burned us before.  We had 
> multiple copies of a module in sys.path.  One (the one we wanted) was in our 
> deployed code tree, the other was in /usr/local/lib/python/ or some such.  It 
> was a particularly confusing situation because we *knew* we had uninstalled 
> the copy in /usr/local/lib.  What we didn't know was that puppet was set up 
> to check to make sure it was there and reinstalled it automagically if it 
> ever disappeared!
>
> What often adds to the confusion in cases like this is that if you use a 
> package manager (such as apt-get) to manage your module deployments, when you 
> uninstall, the .py files get removed, but the .pyc's stay behind.
>
> I'm working on a tool which scans all the directories in sys.path and finds 
> any modules which appear multiple times in the path.  It'll also call out any 
> .pyc's it finds without matching py's.
>
> I know those are not strictly errors, but both of them are, for lack of a 
> better term, "deployment smells" and something to be warned about.  Before I 
> invest too much effort into building it, does such a tool already exist?

Not remotely an answer.
emacs has a list-load-path-shadows for the same/similar issue in
elisp.
As a language moves to being a system (programming) language, it seems
to me necessary that such a functionality is built into the language
and gets called as part of standard installation procedure.

>
> We're slowly moving more of our deployment to using virtualenv (with 
> --no-site-packages), but we're not fully there yet.  And even when we get 
> there, there will still be opportunities to make these sorts of mistakes.
>
> ---
> Roy Smith
> r...@panix.com

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


python-list@python.org

2012-08-24 Thread rusi
On Aug 24, 8:58 pm, rusi  wrote:
> On Aug 24, 7:23 pm, Ramchandra Apte  wrote:
>
> > As BFDL, I hereby command everybody to stop the discussion.
> > lets put time on useful stuff
>
> > i am using google groups (i think it knows what to do)
>
> Your posts are coming in doubles.
> And the quoted lines are coming double-spaced!

Just saw other double-posts
So checked the mailing list archive which does not seem to have them.

So please ignore my double-post comment (for now).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Flexible string representation, unicode, typography, ...

2012-08-24 Thread Mark Lawrence

On 24/08/2012 17:06, rusi wrote:



Actually what exactly are you (jmf) asking for?
Its not clear to anybody as best as we can see...



A knee in the temple and a dagger up the  ? :)  From another 
Monty Python sketch for those who don't know.


--
Cheers.

Mark Lawrence.

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


python-list@python.org

2012-08-24 Thread Chris Angelico
On Fri, Aug 24, 2012 at 11:53 PM, Prasad, Ramit
 wrote:
> Ulrich Eckhardt wrote:
>> BTW: You omitted the attribution line for the text you quoted, whom do
>> you blame for that? That said, "Nonsense" is a strong enough word to
>> start a flamewar... not nice.
> Fair enough. I typically leave off attribution because I would rather
> to discuss things with quotes instead of he-said and she-said. The
> focus should be on the idea/conversation and less about attributing
> "blame" to someone (and it is invariably more often negative attribution
> than positive). If attribution is preferred, I suppose I could always
> add it back in. Ironically, this is one of the things I wish Outlook
> was better about.

PLEASE add attribution back in. It's not about he-said/she-said, it's
about honesty and clarity in reporting. It's far easier to understand
the conversation when we know who said each part, and the normal
opening line that most mail clients put in has a handy condensed set
of headers.

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


Re: Looking for duplicate modules

2012-08-24 Thread Chris Angelico
On Fri, Aug 24, 2012 at 1:30 AM, Roy Smith  wrote:
> I'm working on a tool which scans all the directories in sys.path and finds 
> any modules which appear multiple times in the path.  It'll also call out any 
> .pyc's it finds without matching py's.
>

This is why I love high level languages. The core of your problem is
solved by a single dictionary object.

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


Re: Is Python a commercial proposition ?

2012-08-24 Thread Roy Smith
On Sunday, July 29, 2012 12:01:00 PM UTC-4, lipska the kat wrote:
> How is python used in the real world.

songza.com is pretty close to 100% python.  The only significant non-python 
code on the server side are mongodb, haproxy, and nginx.

> What sized projects are people involved with

We've got 102 KLOC in the application (i.e. code we wrote), plus another 104 
KLOC in django and 337 KLOC of other installed packages (i.e. everything in our 
virtualenv's site-packages directory).

Those numbers are just the raw output of doing "find ... -name *.py | xargs wc 
-l", so they include blank lines and comments.  So, all told, roughly a half 
million lines of python code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unittest - testing for filenames and filesize

2012-08-24 Thread Robert Day
On Fri, 2012-08-24 at 09:20 -0700, Tigerstyle wrote:

> def test_3(self):
> f = open("test.dat", "wb")
> filesize = b"0"*100
> f.write(filesize)
> f.close()
> self.assertEqual(os.stat, filesize)

> The test_3 is to test if the created binary file har the size of 1 million 
> bytes. Somehow it is not working. Any suggestions?
>  

rob@rivertam:~$ python
Python 2.7.3 (default, Jul 24 2012, 10:05:38) 
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat

>>> 

So that's what 'os.stat' is. Why are you testing whether that's equal to
b"0"*100?

(You may find the documentation on os.stat at
http://docs.python.org/library/os.html#os.stat helpful; it's a function
which takes a path as its argument, and returns an object with some
relevant attributes.)

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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Walter Hurry
On Fri, 24 Aug 2012 14:29:00 -0400, Dennis Lee Bieber wrote:

> It appears to be a change Google made in the last month or two... My
> hypothesis is that they are replacing hard EOL found in inbound NNTP
> with an HTML , and then on outgoing replacing the  with a pair of
> NNTP line endings. In contrast, text composed on Google is coming in as
> long single lines (since quoting said text in a response produces on a
> ">" at the start of the paragraph.

Google Groups sucks. These are computer literate people here. Why don't 
they just use a proper newsreader?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Chris Angelico
On Fri, Aug 24, 2012 at 11:27 PM, Grant Edwards  wrote:
> Ah, but as we are always fond of saying in this group "that's an
> implementation detail, and not part of the language definition".  The
> model where a compiler is "keeping notes about it in Narnia" is also
> perfectly valid. However, RAM is easier to find than magic wardrobes,
> so the "notes" are usually kept in RAM these days.

Maybe, but once you found that wardrobe, you'd have enough storage for
all your needs, AND it takes no time at all to retrieve it! I think we
should start developing NarPy at once.

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


python-list@python.org

2012-08-24 Thread Ethan Furman

Chris Angelico wrote:

PLEASE add attribution back in. It's not about he-said/she-said, it's
about honesty and clarity in reporting. It's far easier to understand
the conversation when we know who said each part  [. . .]


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


Coroutines framework for Python 3

2012-08-24 Thread Thibaut

Hi,

The question is in the title, is there any coroutine framework available 
for Python 3.2+ ? I checked gevent and eventlet but none of them seems 
to have a Py3k version.


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


calling loaded DLL function expecting POINT * argument

2012-08-24 Thread Tim Williams
Hello all,

I'm trying to use the ctypes module to call functions in a DLL. I've figured 
out how to modify my path so the library is found, and I can call LoadLibrary 
on it, but one of the functions expects an array of POINTS. Here is the 
prototype from the .h file:


TRACKER_API HRESULT InitializeMask(HANDLE pHandle, int nWidth, int nHeight, 
POINT* ptMasks, int nNumPoints);

I did a 

from ctypes.wintypes import *

Here's my test script:
##
'''
Created on Aug 23, 2012

@author: williams
'''
import os
import numpy as np
import scipy.io
from ctypes import *
from ctypes.wintypes import *


matdata = 
scipy.io.loadmat(os.path.join(os.environ['userprofile'],'Desktop','S31_f1.mat'))
data = matdata['data']
nHeight,nWidth = data.shape

pth = os.environ['path'].split(';')
pth.append(os.path.join(os.environ['userprofile'],'My Documents','DLLs'))
os.environ['path'] = ';'.join(pth)
tck=oledll.LoadLibrary('Tracker')
hTrkr = tck.CreateTracker()
maskImage = np.zeros((1024,1280),dtype='int32')
maskImage[300:305,100:105] = True
idx = np.array(maskImage.nonzero())
nPoint = idx.shape[1]

ptMaskType = nPoint * POINT
pts = zip(idx[1,:],idx[0,:])
ptMasks = ptMaskType(*pts)

tck.InitializeMask.argtypes=(HANDLE, c_int, c_int, c_void_p, c_int)
InitMaskResult = tck.InitializeMask(hTrkr, nWidth, nHeight, ptMasks, nPoint)

if __name__ == '__main__':
pass
##

so I have the POINT class, and I've created the array of POINTs. When I try to 
call this function, I get this message:

>>> InitMaskResult = tck.InitializeMask(hTrkr, nWidth, nHeight, ptMasks, nPoint)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Procedure probably called with too many arguments (20 bytes in 
excess)


This is the first time that I've tried to use the ctypes module, so any help is 
appreciated.

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


Re: help with simple print statement!

2012-08-24 Thread Chris Kaynor
On Fri, Aug 24, 2012 at 12:43 PM, Willem Krayenhoff wrote:

> Any idea why print isn't working here?
>
> I tried restarting my Command prompt.  Also, print doesn't work inside a
> class.
>
> [image: Inline image 2]
>

In Python 3, print was made into a function rather than a statement for
various reasons (I'll leave it to the reader to find sources as to why).
You just need to call it rather than use it as a statement.


> --
> Best Wishes,
>
>  Bruce
>  C: 604-441-5791
>  My 
> Availability
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
<>-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with simple print statement!

2012-08-24 Thread Rob Day
On Fri, 2012-08-24 at 12:43 -0700, Willem Krayenhoff wrote:
> Any idea why print isn't working here?  

You're using Python 3.2, but trying Python 2.7 syntax -
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function 
should explain the problem adequately.

(Incidentally - you can copy from the Windows console by right-clicking
and selecting "Mark". It's a little easier than taking a screenshot!)

Rob




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


Re: help with simple print statement!

2012-08-24 Thread Zero Piraeus
:

On 24 August 2012 15:43, Willem Krayenhoff  wrote:
> Any idea why print isn't working here?

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function

Also, pasting images into emails to this list is unlikely to gain you
many friends ...

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: help with simple print statement!

2012-08-24 Thread Prasad, Ramit

Willem Krayenhoff
Any idea why print isn't working here?  

I tried restarting my Command prompt.  Also, print doesn't work inside a class.


-- 
Best Wishes,

     Bruce
     C: 604-441-5791
     My Availability 



Just as a note, this is a usenet group that can be accessed via email; a good 
portion of the people on the list does not receive attachments and images. HTML 
is also a bad format as it mangles code so please post in plain text and 
copy/paste from the command line instead of using screenshots.  It will be easy 
for us to run your code if necessary to reproduce the results.

Now on to your problem. You are using Python 3 where print was turned from a 
statement into a function. You need to use the following instead. 

print('34ki') 
print(6)
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


proper reply format [was Re: help with simple print statement!]

2012-08-24 Thread Ethan Furman

Prasad, Ramit wrote:

Willem Krayenhoff
Any idea why print isn't working here?  


I tried restarting my Command prompt.  Also, print doesn't work inside a class.




Ramit,

The standard for attribution is something along the lines of:

Prasad, Ramit wrote:

or

Willem Kayenhoff wrote:

Just having Willem's name at the top was confusing.  Also, because you 
didn't trim his signature, the rest of your reply looked like a 
signature to Thunderbird (which uses a line of '--' to figure the start 
of signatures).  As you can see, the rest of your post was trimmed away 
as signature lines when I hit Reply.


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


RE: help with simple print statement!

2012-08-24 Thread Bruce Krayenhoff
Thank-you all, it works now!


Best Wishes,

 Bruce
 C: 604-441-5791
 
 My Availability 

 

From: python-list-bounces+wbrucek=gmail@python.org
[mailto:python-list-bounces+wbrucek=gmail@python.org] On Behalf Of Chris
Kaynor
Sent: August-24-12 12:54 PM
To: python-list@python.org
Subject: Re: help with simple print statement!

 

On Fri, Aug 24, 2012 at 12:43 PM, Willem Krayenhoff mailto:wbru...@gmail.com> > wrote:

Any idea why print isn't working here?  

 

I tried restarting my Command prompt.  Also, print doesn't work inside a
class.

 

 

 

In Python 3, print was made into a function rather than a statement for
various reasons (I'll leave it to the reader to find sources as to why). You
just need to call it rather than use it as a statement.

 

-- 
Best Wishes,

 Bruce
 C: 604-441-5791  
 My Availability
  


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

 

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


Re: proper reply format

2012-08-24 Thread Christian Heimes
Am 24.08.2012 22:31, schrieb Ethan Furman:
> Just having Willem's name at the top was confusing.  Also, because you
> didn't trim his signature, the rest of your reply looked like a
> signature to Thunderbird (which uses a line of '--' to figure the start
> of signatures).  As you can see, the rest of your post was trimmed away
> as signature lines when I hit Reply.

Almost ;)

The correct signature separator is "\n-- \n". That's a line made up
entirely of dash, dash, space followed by a newline.

Christian


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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Terry Reedy

On 8/24/2012 5:56 PM, Dennis Lee Bieber wrote:

On Fri, 24 Aug 2012 19:03:51 + (UTC), Walter Hurry
 declaimed the following in
gmane.comp.python.general:



Google Groups sucks. These are computer literate people here. Why don't
they just use a proper newsreader?


Probably because their ISP doesn't offer a free server 


Python lists are available on the free gmane mail-to-news server.



--
Terry Jan Reedy

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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Emile van Sebille

On 8/24/2012 3:03 PM Terry Reedy said...

On 8/24/2012 5:56 PM, Dennis Lee Bieber wrote:

On Fri, 24 Aug 2012 19:03:51 + (UTC), Walter Hurry
 declaimed the following in
gmane.comp.python.general:



Google Groups sucks. These are computer literate people here. Why don't
they just use a proper newsreader?


Probably because their ISP doesn't offer a free server 


Python lists are available on the free gmane mail-to-news server.


I'm getting high load related denials with the gmane connections a lot 
recently so I'm open to alternatives.


Suggestions or recommendations?


Emile



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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Mark Lawrence

On 24/08/2012 23:03, Terry Reedy wrote:

On 8/24/2012 5:56 PM, Dennis Lee Bieber wrote:

On Fri, 24 Aug 2012 19:03:51 + (UTC), Walter Hurry
 declaimed the following in
gmane.comp.python.general:



Google Groups sucks. These are computer literate people here. Why don't
they just use a proper newsreader?


Probably because their ISP doesn't offer a free server 


Python lists are available on the free gmane mail-to-news server.



I don't think the core-mentorship list is available on gmane.  Have I 
missed it, has nobody asked for it to go on there or what?



--
Cheers.

Mark Lawrence.

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


concurrent.futures inconsistency?

2012-08-24 Thread Mark Summerfield
Hi,

It seems that in concurrent.futures, ProcessPoolExecutor() can be used
with no args and default to max_workers=multiprocessing.cpu_count();
but for ThreadPoolExecutor() the max_workers arg is required. Is this
intentional? (I'm using Python 3.2.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-08-24 Thread Alex
I'm new to Python and have been using IDLE 3.2.3 to experiment with
code as I learn. Despite being configured to use a 4 space indentation
width, sometimes IDLE's "smart" indentation insists upon using width-8
tabs.

>From what I've been able to find on Google, this is due to a
shortcoming in Tk. While it's not that big a deal in the grand scheme
of things, I think it looks like poop, and I'd like to change IDLE to
use 4-space indentation instead of tabs for all indentation levels.

Is there any way for me to achieve what I want in IDLE, or do I have to
start up my full-blown IDE if I want consistent 4-space indentation?

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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Ned Deily
In article ,
 Emile van Sebille  wrote:
> On 8/24/2012 3:03 PM Terry Reedy said...
> > Python lists are available on the free gmane mail-to-news server.
> I'm getting high load related denials with the gmane connections a lot 
> recently so I'm open to alternatives.

The high load denials should be a thing of the past as the gmane NNTP 
server was very recently upgraded to use SSDs instead of standard disks.

-- 
 Ned Deily,
 n...@acm.org

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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Ned Deily
In article ,
 Mark Lawrence  wrote:
> I don't think the core-mentorship list is available on gmane.  Have I 
> missed it, has nobody asked for it to go on there or what?

core-mentorship is a closed list so it would not be appropriate for it 
to be mirrored anywhere.

http://mail.python.org/mailman/listinfo/core-mentorship

-- 
 Ned Deily,
 n...@acm.org

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


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Walter Hurry
On Fri, 24 Aug 2012 17:56:47 -0400, Dennis Lee Bieber wrote:

> On Fri, 24 Aug 2012 19:03:51 + (UTC), Walter Hurry
>  declaimed the following in
> gmane.comp.python.general:
> 
> 
>> Google Groups sucks. These are computer literate people here. Why don't
>> they just use a proper newsreader?
> 
>   Probably because their ISP doesn't offer a free server 

There are plenty of free Usenet providers.
-- 
http://mail.python.org/mailman/listinfo/python-list


Unit test discovery with XML Runner?

2012-08-24 Thread lucretiel
Hey All,

I've just started with the unittest module and I love it. I've been using test 
discovery- "python -m unittest discover" from the command line- so that I can 
distribute my tests amongst files instead of having tp manage them all. I'd 
like to publish the test results, though. Googling pointed me to xmlrunner, 
which seems perfect, but requires me to add the if name=='__main__ line to all 
my tests, which isn't run my test discovery. Is there a way to use xml runner 
with test discovery, or another way to solve the problem?

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


Re: Flexible string representation, unicode, typography, ...

2012-08-24 Thread Antoine Pitrou
Ramchandra Apte  gmail.com> writes:
> 
> The zen of python is simply a guideline

What's more, the Zen guides the language's design, not its implementation.
People who think CPython is a complicated implementation can take a look at 
PyPy 
:-)

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net


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


Publish unittest results from test discovery

2012-08-24 Thread Lucretiel
So I've started using unittest, and I love it. I use testdiscovery (python -m 
unittest discover) so that I can distribute my tests and don't have to manage 
them all manually. I wanted to start publishing my test results to xml, though. 
I found xmlrunner by googling around, but it requires me to add an if __name__ 
== '__main__' block to my code, which isn't executed by unittest discover. Is 
there a way to get unittest disover to work with xmlrunner, or to some other 
way to solve this without restructuring all my test code?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Publish unittest results from test discovery

2012-08-24 Thread Steven D'Aprano
On Fri, 24 Aug 2012 17:25:05 -0700, Lucretiel wrote:

[...]
> Is there a way to get unittest disover to work with xmlrunner

Steady on there! It's only been about an hour and a half since you last 
asked this exact same question, almost word-for-word identical. The more 
specialised the question, the longer it may take for somebody who knows 
the answer to reply. For something like this, I would wait at least a 
couple of days before replying to your original post. (Don't just re-post 
the question in a new thread, keep the response in a single thread.)

I have no idea about xmlrunner and unittest discovery, sorry.


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


python-list@python.org

2012-08-24 Thread Dave Angel
On 08/24/2012 12:39 PM, rusi wrote:
> On Aug 24, 8:58 pm, rusi  wrote:
>> 

>> Your posts are coming in doubles.
>> And the quoted lines are coming double-spaced!
> Just saw other double-posts
> So checked the mailing list archive which does not seem to have them.
>
> So please ignore my double-post comment (for now).

I solved nearly all the double-posts here by a simple rule which deletes
any message which is either To or CC: to googlegroups.  Each such
message has another which does not.



-- 

DaveA

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


Re: Variables vs names [was: Objects in Python]

2012-08-24 Thread Steven D'Aprano
On Thu, 23 Aug 2012 14:22:08 -0500, Evan Driscoll wrote:

> On 08/23/2012 12:56 PM, Steven D'Aprano wrote:
>> On Thu, 23 Aug 2012 12:17:03 -0500, Evan Driscoll wrote:
>> 
>>> I definitely *wouldn't* say "Python
>>> classes aren't really classes" -- even though (I assert) Python
>>> classes are *far* further from Simula-style (/Java/C++) classes than
>>> Python variables are from Java variables.
>> 
>> Well, Python classes are first-class (pun not intended) objects in
>> their own right, and hence are data. Java and C++ classes are not, they
>> are instructions to the compiler rather than data.
>> 
>> But other than that, what do you see as the difference between Python
>> classes and Simula-style classes?
> 
> So first, to some extent that's like saying "these two different things
> are different in this important way, but other than that, what's the
> difference?" :-)

Yes, exactly. I acknowledge a difference between the two, and ask you 
what differences you see.

Many languages do not have "first-class functions" -- you cannot pass a 
function to another function as an argument, or generate them on the fly 
at runtime. But the ability of functions to be treated as data is not an 
essential part of being-a-function, so I see no problem with describing 
both Pascal functions and Python functions as functions.

Likewise, being able to pass classes around as data and generate them on 
the fly is not an essential part of being-a-class, to I see no problem 
with describing both Java classes and Python classes as classes.


> But there are some other differences. (Not all of these are strictly
> with classes per se, but I would say they all have strong interactions
> with the object system.)

I don't believe that any of those differences in behaviour are either 
critical, or (as you acknowledge) strictly in the concept of *class* 
itself. I think they're interesting differences, but I don't think they 
are essential to the nature of "classness" in the same way that having a 
fixed memory address is essential to the nature of "memory location 
variable" or a name in a namespace is essential to "name binding 
variable".


[...]
>> Python has classes. They are created by the "class" keyword. Whether
>> those classes are identical to Java classes is irrelevant -- in Python,
>> these whatever-they-are-things are called "classes", and so Python has
>> classes.
>> 
>> But Python does not have things called "variables". There is no
>> "variable" keyword to create a variable.
> 
> OK, let's make a new language. I'll call it 'Python--' because at least
> *I* wouldn't want to program in it. :-)
> 
> In Python--, any time you use a name, you have to prefix it with the
> word 'variable':
>   variable x = 4
>   print(variable x)
> 
> Does Python-- have variables? 

Of course, because that's what Python-- calls them. Whether Python-- is 
*justified* in calling them variables is a more interesting question.

I think it is, in the sense that name bindings are a kind of variable, 
and fixed memory locations are a different kind of variable. But I also 
think that it isn't, for exactly the reasons why I prefer to describe 
Python (without the minuses) as having name bindings rather than 
variables "in the C or Pascal sense".

Ultimately what is important are the semantics of the words, not the 
words themselves. Objections to use of "variable" are, I believe, 
*pragmatic* objections that the word comes with too much baggage to be 
safe to use, not that name bindings aren't a type of variable.


> Think of it as duck-typing the term "variable". :-) To me, Python locals
> and globals look and quack like a variable.

And so they should, since name bindings are a way of implementing the 
abstract Variable kind, so to speak.


> Incidentally, I also realized another reason I don't like the 'names'
> description. Take 'foo.bar'. (That is, the 'bar' attribute in object
> 'foo'.) Is 'foo.bar' a name? 

Is "Evan Driscoll" a name? Or is it two names?

There is no contradiction to say that "Evan Driscoll" is both a name (a 
"compound name", if you like, or fully-qualified name) and two names (a 
personal name plus a family name).

foo.bar is both a fully-qualified name and two names: the name of the 
namespace and the name of the attribute in the namespace.


> I'm not sure what the 'names' proponents
> would say, but to me both answers are problematic. I *really* dislike a
> 'no' answer because to me, 'foo.bar' absolutely *is* a name for the
> corresponding object. (This terminology has precedent.) But a 'yes'
> answer, if you also reject 'variable', means you no longer have an
> agreed-upon term for the names that are defined in the current scope

"Local names".

We also have "global names" for those in the global scope, "builtin 
names" for those in the built-ins, and "nonlocal names".



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


Re: Objects in Python

2012-08-24 Thread Steven D'Aprano
On Fri, 24 Aug 2012 08:00:59 +1000, Chris Angelico wrote:

> On Fri, Aug 24, 2012 at 3:56 AM, Steven D'Aprano
>  wrote:
>> But name bindings are a kind of variable. Named memory locations are a
>> *different* kind of variable. The behaviour of C variables and Python
>> variables do not follow the Liskov Substitution Principle -- you can't
>> rip out the entire "names bound to objects" machinery of Python and
>> replace it with C-like named memory locations without changing the
>> high- level behaviour of Python. And so by some ways of thinking it is
>> *wrong* to treat name bindings and memory locations as "the same sort
>> of entity". Hence, if C variables are variables, then Python name
>> bindings can't be.
> 
> Yet Python's variables are extremely close to C's pointer variables.

Not really. Pointer variables are no different from any other variable: 
you have a named memory location that contains some data. In this case, 
the data happens to be a link to another chunk of memory. The pointer 
variable itself is just a named location containing data, same as a char 
variable, a float variable, etc. The data is a pointer rather than a char 
or float, and the operations which you can do to pointers are different 
to those you can do to chars or floats, but that's true of any data type.

In languages without pointers, like Fortran 77, you can more or less 
simulate them with a fixed array of memory as the heap, with integer 
indexes into that array as pointers. These "pointer variables" are no 
different from other "integer variables" except in the meaning you, the 
programmer, gives them. This is no different from how C or Pascal treat 
pointers, except that those languages have syntactical support for 
pointer operations and Fortran 77 doesn't.


> If
> you allocate all your "real data" on the heap and do everything with
> pointers, you'll have semantics very similar to Python's

You're confusing two different levels of explanation here. On the one 
hand, you're talking about C semantics, where you are explicitly 
responsible for managing unnamed data via indirection (pointers). 
Typically, the *pointers* get given names, the data does not.

On the other hand, you talk about Python, where you have no access at all 
to the pointers and memory addresses. You manage the data you actually 
care about by giving them names, and then leave it up to the Python 
virtual machine to transparently manage whatever indirection is needed to 
make it work.

The fact that the end result is the same is hardly surprising -- Python's 
VM is built on top of C pointer indirection, so of course you can start 
with pointers and end up with Python semantics. But the practice of 
coding are very different:

* in C, I care about identifiers ("names") in order to explicitly manage 
addresses and pointers as a means to reach the data I actually care about;

* in Python, I care about identifiers in order to reach the data I 
actually care about.



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


fabric problem with ssh

2012-08-24 Thread Tim Arnold
I am getting started with fabric and trying to connect to any machine in 
my known hosts file. I want fabric to figure out that it doesn't need me 
to enter my password.


My fabfile.py:

from fabric.api import run, env
env.disable_known_hosts=False

def lsfiles():
run('ls -l ~/')

My console result:

> fab lsfiles
No hosts found. Please specify (single) host string for connection: 
localhost


[localhost] run: ls -l ~/
[localhost] Passphrase for private key:

... file listing follows ...

How can I get fabric to use my .ssh/known_hosts file?

system details:
Python 2.7.3 (default, Aug 22 2012, 13:09:20)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2

thanks,
--Tim Arnold


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


Re: Variables vs names

2012-08-24 Thread Ben Finney
Steven D'Aprano  writes:

> On Thu, 23 Aug 2012 14:22:08 -0500, Evan Driscoll wrote:
>
> > In [the hypothetical language] Python--, any time you use a name,
> > you have to prefix it with the word 'variable':
> >   variable x = 4
> >   print(variable x)
> > 
> > Does Python-- have variables? 
>
> Of course, because that's what Python-- calls them. Whether Python--
> is *justified* in calling them variables is a more interesting
> question.

How many legs does a horse have, if you call the tail a leg?

Four. Calling the tail a leg doesn't make it so.


Similarly, I don't care that Python-- uses the term “variable”, it only
has variables if it has things which meet a sensible definition of
“variable”. So no, “because that's what Python-- calls them” is not
sufficient.

> I think it is, in the sense that name bindings are a kind of variable,
> and fixed memory locations are a different kind of variable. But I
> also think that it isn't, for exactly the reasons why I prefer to
> describe Python (without the minuses) as having name bindings rather
> than variables "in the C or Pascal sense".

To emphasise what may not be apparent to some newcomers, Steven and I
are virtually in exact agreement here. We talk more about where we
differ because that's what interests us :-)

-- 
 \  “In the long run, the utility of all non-Free software |
  `\  approaches zero. All non-Free software is a dead end.” —Mark |
_o__)Pilgrim, 2006 |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


PyPyODBC 0.8 released (Pure Python ODBC module)

2012-08-24 Thread 江文
PyPyODBC - A Pure Python ctypes ODBC module

Changes in version 0.8:
Added the getinfo() method to the connection object

Changes in version 0.7:
Fixed the ntext/nchar/nvarchar  string truncat problem


Changes in version 0.6:
Added Cursor.commit() and Cursor.rollback().
Added readonly keyword to connect.

Features
-Pure Python, compatible with PyPy (tested on Win32)
-Almost totally same usage as pyodbc

You can simply try pypyodbc in your existing pyodbc powered script
with the following changes:

   #import pyodbc<-- Comment out
the original pyodbc importing line
   import pypyodbc as pyodbc # Let pypyodbc "pretend" the pyodbc
   pyodbc.connect(...)  # This is pypyodbc
pretending pyodbc! They have same APIs!
...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Objects in Python

2012-08-24 Thread Chris Angelico
On Sat, Aug 25, 2012 at 1:04 PM, Steven D'Aprano
 wrote:
> You're confusing two different levels of explanation here. On the one
> hand, you're talking about C semantics, where you are explicitly
> responsible for managing unnamed data via indirection (pointers).
> Typically, the *pointers* get given names, the data does not.
>
> On the other hand, you talk about Python, where you have no access at all
> to the pointers and memory addresses. You manage the data you actually
> care about by giving them names, and then leave it up to the Python
> virtual machine to transparently manage whatever indirection is needed to
> make it work.
> ...
> * in C, I care about identifiers ("names") in order to explicitly manage
> addresses and pointers as a means to reach the data I actually care about;
>
> * in Python, I care about identifiers in order to reach the data I
> actually care about.

Yet the two are almost the same. Python objects don't have names, they
just have their own data. (Leaving aside functions, which have their
names as data for the benefit of tracebacks and such.) A C pointer has
a name; a Python identifier has (or is, if you like) a name. They're
very different in how you use them only because C doesn't naturally
work with everything on the heap and pointers everywhere. In fact,
when I was interfacing Python and C, there were a few places where I
actually handed objects to Python and kept manipulating them, simply
because the Python data model suited what I was trying to do; but what
I was doing was using PyObject *some_object as though it were a Python
variable. I even did up a trivial C++ class that encapsulated the
INCREF/DECREF work, so my LocalPyObject really could be treated as a
local variable, Python-style.

Where's the difference?

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