Re: tough-to-explain Python

2009-07-07 Thread Bearophile
kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. Lot of people think that a language where everything is immutable is sim

Re: finding most common elements between thousands of multiple arrays.

2009-07-07 Thread Andrew Henshaw
"mclovin" wrote in message news:c5332c9b-2348-4194-bfa0-d70c77107...@x3g2000yqa.googlegroups.com... > Currently I need to find the most common elements in thousands of > arrays within one large array (arround 2 million instances with ~70k > unique elements) > > so I set up a dictionary to handle

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread python
> If you do write the interpreter, let me know. I would certainly experiment > with it. +2 over here! Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and webcam capture delay?

2009-07-07 Thread Nobody
On Tue, 07 Jul 2009 09:01:39 +0300, jack catcher (nick) wrote: > Thanks for the comments. Unfortunately, such specifications aren't easy > to find, even in reviews. Fortunately several newer webcams seem at > least to use usb2. Supporting USB-2 doesn't mean that the camera necessarily uses high

Re: Python Error from Apress book

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 09:55:13 -0300, Dave Angel escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 escribió: When I try to run the command as outlined in the book "simple_markup2.py < test_input.txt > test_output.html i get the following error every time. IO

Re: tough-to-explain Python

2009-07-07 Thread norseman
Bearophile wrote: kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. ...(snip) See you later, bearophile

RE: A Bug By Any Other Name ...

2009-07-07 Thread Phil Runciman
-Original Message- From: Dennis Lee Bieber [mailto:wlfr...@ix.netcom.com] Sent: Tuesday, 7 July 2009 4:45 p.m. To: python-list@python.org Subject: Re: A Bug By Any Other Name ... On Mon, 6 Jul 2009 19:48:39 -0700, Daniel Fetchinson declaimed the following in gmane.comp.python.general:

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Stef Mientki
So, the question is, can the same thing be done for Python apps? I love Python and all, but it'd be apt to ask, what's the point? The iPhone is running on what? A 400Mhz ARM processor? Resources on the device are already limited; running your program on top of an embedded Python interpre

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread J Kenneth King
Stef Mientki writes: >>> So, the question is, can the same thing be done for Python apps? >>> >> >> I love Python and all, but it'd be apt to ask, what's the point? >> >> The iPhone is running on what? A 400Mhz ARM processor? Resources on the >> device are already limited; running your progr

Re: Embedded Python : Why does thread lock here?

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 15:01:17 -0300, roschler escribió: I have the Python Intepreter embedded in a Delphi (Object Pascal) program. In the Python script shown below, I have a module that creates a thread object and starts it. Do you *execute* the module or do you *import* it? Isn't a good id

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread Stef Mientki
J Kenneth King wrote: Stef Mientki writes: So, the question is, can the same thing be done for Python apps? I love Python and all, but it'd be apt to ask, what's the point? The iPhone is running on what? A 400Mhz ARM processor? Resources on the device are already limited; ru

Re: tough-to-explain Python

2009-07-07 Thread Bret Fledderjohn
I really enjoyed your boxes analogy, from a guy with a trucking background, it makes a lot of sense! -Bret > ... The more I delve into OOP the more I liken an 'object' to a box. A box > with a shipping manifest. > > There are big boxes, > little boxes, > squat boxes and so on. > > A box can conta

Re: Check file is locked?

2009-07-07 Thread Lawrence D'Oliveiro
In message , Christian Heimes wrote: > By the way most operating systems don't lock a file when it's opened for > reading or writing or even executed. The general conclusion seems to be that mandatory locking is more trouble than it's worth. -- http://mail.python.org/mailman/listinfo/python-l

Re: tough-to-explain Python

2009-07-07 Thread Ben Finney
kj writes: > In Chris Rebert > writes: > > >You might find the following helpful (partially): > >http://effbot.org/zone/call-by-object.htm > > Extremely helpful. Thanks! (I learned more from it than someone > who will teach the stuff would care to admit...) I have got very good results fr

Re: Write matrix to text file

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 14:46:47 -0300, Hanna Michelsen escribió: I'm working with both python and matlab at the moment and I was wondering if there is an efficient way to take a 2-D array (of 1s and 0s) in python and write it to a text file such that matlab will be able to create a sparse ma

IP Address Function

2009-07-07 Thread Fred Atkinson
Is there a Python function I can use to get the user's IP address so I can display it on his browser? Regards, Fred -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 5:11 pm, kj wrote: > I don't plan to present these examples to them. > But beginners have a way of bumping into such > conundrums all on their own [...].  I doubt that > an answer of the form "don't worry your pretty > little head over this now; wait until your second > course" will do t

Re: IP Address Function

2009-07-07 Thread Tim Harig
On 2009-07-08, Fred Atkinson wrote: > Is there a Python function I can use to get the user's IP > address so I can display it on his browser? If you are using CGI you can get it from the REMOTE_ADDR environmental variable. -- http://mail.python.org/mailman/listinfo/python-list

Re: IP Address Function

2009-07-07 Thread Chris Rebert
On Tue, Jul 7, 2009 at 6:45 PM, Fred Atkinson wrote: >        Is there a Python function I can use to get the user's IP > address so I can display it on his browser? from socket import gethostname, gethostbyname ip = gethostbyname(gethostname()) Cheers, Chris -- http://blog.rebertia.com -- http

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Paul Rubin
pdpi writes: > while abs(func(guess) - target) > epsilon: > guess = (lo + hi) / 2. > if sense * func(guess) > sense * target: > hi = guess > elif sense * func(guess) < sense * target: > lo = guess > elif lo == hi: > return Non

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 8:06 pm, Ben Finney wrote: > I have got very good results from teaching using > the analogy of “paper tags tied to physical objects” > to describe Python's references to values. Ah, I like that! I think it's better than what I used in my post (which I composed and submitted before your

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 09:51:10 -0300, Jean-Michel Pichavant escribió: I've never used sense in that way before, nor I've seen used by others until now. However Kj is right, and my dictionary seems wrong (wordreference.com). I've searched through others dictionaries and find out this is actua

Re: IP Address Function

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson escribió: Is there a Python function I can use to get the user's IP address so I can display it on his browser? There is a long distance between "Python" and "browser" - you'll have to tell us what is in between the two. By example

Re: tough-to-explain Python

2009-07-07 Thread Steven D'Aprano
On Tue, 07 Jul 2009 21:18:53 +, kj wrote: > I had not realized how *profoundly* different the meaning of the "=" in > Python's > > spam = ham > > is from the "=" in its > > spam[3] = ham[3] > > So much for "explicit is better than implicit"... I'm sorry, I don't get it. Can you explai

Re: tough-to-explain Python

2009-07-07 Thread python
Ben, > I have got very good results from teaching using the analogy of "paper tags > tied to physical objects" to describe Python's references to values. Great analogy!! And an excellent analogy for newcomers to Python. (this would have saved me some personal pain in my early days). Regards, Ma

Re: tough-to-explain Python

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 17:04:46 -0300, kj escribió: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. ham = [1, 2, 3, 4] spam = (ham,) spam ([1, 2, 3, 4],) spam[0] is ham True spam[0] += [5] Traceback (most recent call last): File "",

How to use Python to interface with Web pages?

2009-07-07 Thread Peter
Any help would be appreciated :-) I want to write an auction sniping tool in Python. I know Python, but I know absolutely nothing about web pages, javascript etc i.e. I want the program to automatically log me into my eBay account, access the appropriate item, locate how many mins/seconds until th

Re: How to use Python to interface with Web pages?

2009-07-07 Thread Ralf Schoenian
Peter wrote: Any help would be appreciated :-) I want to write an auction sniping tool in Python. I know Python, but I know absolutely nothing about web pages, javascript etc i.e. I want the program to automatically log me into my eBay account, access the appropriate item, locate how many mins/s

Re: tough-to-explain Python

2009-07-07 Thread Simon Forman
On Jul 7, 4:04 pm, kj wrote: > I'm having a hard time coming up with a reasonable way to explain > certain things to programming novices. > > Consider the following interaction sequence: > > >>> def eggs(some_int, some_list, some_tuple): > > ... some_int += 2 > ... some_list += [2] > ...

Re: DBI module deprecated at Python 2.5--what to use in its place?

2009-07-07 Thread John Machin
On Jul 8, 3:05 am, dana wrote: > I have a variety of Python 2.4 scripts that utilitize the DBI and ODBC > modules together. Although I don't have Python 2.5, I've been informed > the DBI module has been deprecated at 2.5. > > A few questions: > > 1) Although deprecated, will it work at all in 2.5?

Re: Check file is locked?

2009-07-07 Thread Rajat
On Jul 8, 4:57 am, Lawrence D'Oliveiro wrote: > In message , Christian > > Heimes wrote: > > By the way most operating systems don't lock a file when it's opened for > > reading or writing or even executed. > > The general conclusion seems to be that mandatory locking is more trouble > than it's w

Re: Python and webcam capture delay?

2009-07-07 Thread Tim Roberts
Nobody wrote: > >The webcam is bound to do some encoding; most of them use USB "full speed" >(12Mbit/sec), which isn't enough for raw 640x480x24...@30fps data. That's not true. Most of the web cams made in the last 5 years or so run at high speed, 480 Mbps. Full speed only gets you 1 fps at 640

Re: tough-to-explain Python

2009-07-07 Thread Steven D'Aprano
On Tue, 07 Jul 2009 20:04:46 +, kj wrote: > I'm having a hard time coming up with a reasonable way to explain > certain things to programming novices. [...] > Or consider this one: > ham = [1, 2, 3, 4] spam = (ham,) spam > ([1, 2, 3, 4],) spam[0] is ham > True spam

count

2009-07-07 Thread Dhananjay
Dear all, I have file as follows,however, tab seperated (not shown in following file): 6 3 4.309726 7 65 93.377388 8 47 50.111952 9 270 253.045923 10 184182.684670 11 76 121.853455 12 85 136.283470

Re: SSH utility

2009-07-07 Thread romeoamp
Please look at on : http://www.lag.net/paramiko/ http://www.lag.net/paramiko/ Sample Code: Find Attachment Thanks, S.V.RAJKUMAR, XOU Solutions India Private Limited No. 37, PM Towers, Greams Road, Thousand Lights, Chennai - 6 . Mobile No : +91 - 9940632275. half.italian wrote: > > On

<    1   2