Re: video analysis with python

2005-01-16 Thread Ashot
On Mon, 17 Jan 2005 08:08:46 +0100, Alexander 'boesi' Bösecke <[EMAIL PROTECTED]> wrote: Hi Am 16.01.2005 12:44:27 schrieb Miki Tebeka: 1. There is PyMedia (http://pymedia.org/) Is this library able to extract single images from a video? AFAICS it can only convert videos from one format to anoth

pythonnt_rc_d.h is missed when building python from source ?

2005-01-16 Thread cr999
I download the source code of Python-2.3.4 from python.org. But I can't build python from source under Win2000. The compiler complained that there is no pythonnt_rc_d.h file which is included in Python-2.3.4\PC\python_nt.rc.   Who knows the reason ?   Thanks.   Best Regards.   R

Re: video analysis with python

2005-01-16 Thread Alexander 'boesi' Bösecke
Hi Am 16.01.2005 12:44:27 schrieb Miki Tebeka: > 1. There is PyMedia (http://pymedia.org/) Is this library able to extract single images from a video? AFAICS it can only convert videos from one format to another. But I didn't try it, I've looked only in the docu. Maybe pyVideo (http://www.geoci

Re: [perl-python] 20050116 defining a function

2005-01-16 Thread Ala Qumsieh
Xah Lee wrote: © my $n= @_[0]; Do you ever test your code before making fun of yourself in front of millions? *plonk* --Ala -- http://mail.python.org/mailman/listinfo/python-list

Re: fefinining % of c'm'y and k

2005-01-16 Thread John Lenton
On Sun, Jan 16, 2005 at 09:57:46PM -0800, [EMAIL PROTECTED] wrote: > hello > i need a program (and pleas shoe me the modol in the softwar) that : > if i have a scaned photo > i want to define out of each poligon color ,as it seems in the photo, > the cmyk > in % (percets) of the color/ > 4 exampl f

Re: [perl-python] 20050117, filter, map

2005-01-16 Thread Erik Max Francis
Steven Bethard wrote: Is there any chance you could post these all as part of the same thread? That would be really nice for those of us who aren't interested -- then we could just ignore the thread... Or, better yet, not posting it at all. He's got his mailing list, what does he need to pos

RE: fefinining % of c'm'y and k

2005-01-16 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote: > hello > i need a program (and pleas shoe me the modol in the softwar) that : > if i have a scaned photo > i want to define out of each poligon color ,as it seems in the photo, > the cmyk > in % (percets) of the color/ > 4 exampl from poligon color orang defin the cmyk in

fefinining % of c'm'y and k

2005-01-16 Thread moshebg
hello i need a program (and pleas shoe me the modol in the softwar) that : if i have a scaned photo i want to define out of each poligon color ,as it seems in the photo, the cmyk in % (percets) of the color/ 4 exampl from poligon color orang defin the cmyk in % like that: (example) c: 30% m:56% y:7

Re: [perl-python] 20050117, filter, map

2005-01-16 Thread Steven Bethard
Xah Lee wrote: © Note: this post is from the Perl-Python © a-day mailing list at © http://groups.yahoo.com/group/perl-python/ Is there any chance you could post these all as part of the same thread? That would be really nice for those of us who aren't interested -- then we could just ignore the

strange note in fcntl docs

2005-01-16 Thread John Lenton
In the fnctl docs for both python 2.3 and 2.4 there is a note at the bottom that says The os.open() function supports locking flags and is available on a wider variety of platforms than the lockf() and flock() functions, providing a more platform-independent file locking facility.

Re: List problems in C code ported to Python

2005-01-16 Thread Paul McGuire
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael Hoffman wrote: > > Paul McGuire wrote: > >> So "A" == 'a' is true in Python, not true in C. > > I think you meant: > > > > >>> "A" == "A" > > True > > Er, "A" == 'A' > -- > Michael Hoffman Yeah, that's the on

[perl-python] 20050117, filter, map

2005-01-16 Thread Xah Lee
© # -*- coding: utf-8 -*- © # Python © © # the "filter" function can be used to © # reduce a list such that unwanted © # elements are removed. © # example: © © def even(n): return n % 2 == 0 © print filter( even, range(11)) © © © # the "map" function applies a function © # to all elements of a list

Re: [perl-python] 20050115, for statement

2005-01-16 Thread Peter Hansen
Jeremy Bowers wrote: (Hell, five days into Python and some people are already producing working Backgammon games (I think that was the post last week), and Xah Lee here is still on for loops! Woo! Go Xah!) Mah Jongg, actually (if we're thinking of the same post), which name is often applied in the

Re: List problems in C code ported to Python

2005-01-16 Thread Grant Edwards
On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: >>>Please see both the Python and C code at >>>http://home.earthlink.net/~lvraab. The two files are ENIGMA.C >>>and engima.py >> >> http://www.catb.org/~esr/faqs/smart-questions.html > > I didn't expect to get bitched out just because I didn'

Re: python mode indentation problem

2005-01-16 Thread Bob Smith
Xah Lee wrote: © ok, here's the ordeal. © © for i in range(5): © print i © for i in range(2): © print i, 'tt' © for i in [3]: © print i © for i in [32]: © print i © © # 1 level, 4 space © # 2 level, 1 tab © # 3 level, 1 tab, 4 spaces © # 4 level

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Michael Hoffman wrote: Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. I think you meant: >>> "A" == "A" True Er, "A" == 'A' -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: import problems *newbie*

2005-01-16 Thread Grig Gheorghiu
In my experience (as a tester), it is easier to deal with PYTHONPATH than to add the my.pth file to the site-packages directory. The main reason is that I have my custom packages and modules in a directory tree that I deploy on many clients/servers/platforms/OS versions, some running different vers

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Lucas Raab wrote: Grant Edwards wrote: http://www.catb.org/~esr/faqs/smart-questions.html I didn't expect to get bitched out just because I didn't follow "protocol." I didn't see anyone bitch you out. And you were lucky that one person was kind enough to go through your web site and make some sug

Re: List problems in C code ported to Python

2005-01-16 Thread Irmen de Jong
Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. It's not true in Python either. You probably meant to say: "a" == 'a' (lowercase a) --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. >>> "A" == 'a' False I think you meant: >>> "A" == "A" True -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Roy Smith
"Paul McGuire" <[EMAIL PROTECTED]> wrote: > "A" == 'a' is true in Python, not true in C. It could be true in C, if the string is stored in very low memory :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Paul McGuire
"Lucas Raab" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm done porting the C code, but now when running the script I > continually run into problems with lists. I tried appending and > extending the lists, but with no avail. Any help is much appreciated > Please see both the Py

Re: List problems in C code ported to Python

2005-01-16 Thread Lucas Raab
Grant Edwards wrote: On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: I'm done porting the C code, but now when running the script I continually run into problems with lists. I tried appending and extending the lists, but with no avail. Any help is much appreciated Please see both the Python

Re: Excel module for Python

2005-01-16 Thread Erwin S. Andreasen
Simon Brunning <[EMAIL PROTECTED]> writes: > On Wed, 12 Jan 2005 23:19:44 +0800, sam <[EMAIL PROTECTED]> wrote: >> >> No, I don't use MS windows. I need to generate Excel file by printing >> data to it, just like Perl module Spreadsheet::WriteExcel. > If you need to write out formulae, formrattin

Re: import problems *newbie*

2005-01-16 Thread mike kreiner
Thanks for your help Steve and F. Petitjean. Sorry for taking so long to get back, I was away from my lab for a few days. The path to my directory was not included in the sys.path list. Adding a my.pth file to the site-packages directory fixed the import problem. F. Petitjean, I originally edited

Re: Executing a script created by the end user

2005-01-16 Thread Steven Bethard
Craig Howard wrote: I am working on a python project where an object will have a script that can be edited by the end user: object.script If the script is a simple one with no functions, I can easily execute it using: exec object.script But if the object script is a bit more complicated, su

Re: How to del item of a list in loop?

2005-01-16 Thread John Machin
skull wrote: > According to Nick's article, I added three 'reversed' methods to your provided > test prog. and the result turned out method_reversed is faster than others except the 'three' case. > Following is my modified version: [snip] > def method_reversed_idx(lst): > idx = 0 > for i

Re: why are some types immutable?

2005-01-16 Thread Peter Maas
Torsten Mohr schrieb: reading the documentation (and also from a hint from this NG) i know now that there are some types that are not mutable. But why is it this way? Immutable types (e.g. strings, tuples) allow for code optimization in some situations and can be used as dictionary keys. For the la

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Lucas Raab wrote: Please see both the Python and C code at http://home.earthlink.net/~lvraab. The two files are ENIGMA.C and engima.py If you post a small testcase here you are much more likely to get helped. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: module structure and import question

2005-01-16 Thread Rob Emmons
> yes i know it's related to search path, but i don't know how to set it in a > practical way (beside hard coding). > my concern is, if i want to create a custom module/library, i don't know > what py file will import it and where the working directory should be. Regarding where the current workin

Re: PyChecker messages

2005-01-16 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Roger Binns <[EMAIL PROTECTED]> wrote: . . . >> runner.py:200: Function (detectMimeType) has too many returns (11) >> >> The function is simply a long "else-if" clause, branching out to different

Re: Checking for X availability

2005-01-16 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Nils Nordman <[EMAIL PROTECTED]> wrote: >On Tue, Jan 11, 2005 at 03:32:01AM -0800, Flavio codeco coelho wrote: >> So my question is: how can I check for the availability of X? i.e., >> How will my program know if its running in a text only console or in >> console w

PythonMagick Update

2005-01-16 Thread Achim Domma (Procoders)
Hi, I'm working on a new version of PythonMagick, a wrapper for GraphicsMagick. A first version is available at: http://public.procoders.net/cgi-bin/trac.cgi/wiki/PythonMagick Any feedback is very appreciated. regards, Achim -- http://mail.python.org/mailman/listinfo/python-list

Re: why are some types immutable?

2005-01-16 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Dan Bishop" <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > Torsten Mohr <[EMAIL PROTECTED]> wrote: > > > reading the documentation (and also from a hint from this NG) > > > i know now that there are some types that are not mutable. > > > > > > But why is it thi

Re: protecting the python code.

2005-01-16 Thread Steve Holden
nell wrote: Hi Steve, First the "10x in advance" means thanks in advance. The main importance of protecting my code is to save headache of customers that want to be smart and change it and then complain on bugs and problems. 10x I'd have understood "tnx", never seens 10x b4 :-) Your concerns are

Re: why are some types immutable?

2005-01-16 Thread Dan Bishop
Roy Smith wrote: > Torsten Mohr <[EMAIL PROTECTED]> wrote: > > reading the documentation (and also from a hint from this NG) > > i know now that there are some types that are not mutable. > > > > But why is it this way? > > > > From an overhead point of view i think it is not optimal, > > for examp

Re: nntplib: abstraction of threads

2005-01-16 Thread Steve Holden
Werner Amann wrote: Rakesh schrieb: What I want is to *group the messages belonging to each thread* . Hello Why not sort with Message-ID and References? Attention - it is a Newbie-Solution. import nntplib hamster = nntplib.NNTP('127.0.0.1', 119, 'user', 'pass') resp, count, first, last, name = ha

Re: nntplib: abstraction of threads

2005-01-16 Thread Werner Amann
Rakesh schrieb: > What I want is to *group the messages belonging to each thread* . Hello Why not sort with Message-ID and References? Attention - it is a Newbie-Solution. import nntplib hamster = nntplib.NNTP('127.0.0.1', 119, 'user', 'pass') resp, count, first, last, name = hamster.group('co

Re: pygame + py2exe = bad exe. why?

2005-01-16 Thread Erik Bethke
M.E.Farmer wrote: > > Erik glad to see you were able to track it down. > Have you been succesful in making the changes they mentioned? > M.E.Farmer Yes below is a simple script that works. The key was that pygame uses freesansbold.ttf as the default font and that is not copied over in the normal

Re: Why would I get a TypeEror?

2005-01-16 Thread Steven Bethard
Stian Soiland wrote: På 14. jan 2005 kl. 22:58 skrev Steven Bethard: (Any mac users? How do I fix this to appear in Norwegian? =) Note that if you're not comfortable with short-circuiting behavior, you can also code this using lazy evaluation: (lambda: 1/x, lambda: 1.0e99)[x==0]() .. and peo

Re: protecting the python code.

2005-01-16 Thread nell
Hi Steve, First the "10x in advance" means thanks in advance. The main importance of protecting my code is to save headache of customers that want to be smart and change it and then complain on bugs and problems. 10x -- http://mail.python.org/mailman/listinfo/python-list

Re: Integration with java (Jpype vs. JPE)

2005-01-16 Thread Steve Menard
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, Jon Perez <[EMAIL PROTECTED]> wrote: Can someone summarize in a nutshell what is the difference between JPype and JPE? JPE's the original. It provided more functionality than JPype has achieved so far, I believe (though that could change any d

RE: generator expressions: performance anomaly?

2005-01-16 Thread Delaney, Timothy C (Timothy)
Raymond Hettinger wrote: > Check out the current source. The time machine beat you to it. Nick's other suggestion - that genexps propagate __len__ - might still be interesting. Of course, it would only be applicable for unconditional genexps(i.e. no if clause). Tim Delaney -- http://mail.python

Re: generator expressions: performance anomaly?

2005-01-16 Thread Raymond Hettinger
[Raymond Hettinger] > >List slice assignment is an example of a tool with a special case optimization > >for inputs that know their own length -- that enables the tool to pre-allocate > >its result rather than growing and resizing in spurts. Other such tools include > >tuple(), map() and zip(). [

Re: generator expressions: performance anomaly?

2005-01-16 Thread bearophileHUGS
Nick Coghlan: >There's a similar performance glitch associated with constructing a tuple from a generator expression (with vanilla 2.4, detouring via list is actually faster) You look right: .from time import clock .print "[x for x in l], list(x for x in l), aux = list(x for x in l); tuple(aux),

Re: threading and sockets ?

2005-01-16 Thread Irmen de Jong
ionel wrote: how to make a efficient server.. please point me to some good and clear examples I nominate SocketServer.ThreadingTCPServer from the standard library. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: generator expressions: performance anomaly?

2005-01-16 Thread John Machin
On Sun, 16 Jan 2005 12:18:23 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: >"John Machin" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Please consider the timings below, where a generator expression starts >> out slower than the equivalent list comprehension, and gets wors

Re: why are some types immutable?

2005-01-16 Thread Roy Smith
Torsten Mohr <[EMAIL PROTECTED]> wrote: > reading the documentation (and also from a hint from this NG) > i know now that there are some types that are not mutable. > > But why is it this way? > > From an overhead point of view i think it is not optimal, > for example for a large string it could

[perl-python] 20050116 defining a function

2005-01-16 Thread Xah Lee
© # the following is a example of defining © # a function in Python. © © def fib(n): © """This prints n terms of a sequence © where each term is the sum of previous two, © starting with terms 1 and 1.""" © result=[];a=1;b=1 © for i in range(n): © result.append(b) ©

Re: Why would I get a TypeEror?

2005-01-16 Thread Stian Soiland
På 14. jan 2005 kl. 22:58 skrev Steven Bethard: (Any mac users? How do I fix this to appear in Norwegian? =) Note that if you're not comfortable with short-circuiting behavior, you can also code this using lazy evaluation: (lambda: 1/x, lambda: 1.0e99)[x==0]() .. and people wonder why so many

Re: List problems in C code ported to Python

2005-01-16 Thread Grant Edwards
On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: > I'm done porting the C code, but now when running the script I > continually run into problems with lists. I tried appending and > extending the lists, but with no avail. Any help is much appreciated > Please see both the Python and C code a

Re: Newbie inheritance question.

2005-01-16 Thread Christophe Cavalaria
bwobbones wrote: > Hi all, > > I'm a java programmer struggling to come to terms with python - bear > with me! > > I'm trying to subclass a class, and I want to be able to see it's > attributes also. Here are my classes: > > two.py > * > from one import one > >

List problems in C code ported to Python

2005-01-16 Thread Lucas Raab
I'm done porting the C code, but now when running the script I continually run into problems with lists. I tried appending and extending the lists, but with no avail. Any help is much appreciated Please see both the Python and C code at http://home.earthlink.net/~lvraab. The two files are ENIGM

Scriptomatic 2.0

2005-01-16 Thread Do Re Mi chel La Si Do
Hi ! Scriptomatic 2.0 can, now, to generate scripts in Python. Download : http://www.microsoft.com/downloads/thankyou.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178&displaylang=en Note : scriptomatic is a generator of WMI's scripts, for Windows, (and compatibles WBEM). Good night -- Mi

Re: Newbie inheritance question.

2005-01-16 Thread Jeremy Bowers
On Sun, 16 Jan 2005 22:08:13 +0800, bwobbones wrote: > Hi all, > > I'm a java programmer struggling to come to terms with python - bear > with me! Christophe already identified the problem, I wanted to address another Javaism in your code, for your educational benefit. Speaking "idiomaticall

Re: protecting the python code.

2005-01-16 Thread Bob Smith
nell wrote: Hi Steve, First the "10x in advance" means thanks in advance. The main importance of protecting my code is to save headache of customers that want to be smart and change it and then complain on bugs and problems. 10x I'd say that's more of a policy issue than a technical issue. You have

Executing a script created by the end user

2005-01-16 Thread Craig Howard
I am working on a python project where an object will have a script that can be edited by the end user: object.script If the script is a simple one with no functions, I can easily execute it using: exec object.script But if the object script is a bit more complicated, such as the example belo

Re: Statement local namespaces summary (was Re: python3: 'where' keyword)

2005-01-16 Thread Andrey Tatarinov
Nick Coghlan wrote: # Anonymous functions use res: def f(x): d = {} exec x in d return d in: res = [f(i) for i in executable] as for me, I found construction "use :" unobvious and confusing. Also there is great possibility to forget some of variables names. I think that syntax wher

Weekly Python Patch/Bug Summary

2005-01-16 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 272 open ( +5) / 2737 closed (+10) / 3009 total (+15) Bugs: 793 open ( -5) / 4777 closed (+29) / 5570 total (+24) RFE : 165 open ( +0) / 141 closed ( +1) / 306 total ( +1) New / Reopened Patches __ Enhance t

Re: why are some types immutable?

2005-01-16 Thread "Martin v. Löwis"
Torsten Mohr wrote: reading the documentation (and also from a hint from this NG) i know now that there are some types that are not mutable. But why is it this way? There are various reasons, some apply for some types, and some for others: - immutable objects are hashable - their hash value will no

Re: mutable string?

2005-01-16 Thread "Martin v. Löwis"
Torsten Mohr wrote: is there some string class that i can change in place, like perls strings? array.array is mutable. You can use the 'c' code if you want an array of characters. Is it possible to do some regex replacement functions that would even change its length? You can't use re.sub array, bu

Re: threading and sockets ?

2005-01-16 Thread Daniel Bickett
http://www.twistedmatrix.com/ Daniel Bickett -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing class variables of private classes

2005-01-16 Thread Peter Otten
Uwe Mayer wrote: > I need to access class variables of a class I'd like to make private: > > i.e. > class __Bar(object): > pass > > class __Foo(__Bar): > def __init__(self): > super(__Foo, self).__init__() > __Foo() > Name Error: global name '_Foo__Foo' is not defined > > Here I w

Re: How can I get the names of the files in a directory?

2005-01-16 Thread Stian Soiland
På 15. jan 2005 kl. 16:16 skrev .removethis.: >>> import glob >>> from os.path import isfile >>> print filter(isfile, glob.glob('/tmp/*')) # can use patterns Nice example of when filter() is better than list comprehension. [f for f in glob.glob("/tmp/*") if isfile(fi)] is a bit too verbose, the ite

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-16 Thread Tim Peters
[Bengt Richter] ... > But I don't know how to build QNaNs: You can subtract infinity from infinity. While all Python behavior in the presence of NaNs, infinities, and signed zeroes is a platform-dependent accident, it you're on a box that has such things, and figure out some (accidental!) way to

iTools

2005-01-16 Thread kent sin
Where can I download python-itools? I found it in the python packages index but the site is not contactable. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: generator expressions: performance anomaly?

2005-01-16 Thread Raymond Hettinger
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Please consider the timings below, where a generator expression starts > out slower than the equivalent list comprehension, and gets worse: > > >python -m timeit -s "orig=range(10)" "lst=orig[:];lst[:]=(x for x > in ori

Re: How to del item of a list in loop?

2005-01-16 Thread Michael Hoffman
John Machin wrote: I've taken your code and improved it along the suggested lines, added timing for first, middle, and last elements, added several more methods, and added a testing facility as well. Would you like a copy? Actually I think it would be great if you posted it here for our combined ed

Re: Newbie inheritance question.

2005-01-16 Thread Just
In article <[EMAIL PROTECTED]>, Ed Leafe <[EMAIL PROTECTED]> wrote: > On Jan 16, 2005, at 9:08 AM, bwobbones wrote: > > > class two(one): > >def __init__(self): > >print "two" > > You need to specifically call the superclass's __init__ here in order > for it to fire. Just add

Re: there's a socket.sendall(), so why no socket.recvall()?

2005-01-16 Thread Irmen de Jong
Roger Binns wrote: there's a socket.sendall(), so why no socket.recvall()? BTW socket.sendall() doesn't actually work for large amounts of data on Windows 2000 and probably other versions of Windows as well. Eg if you supply a 1MB buffer then you get an exception based on some internal Windows er

Re: Newbie inheritance question.

2005-01-16 Thread Mark McEahern
bwobbones wrote: Hi all, I'm a java programmer struggling to come to terms with python - bear with me! Welcome! I'm trying to subclass a class, and I want to be able to see it's attributes also. Here are my classes: [snip] class two(one): def __init__(self): print "two" The problem i

Re: Newbie inheritance question.

2005-01-16 Thread Ed Leafe
On Jan 16, 2005, at 9:08 AM, bwobbones wrote: class two(one): def __init__(self): print "two" You need to specifically call the superclass's __init__ here in order for it to fire. Just add the line super(two, self).__init__() as the first line of the subclass's __init__. __

Re: accessing class variables of private classes

2005-01-16 Thread Mark McEahern
Uwe Mayer wrote: Hi, I need to access class variables of a class I'd like to make private: Use single underscores instead of double underscores--you won't have to workaround the name mangling. Besides, nothing's really private anyway. // m -- http://mail.python.org/mailman/listinfo/python-lis

Newbie inheritance question.

2005-01-16 Thread bwobbones
Hi all, I'm a java programmer struggling to come to terms with python - bear with me! I'm trying to subclass a class, and I want to be able to see it's attributes also. Here are my classes: one.py: * class one: def __init__(self): print "one" self

Re: there's a socket.sendall(), so why no socket.recvall()?

2005-01-16 Thread Roger Binns
there's a socket.sendall(), so why no socket.recvall()? BTW socket.sendall() doesn't actually work for large amounts of data on Windows 2000 and probably other versions of Windows as well. Eg if you supply a 1MB buffer then you get an exception based on some internal Windows error code. I ha

accessing class variables of private classes

2005-01-16 Thread Uwe Mayer
Hi, I need to access class variables of a class I'd like to make private: i.e. class __Bar(object): pass class __Foo(__Bar): def __init__(self): super(__Foo, self).__init__() >>> __Foo() Name Error: global name '_Foo__Foo' is not defined Here I want to prevent the user of instanciating

Re: How to del item of a list in loop?

2005-01-16 Thread John Machin
Bengt Richter wrote: > No one seems to have suggested this in-place way yet, > so I'll trot it out once again ;-) > > >>> lst = [1, 2, 3] > >>> i = 0 > >>> for item in lst: > ...if item !=2: > ...lst[i] = item > ...i += 1 > ... > >>> del lst[i:] > >>> lst > [1, 3] Wo

Re: video analysis with python

2005-01-16 Thread Miki Tebeka
Hello Ashot, > I need to write a video analysis tool which extracts statistics from > microsocope video. Essentially what I need is to translate the video data > into numerical matrices. I have been using Python for the past 1.5 years > anytime I could for absolutely everything, becaus

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-16 Thread Bengt Richter
On Sat, 15 Jan 2005 11:00:36 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: >G.Franzkowiak wrote: >> Scott David Daniels schrieb: >> >>> franzkowiak wrote: >>> I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract f

Re: How to del item of a list in loop?

2005-01-16 Thread Bengt Richter
On Sat, 15 Jan 2005 15:27:08 -0500, skull <[EMAIL PROTECTED]> wrote: > >Hi everybody, it is my first post in this newsgroup. >I am a newbie for python though I have several years development experience in >c++. >recently, I was stumped when I tried to del item of a list when iteration. > >here is

Re: generator expressions: performance anomaly?

2005-01-16 Thread Nick Coghlan
John Machin wrote: Background: There was/is a very recent thread about ways of removing all instances of x from a list. /F proposed a list comprehension to build the result list. Given a requirement to mutate the original list, this necessitates the assignment to lst[:]. I tried a generator express

Re: How to del item of a list in loop?

2005-01-16 Thread Nick Coghlan
John Machin wrote: Nick Coghlan wrote: The effbot's version is still going to be faster though: lst = [x for x in lst if x != 2] Have you measured this? Nope. I'm going purely on the fact that it is O(n), and the in-place modification will always be worse than that. Cheers, Nick. -- Nick Coghl

Re: generator expressions: performance anomaly?

2005-01-16 Thread Fredrik Lundh
John Machin wrote: > Given a requirement to mutate the original list, this necessitates the > assignment > to lst[:]. do you always pull requirements out of thin air? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to del item of a list in loop?

2005-01-16 Thread Fredrik Lundh
John Machin wrote: >> (if you have 2.4, try replacing [] with () and see what happens) > > The result is a generator with a name ("lst") that's rather misleading > in the context. according to my dictionary, the word "list" means "A series of names, words, or other items written, printed, or imag

generator expressions: performance anomaly?

2005-01-16 Thread John Machin
Please consider the timings below, where a generator expression starts out slower than the equivalent list comprehension, and gets worse: >python -m timeit -s "orig=range(10)" "lst=orig[:];lst[:]=(x for x in orig)" 10 loops, best of 3: 6.84e+004 usec per loop >python -m timeit -s "orig=range(

Re: deleting from tarfile

2005-01-16 Thread "Martin v. Löwis"
Mark McEahern wrote: It doesn't appear so. A workaround, of course, is to create a new file with the subset of files from the old file: That is actually the *only* way to do that. tarfiles cannot be "sparse", in the sense that parts of the file can be marked as deleted. So in order to delete a fi