Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-19 Thread Aldo Ceccarelli
On 18 Apr, 22:38, Daniel Kluev dan.kl...@gmail.com wrote: Isn't it better to use subprocess.Popen and read stdout/stderr directly? Should be much more convenient than temporary files. -- With best regards, Daniel Kluev Thanks Daniel, your solution is far better WKR! Aldo --

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Kushal Kumaran
On Tue, Apr 19, 2011 at 7:09 AM, Christian Heimes li...@cheimes.de wrote: Am 18.04.2011 21:58, schrieb John Nagle:     This is typical for languages which backed into a bool type, rather than having one designed in.  The usual result is a boolean type with numerical semantics, like   True +

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Chris Angelico
On Tue, Apr 19, 2011 at 4:23 PM, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: if a + b + c + d != 1:    raise ValueError(Exactly one of a, b, c or d must be true.) Unless you're sure all of a, b, c, and d are boolean values, an int with a negative value slipping in could result in

Re: Feature suggestion -- return if true

2011-04-19 Thread Jussi Piitulainen
Gregory Ewing writes: Chris Angelico wrote: Question: How many factorial functions are implemented because a program needs to know what n! is, and how many are implemented to demonstrate recursion (or to demonstrate the difference between iteration and recursion)? :) (I can't get to

Re: Feature suggestion -- return if true

2011-04-19 Thread Chris Angelico
On Tue, Apr 19, 2011 at 4:42 PM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Factorials become an interesting demonstration of recursion when done well. There's a paper by Richard J. Fateman, citing Peter Luschny: http://www.cs.berkeley.edu/~fateman/papers/factorial.pdf

Re: How to create a (transparent) decorator with status information?

2011-04-19 Thread Timo Schmiade
Hey Ian, On Mon, Apr 18, 2011 at 01:07:58PM -0600, Ian Kelly wrote: In the simple case, just store the state on the wrapper function itself: def call_counts(function): @functools.wraps(function) def wrapper(*args, **kwargs): wrapper.num_calls += 1 return function(*args,

Re: IDLE bug

2011-04-19 Thread Terry Reedy
On 4/19/2011 12:05 AM, harrismh777 wrote: Are bug reports wanted here, or just in issue tracker? If one is somewhat experienced with Python and is sure about having identified a bug, and is willing to search the tracker for existing reports and respond to questions, then report on the

Re: How to create a (transparent) decorator with status information?

2011-04-19 Thread Timo Schmiade
Hey Wayne, On Mon, Apr 18, 2011 at 04:04:15PM -0700, Wayne Witzel III wrote: Going with the object approach, you could use Borg to give yourself the state between instances you mentioned. And since you are using an object, you'll have access to the data without needing to return it from the

Re: Questions about GIL and web services from a n00b

2011-04-19 Thread Lamont Nelson
1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)?  Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Google search?  If not, how do you avoid this issue in a multi-threaded process to take

Re: Two similar logging programs but different ouputs

2011-04-19 Thread Vinay Sajip
On Apr 19, 6:35 am, Disc Magnet discmag...@gmail.com wrote: I couldn't find this mentioned in the documentation at: http://docs.python.org/library/logging.config.html#configuration-file... Could you please tell me where this is documented? It's documented here:

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Steven D'Aprano
On Tue, 19 Apr 2011 16:26:50 +1000, Chris Angelico wrote: On Tue, Apr 19, 2011 at 4:23 PM, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: if a + b + c + d != 1:    raise ValueError(Exactly one of a, b, c or d must be true.) Unless you're sure all of a, b, c, and d are boolean

Re: [ANN] Python 2.5.6 Release Candidate 1

2011-04-19 Thread Paul Rubin
Martin v. Löwis mar...@v.loewis.de writes: On behalf of the Python development team and the Python community, I'm happy to announce the release candidate 1 of Python 2.5.6. This is a source-only release that only includes security fixes. Thanks Martin, I'm glad these older releases are still

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Chris Angelico
On Tue, Apr 19, 2011 at 6:43 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: but I don't see how (arbitrary expression) + (another expression) + ... + (last expression) can have any guarantees applied. I mean, you can't even guarantee that they won't raise an exception. Can

Re: Python IDE/text-editor

2011-04-19 Thread Vlastimil Brom
2011/4/19 Alec Taylor alec.tayl...@gmail.com: SPE looks good, however I couldn't get it running (svn'd it). Do you know if there's an installer? -- http://mail.python.org/mailman/listinfo/python-list There are source archives

Looking for a urllib(2) cookie handler

2011-04-19 Thread Mark Carter
I'm in python 2.6.5, and have Firefox 3.6.13. I would like to download some html from a site and scrape it programatically. The site requires a cookie, which I have in Firefox. Is there a simple python recipe I can use to read the contents of a url and say just use the cookie that I have in

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 4:44 AM, Mark Carter alt.mcar...@gmail.com wrote: I'm in python 2.6.5, and have Firefox 3.6.13. I would like to download some html from a site and scrape it programatically. The site requires a cookie, which I have in Firefox. Is there a simple python recipe I can use

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Mark Carter
On Apr 19, 12:44 pm, Mark Carter alt.mcar...@gmail.com wrote: url and say just use the cookie that I have in Firefox? mechanize looks kinda like what I want, but i still can't get it to work properly. So far I have: import cookielib import mechanize cookiefile =

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 5:48 AM, Mark Carter alt.mcar...@gmail.com wrote: On Apr 19, 12:44 pm, Mark Carter alt.mcar...@gmail.com wrote: url and say just use the cookie that I have in Firefox? mechanize looks kinda like what I want, but i still can't get it to work properly. So far I have:

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Westley Martínez
On Tue, 2011-04-19 at 19:00 +1000, Chris Angelico wrote: On Tue, Apr 19, 2011 at 6:43 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: but I don't see how (arbitrary expression) + (another expression) + ... + (last expression) can have any guarantees applied. I mean, you

Re: installing setuptools on Windows custom python install

2011-04-19 Thread Eric Frederich
I do not have a DLLs folder. I created this installation of Python myself since I needed it built with Visual Studio 2005. I followed instructions under PC\readme.txt This file mentioned nothing about a DLLs folder. From PC\readme.txt . The best installation strategy is to put the

Re: How to create a (transparent) decorator with status information?

2011-04-19 Thread Ian Kelly
On Tue, Apr 19, 2011 at 1:12 AM, Timo Schmiade the_...@gmx.de wrote: Just one question remains now: What is a Borg in this context? http://code.activestate.com/recipes/66531/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Grant Edwards
On Tue, Apr 19, 2011 at 7:09 AM, Christian Heimes li...@cheimes.de wrote: Am 18.04.2011 21:58, schrieb John Nagle: ?? ?? This is typical for languages which backed into a bool type, rather than having one designed in. ??The usual result is a boolean type with numerical semantics, like ??

multiple Python 2.7 Windows installations

2011-04-19 Thread Eric Frederich
Hello, I am trying to get an installer built with distutils to recognize multiple installations. The installer currently finds my installation at C:\Python27 I have a custom Python27 built myself with Visual Studio sitting somewhere else, say C:\MyPython27. I looked at PC/bdist_wininst/install.c

Re: Namespaces in functions vs classes

2011-04-19 Thread Gerald Britton
Ethan -- I'm just getting back to this question. If you recall, you asked: [snip] 8 script with possible name clashes eggs = 'scrambled eggs' meat = 'steak' class Breakfast(): meat = 'spam' def serve(self): print(Here's

Re: How to create a (transparent) decorator with status information?

2011-04-19 Thread Timo Schmiade
On Tue, Apr 19, 2011 at 08:20:05AM -0600, Ian Kelly wrote: On Tue, Apr 19, 2011 at 1:12 AM, Timo Schmiade the_...@gmx.de wrote: Just one question remains now: What is a Borg in this context? http://code.activestate.com/recipes/66531/ -- http://mail.python.org/mailman/listinfo/python-list

Noob Question

2011-04-19 Thread Rob McGillivray
Hi All, I'm new to Python, and trying to get python 3.2 installed on Centos 5.6. When I run 'make test', I receive several errors. The readme states that you can generally ignore messages about skipped tests, but as you can see below, some of the tests failed and a number were 'unexpected

Fatal Python Error Need Help

2011-04-19 Thread Yogesh Gupta
Hello, I am trying to run a python based program on MacOSX, which needs following packages numpy PIL matplotlib I can successfully import all 3 using python2.5 (only using /sw64/bin/python or /sw64/bin/python2.5) , although i have python2.6 and 2.7 installed. I get following error when in run

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Jean-Paul Calderone
On Apr 19, 10:23 am, Grant Edwards inva...@invalid.invalid wrote: On Tue, Apr 19, 2011 at 7:09 AM, Christian Heimes li...@cheimes.de wrote: Am 18.04.2011 21:58, schrieb John Nagle: ?? ?? This is typical for languages which backed into a bool type, rather than having one designed in. ??The

Re: Fatal Python Error Need Help

2011-04-19 Thread Ned Deily
In article banlktimr2goozgoxstobjf5jur+3cxg...@mail.gmail.com, Yogesh Gupta yogesh.gupt...@gmail.com wrote: I am trying to run a python based program on MacOSX, which needs following packages numpy PIL matplotlib I can successfully import all 3 using python2.5 (only using

Re: Namespaces in functions vs classes

2011-04-19 Thread Ethan Furman
Gerald Britton wrote: I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions. That is a helpful understanding. That is not correct. Classes are separate namespaces -- they just aren't automatically searched. The only

Re: who moved reload?

2011-04-19 Thread Calvin Spealman
I have a great solution : stop using reload. It often dangerous and more often silly. On Apr 7, 2011 5:44 AM, harrismh777 harrismh...@charter.net wrote: All right... somebody is sacked (er, fired) ! Who moved reload()? This kinda stuff is driving me bonkers... there was no need to move

Re: Namespaces in functions vs classes

2011-04-19 Thread Gerald Britton
Gerald Britton wrote: I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions. That is a helpful understanding. That is not correct. Classes are separate namespaces -- they just aren't automatically searched. The only

3.2 test failures on Centos 5.6 (was Re: Noob Question)

2011-04-19 Thread Terry Reedy
On 4/19/2011 10:55 AM, Rob McGillivray wrote: I'm new to Python, and trying to get python 3.2 installed on Centos 5.6. When I run 'make test', I receive several errors. Welcome to Python. Newbie lesson 1: write an informative subject line that will catch the attention of people who can

Re: Namespaces in functions vs classes

2011-04-19 Thread Ian Kelly
On Tue, Apr 19, 2011 at 10:31 AM, Ethan Furman et...@stoneleaf.us wrote: Gerald Britton wrote: I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions.  That is a helpful understanding. That is not correct.  Classes are

What breaks if I remove lib/python2.7/test/* ?

2011-04-19 Thread cjblaine
What breaks if I remove lib/python2.7/test/* ? What purpose does it serve? It is 26MB for me. I am trying to trim my Python install for good reason. Thanks for any info! -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespaces in functions vs classes

2011-04-19 Thread Terry Reedy
On 4/19/2011 10:58 AM, Gerald Britton wrote: serve method unless it is qualified. I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions. Class namespaces are separate namespaces but not in the same way as for functions.

Re: What breaks if I remove lib/python2.7/test/* ?

2011-04-19 Thread Terry Reedy
On 4/19/2011 1:06 PM, cjblaine wrote: What breaks if I remove lib/python2.7/test/* ? What purpose does it serve? It allows you to run the test suite. Some people like to run it when they install. Or they may run a module test if they have a problem with a specific module or edit the Python

RE: 3.2 test failures on Centos 5.6 (was Re: Noob Question)

2011-04-19 Thread Rob McGillivray
Hi Terry, Much appreciate the pointers! :-) I am trying to install from an RPM downloaded from python.org. I'm pretty new to Linux etc (very pleased to be finally getting into the wide world of OSS), so I'm double-challenged on a number of fronts right now. I will run the failed tests in

force --install-layout=deb on systems where that makes sense?

2011-04-19 Thread Lee Harr
Is there a way to make distutils use --install-layout=deb but only on systems where that makes sense? I just noticed that if someone installs without that switch, my app will not be able to find its data files, because sys.prefix = /usr  but the installation is actually in to /usr/local I

Pickling over a socket

2011-04-19 Thread Roger Alexander
Hi, I'm trying to understand how to pickle Python objects over a TCP socket. In the example below (based on code from Foundations of Python Network Programming), a client creates a dictionary (lines 34-38) and uses pickle.dump at line 42 to write the pickled object using file handle make from a

Re: 3.2 test failures on Centos 5.6 (was Re: Noob Question)

2011-04-19 Thread Terry Reedy
On 4/19/2011 1:33 PM, Rob McGillivray wrote: I am trying to install from an RPM downloaded from python.org. That puzzles me. For *nix, I do not see .rpm, just tarballs, on http://python.org/download/releases/3.2/ -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob Question

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 7:55 AM, Rob McGillivray r...@motornostixusa.com wrote: Hi All, I'm new to Python, and trying to get python 3.2 installed on Centos 5.6. When I run 'make test', I receive several errors. The readme states that you can generally ignore messages about skipped tests,

Re: Pickling over a socket

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 11:53 AM, Roger Alexander rtalexan...@mac.com wrote: Hi, I'm trying to understand how to pickle Python objects over a TCP socket. In the example below (based on code from Foundations of Python Network Programming), a client creates a dictionary (lines 34-38) and uses

Re: Pickling over a socket

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 4:53 AM, Roger Alexander rtalexan...@mac.com wrote: Hi, I'm trying to understand how to pickle Python objects over a TCP socket. In the example below (based on code from Foundations of Python Network Programming), a client creates a dictionary (lines 34-38) and uses

Re: Pickling over a socket

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 11:53 AM, Roger Alexander rtalexan...@mac.com wrote: Hi, I'm trying to understand how to pickle Python objects over a TCP socket. In the example below (based on code from Foundations of Python Network Programming), a client creates a dictionary (lines 34-38) and uses

Re: Pickling over a socket

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 5:30 AM, Dan Stromberg drsali...@gmail.com wrote: I played around with it until something worked, and ended up with the below.  The most significant change was probably using sc.makefile instead of s.makefile in the server... Oh! I didn't notice that in the OP. Yep,

Re: Noob Question

2011-04-19 Thread Felipe Bastos Nunes
Yes, Dan is right, it looked for the sources, and you have only binaries on your system. Look in your distribution repositories for the *-devel or alike for the 5 that failed and try again. 2011/4/19 Dan Stromberg drsali...@gmail.com On Tue, Apr 19, 2011 at 7:55 AM, Rob McGillivray

optparse eats $

2011-04-19 Thread tazz_ben
So, I'm using optparse as follows: Command line: python expense.py $100 -f ~/desktop/test.txt ['00'] In Main: desc = '' p = optparse.OptionParser(description=desc) utilities = optparse.OptionGroup(p, 'Utility Options') utilities.add_option('--file', '-f', dest=file, help=Define the

Re: optparse eats $

2011-04-19 Thread John Gordon
In f315a5f9-b11a-48e8-b5ce-1e72dcabc...@glegroupsg2000goo.googlegroups.com tazz_ben b...@wbpsystems.com writes: So, any ideas? Why is including a $ eating both the dollar signa and the 1? Unix command lines tend to assume any $ inside double-quotes is a shell variable name. Try enclosing in

Re: optparse eats $

2011-04-19 Thread Peter Otten
tazz_ben wrote: So, I'm using optparse as follows: Command line: python expense.py $100 -f ~/desktop/test.txt ['00'] In Main: desc = '' p = optparse.OptionParser(description=desc) utilities = optparse.OptionGroup(p, 'Utility Options') utilities.add_option('--file', '-f',

Re: optparse eats $

2011-04-19 Thread Michael Kent
Try this on your *nix command line: echo $100 On a *nix command line, the '$1' part of $100 will be seen as 'give me the value of the shell variable 1', and since it has no value, will result in an empty string. So it's not optparse, or Python, because the literal string you intend to pass as

ANNOUNCE: wxPython 2.8.12.0

2011-04-19 Thread Robin Dunn
Announcing -- The 2.8.12.0 release of wxPython is now available for download at http://wxpython.org/download.php. This release has no major new features or enhancements, but there have been plenty of bug fixes since the last stable release. Source code is available as a tarball, and

Re: What breaks if I remove lib/python2.7/test/* ?

2011-04-19 Thread Irmen de Jong
On 19-4-2011 19:06, cjblaine wrote: What breaks if I remove lib/python2.7/test/* ? What purpose does it serve? It is 26MB for me. I am trying to trim my Python install for good reason. Thanks for any info! Terry answered what it is for. Personally, I also once used some functions from

Re: [ANN] Python 2.5.6 Release Candidate 1

2011-04-19 Thread Martin v. Loewis
Thanks Martin, I'm glad these older releases are still getting important fixes. I notice http://www.python.org/download/releases/2.5.6/NEWS.txt says the release date was 17 Apr 2010. Presumably that should have said 2011. Thanks for pointing it out. I fixed it in the repository, so it

Re: multiple Python 2.7 Windows installations

2011-04-19 Thread Martin v. Loewis
I tried to create another 2.7 key but regedit wouldn't let me. So, if I can only have one 2.7 key, it would seem that the routine GetPythonVersions will only ever get 1 version of 2.7. Does this mean that it is unsupported to have more than one Python 2.7 installation on Windows? Exactly so

Re: Namespaces in functions vs classes

2011-04-19 Thread Rhodri James
On Tue, 19 Apr 2011 17:47:40 +0100, Gerald Britton gerald.brit...@gmail.com wrote: Gerald Britton wrote: I now understand the Python does not consider a class definition as a separate namespace as it does for function definitions. That is a helpful understanding. That is not correct.

Re: Namespaces in functions vs classes

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 8:00 AM, Rhodri James rho...@wildebst.demon.co.uk wrote: Language abuse: it's not just Python.  A donation of just $5 will keep a programmer in prepositions for a month.  $50 will supply enough articles to keep a small company understandable for over a year.  With your

Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
I'm have problems figuring out how to receive UDP broadcast packets on Linux. Here's the receiving code: --receive.py--- #!/usr/bin/python import socket host = '' port = 5010 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

Re: Pickling over a socket

2011-04-19 Thread Roger Alexander
Thanks everybody, got it working. I appreciate the help! Roger. -- http://mail.python.org/mailman/listinfo/python-list

Teaching Python

2011-04-19 Thread Passiday
Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for some good material, what I could use as a basic guide when preparing the classes plan for the course - website or book, what would roll out the

Re: Teaching Python

2011-04-19 Thread geremy condra
On Tue, Apr 19, 2011 at 3:42 PM, Passiday passi...@gmail.com wrote: Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for some good material, what I could use as a basic guide when preparing the

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Irmen de Jong
On 20-4-2011 0:21, Grant Edwards wrote: I'm have problems figuring out how to receive UDP broadcast packets on Linux. [...] Here's the sending code: send.py--- #!/usr/bin/python import sys,socket,time host = sys.argv[1]

Re: Teaching Python

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 4:03 PM, geremy condra debat...@gmail.com wrote: On Tue, Apr 19, 2011 at 3:42 PM, Passiday passi...@gmail.com wrote: Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 20-4-2011 0:21, Grant Edwards wrote: I'm have problems figuring out how to receive UDP broadcast packets on Linux. [...] Here's the sending code: send.py---

Re: Teaching Python

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 3:42 PM, Passiday passi...@gmail.com wrote: Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for some good material, what I could use as a basic guide when preparing the

Re: Teaching Python

2011-04-19 Thread geremy condra
On Tue, Apr 19, 2011 at 4:24 PM, Dan Stromberg drsali...@gmail.com wrote: On Tue, Apr 19, 2011 at 4:03 PM, geremy condra debat...@gmail.com wrote: On Tue, Apr 19, 2011 at 3:42 PM, Passiday passi...@gmail.com wrote: Hello, I am planning to teach Python to a group of high school students, who

[OT] Piling of prepositions (was: Namespaces in functions vs classes)

2011-04-19 Thread Ben Finney
Rhodri James rho...@wildebst.demon.co.uk writes: Language abuse: it's not just Python. A donation of just $5 will keep a programmer in prepositions for a month. $50 will supply enough articles to keep a small company understandable for over a year. With your generous help, we can beat this

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 3:21 PM, Grant Edwards invalid@invalid.invalid wrote: I'm have problems figuring out how to receive UDP broadcast packets on Linux. Here's the receiving code: --receive.py--- But, the receiving Python program

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Irmen de Jong
On 20-4-2011 1:21, Grant Edwards wrote: If I don't call bind(), then the broadcast packets go out the wrong interface on the sending machine. Fair enough. Next issue then: as far as I know, broadcast packets are by default not routed across subnets by gateways. Which is a good thing.

Re: Teaching Python

2011-04-19 Thread PATRICIA MEDINA
We have been teaching game programming using python in my school district for a few years now. We started out using python programming for the absolute beginner. It was good, but didn't use pygame and was mostly text based until the last 2 chapters. Another book for reference is Game

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 20-4-2011 1:21, Grant Edwards wrote: If I don't call bind(), then the broadcast packets go out the wrong interface on the sending machine. Fair enough. Next issue then: as far as I know, broadcast packets are

Re: Teaching Python

2011-04-19 Thread Allan Davis
How about this. http://inventwithpython.com/ thanks, Allan On Tue, Apr 19, 2011 at 7:35 PM, geremy condra debat...@gmail.com wrote: On Tue, Apr 19, 2011 at 4:24 PM, Dan Stromberg drsali...@gmail.com wrote: On Tue, Apr 19, 2011 at 4:03 PM, geremy condra debat...@gmail.com wrote: On Tue,

My stupidity / strange inconsistency overriding class methods

2011-04-19 Thread andrew cooke
Hi, I've been staring at this problem, in various forms, all day. Am I missing something obvious, or is there some strange hardwiring of isinstance? This is with Python 3.2. class A(metaclass=ABCMeta): @classmethod def __instancecheck__(cls, instance): return

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 20-4-2011 1:21, Grant Edwards wrote: If I don't call bind(), then the broadcast packets go out the wrong interface on the sending machine. Fair enough. Next issue then: as far as I know, broadcast packets are by default not

Re: My stupidity / strange inconsistency overriding class methods

2011-04-19 Thread andrew cooke
Also, there's something strange about the number of arguments (they're not consistent between the two examples - the A to __instancecheck__ should not be needed). Yet it compiles and runs like that. Very confused :o( -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Gregory Ewing
Jean-Paul Calderone wrote: Also boolean xor is the same as !=. Only if you have booleans. Even without short circuiting, a boolean xor operator could provide the service of automatically booling things for you (is that a word?). Jean-Paul --

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Dan Stromberg drsali...@gmail.com wrote: On Tue, Apr 19, 2011 at 3:21 PM, Grant Edwards invalid@invalid.invalid wrote: I'm have problems figuring out how to receive UDP broadcast packets on Linux. Here's the receiving code:

Re: Teaching Python

2011-04-19 Thread Ben Finney
Dan Stromberg drsali...@gmail.com writes: On Tue, Apr 19, 2011 at 4:03 PM, geremy condra debat...@gmail.com wrote: When you say 'hacking', you mean ? Presumably he meant the real meaning of the word, not what the press made up and ran with. To be fair, the press already had its own

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Dan Stromberg drsali...@gmail.com wrote: On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 20-4-2011 1:21, Grant Edwards wrote: If I don't call bind(), then the broadcast packets go out the wrong interface on the sending machine. Fair enough.

Re: My stupidity / strange inconsistency overriding class methods

2011-04-19 Thread andrew cooke
OK, sorry, I see the mistake. I'm confusing __class__ on the instance and on te class (the latter being the metaclass). Sorry again, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 10:00 AM, Grant Edwards invalid@invalid.invalid wrote: If I send a packet to ff:ff:ff:ff:ff:ff--255.255.255.255, it's because I want everybody on the Ethernet segment to receive it.  If I wanted only people on a particular subnet (e.g. 10.0.0.0/8) to receive it, I would

Re: My stupidity / strange inconsistency overriding class methods

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 4:52 PM, andrew cooke and...@acooke.org wrote: Hi, I've been staring at this problem, in various forms, all day.  Am I missing something obvious, or is there some strange hardwiring of isinstance?  This is with Python 3.2.        class A(metaclass=ABCMeta):        

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards invalid@invalid.invalid wrote: The management program can then send another broadcast packet to configure the IP address of a device. After that, the management program switches over to normal unicast TCP and UDP protocols (HTTP, TFTP, etc.) to

Remote Connection

2011-04-19 Thread ray
I wonder if there is a solution to provide remote connections between two computers similar to Remote Desktop. The difference I am looking for is to be able to deliver speech/audio from the local machine to the remote machine which will process the audio via Dragon Naturally Speaking. As an

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico ros...@gmail.com wrote: On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards invalid@invalid.invalid wrote: The management program can then send another broadcast packet to configure the IP address of a device. After that, the management program switches over to

Re: Remote Connection

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 6:04 PM, ray r...@aarden.us wrote: I wonder if there is a solution to provide remote connections between two computers similar to Remote Desktop.  The difference I am looking for is to be able to deliver speech/audio from the local machine to the remote machine which

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards invalid@invalid.invalid wrote: Or can you simply use a stupid netmask like /1 that picks up all the IP ranges? That way, the source-IP check wouldn't fail. That would require that the device somehow knows that it's not configured correctly and

Re: Teaching Python

2011-04-19 Thread John Bokma
Passiday passi...@gmail.com writes: Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for some good material, what I could use as a basic guide when preparing the classes plan for the course -

Re: Teaching Python

2011-04-19 Thread Alec Taylor
Author Series Lectures Slides/Documentation Assignments Difficulty MIT A Gentle Introduction to Programming Using Python on iTunes U http://itunes.apple.com/us/itunes-u/introduction-to-computer-science/id341597455 http://stuff.mit.edu/iap/python/

meteclasses 2.x/3.x compatibility

2011-04-19 Thread James Mills
Hi all, Is there a compatible way to use meteclasses in both Python 2.x (2.6 to 2.7) and Python 3.x (3.0 to 3.2). Python 2.x: class Foo(object): __meteclass__ = MyMetaClass Python 3.x: class Foo(metaclass=MyMetaClass): pass Thanks, cheers James -- -- James Mills -- -- Problems are

Re: Teaching Python

2011-04-19 Thread Alec Taylor
Here are a few tutorials which may be helpful for notes etc: Author,Series,Lectures,Slides/Documentation,Assignments,Difficulty MIT,A Gentle Introduction to Programming Using Python,on iTunes

Re: Pickling over a socket

2011-04-19 Thread Jean-Paul Calderone
On Apr 19, 6:27 pm, Roger Alexander rtalexan...@mac.com wrote: Thanks everybody, got it working.  I appreciate the help! Roger. It's too bad none of the other respondents pointed out to you that you _shouldn't do this_! Pickle is not suitable for use over the network like this. Your server

Re: [OT] Piling of prepositions (was: Namespaces in functions vs classes)

2011-04-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Ben Finney wrote: Rhodri Jamesrho...@wildebst.demon.co.uk writes: Language abuse: it's not just Python. A donation of just $5 will keep a programmer in prepositions for a month. $50 will supply enough articles to keep a small company understandable for over a year.

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico ros...@gmail.com wrote: On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards invalid@invalid.invalid wrote: Or can you simply use a stupid netmask like /1 that picks up all the IP ranges? That way, the source-IP check wouldn't fail. That would require that the

List comprehension vs filter()

2011-04-19 Thread Chris Angelico
Context: Embedded Python interpreter, version 2.6.6 I have a list of dictionaries, where each dictionary has a type element which is a string. I want to reduce the list to just the dictionaries which have the same type as the first one. lst=[{type:calc,...},{type:fixed,...},{type:calc,...},...]

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 6:15 PM, Grant Edwards invalid@invalid.invalid wrote: Or can you simply use a stupid netmask like /1 that picks up all the IP ranges? That way, the source-IP check wouldn't fail. That would require that the device somehow knows that it's not configured correctly and

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 8:12 PM, Dan Stromberg drsali...@gmail.com wrote: I agree though that you're kind of pushing IP in a direction it wasn't intended to go. It just occurred to me: You might get some additional mileage out of popping the network adapter into promiscuous mode. In fact, it

Re: List comprehension vs filter()

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 1:10 PM, Chris Angelico ros...@gmail.com wrote: type=lst[0][type].lower() lst=filter(lambda x: x[type].lower()==type,lst) # Restrict to that one type After posting, I realised that type is a built-in identifier, and did a quick variable name change to posttype which

Re: List comprehension vs filter()

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico ros...@gmail.com wrote: snip type=lst[0][type].lower() Tangent: Don't call it type; you're shadowing the built-in class of the same name. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension vs filter()

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 1:22 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico ros...@gmail.com wrote: snip type=lst[0][type].lower() Tangent: Don't call it type; you're shadowing the built-in class of the same name. By shadowing you mean that the

  1   2   3   >