Re: Feature suggestion -- return if true

2011-04-19 Thread Chris Angelico
On Tue, Apr 19, 2011 at 4:42 PM, Jussi Piitulainen wrote: > Factorials become an interesting demonstration of recursion when done > well. There's a paper by Richard J. Fateman, citing Peter Luschny: > > >

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 tracker

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 th

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 t

Re: Two similar logging programs but different ouputs

2011-04-19 Thread Vinay Sajip
On Apr 19, 6:35 am, Disc Magnet 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: http://docs.python.org/library/logging.confi

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

Re: [ANN] Python 2.5.6 Release Candidate 1

2011-04-19 Thread Paul Rubin
"Martin v. Löwis" 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 getting impo

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 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 you explain what you mean? What

Re: Python IDE/text-editor

2011-04-19 Thread Vlastimil Brom
2011/4/19 Alec Taylor : > 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 http://pythonide.blogspot.com/2008/02/spe-084c-python-ide-editor-released.html dow

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 Firef

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 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 to read the conte

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Mark Carter
On Apr 19, 12:44 pm, Mark Carter 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 = "C:\\Users\\$ME\\AppData\\Roaming\\Mozilla\\Fir

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 wrote: > On Apr 19, 12:44 pm, Mark Carter 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 mech

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

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 Py

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

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

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 skips

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

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

2011-04-19 Thread Jean-Paul Calderone
On Apr 19, 10:23 am, Grant Edwards wrote: > On Tue, Apr 19, 2011 at 7:09 AM, Christian Heimes 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 > >>

Re: "Fatal Python Error" Need Help

2011-04-19 Thread Ned Deily
In article , Yogesh Gupta 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 /sw64/bin/python > or /sw64/bin/python2.5) , although i have python2.6 and 2.7 in

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 name

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" wrote: All right... somebody is sacked (er, fired) ! Who moved reload()? This kinda stuff is driving me bonkers... there was no need to move reload() anyplace... ... so

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 o

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 answe

Re: Namespaces in functions vs classes

2011-04-19 Thread Ian Kelly
On Tue, Apr 19, 2011 at 10:31 AM, Ethan Furman 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 separate n

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

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 c

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 verbo

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 suppo

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 s

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 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, but as you can see be

Re: Pickling over a socket

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 11:53 AM, Roger Alexander 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 > pickle.dum

Re: Pickling over a socket

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 4:53 AM, Roger Alexander 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 > pickle.dump

Re: Pickling over a socket

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 11:53 AM, Roger Alexander 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 > pickle.dum

Re: Pickling over a socket

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 5:30 AM, Dan Stromberg 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, that would do it! C

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 > On Tue, Apr 19, 2011 at 7:55 AM, Rob McGillivray > wrote: > > Hi All, > > > > I

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

Re: optparse eats $

2011-04-19 Thread John Gordon
In tazz_ben 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 single-quotes instead. -- John Gordon A is for Amy, who fell down the

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('--fi

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

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 bina

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

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

Re: Namespaces in functions vs classes

2011-04-19 Thread Rhodri James
On Tue, 19 Apr 2011 17:47:40 +0100, Gerald Britton 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 separate namesp

Re: Namespaces in functions vs classes

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 8:00 AM, Rhodri James 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 generous > help, we can be

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) s.setsockop

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 topi

Re: Teaching Python

2011-04-19 Thread geremy condra
On Tue, Apr 19, 2011 at 3:42 PM, Passiday 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 classes plan f

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

Re: Teaching Python

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 4:03 PM, geremy condra wrote: > On Tue, Apr 19, 2011 at 3:42 PM, Passiday 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

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong 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--- >> #!/usr/bin/py

Re: Teaching Python

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 3:42 PM, Passiday 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 classes plan f

Re: Teaching Python

2011-04-19 Thread geremy condra
On Tue, Apr 19, 2011 at 4:24 PM, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 4:03 PM, geremy condra wrote: >> On Tue, Apr 19, 2011 at 3:42 PM, Passiday wrote: >>> Hello, >>> >>> I am planning to teach Python to a group of high school students, who have >>> in-depth interest in programming, h

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

2011-04-19 Thread Ben Finney
"Rhodri James" 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 scourge! I lately lost

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 3:21 PM, Grant Edwards 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 never sees any pac

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 Programmi

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong 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

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 wrote: > On Tue, Apr 19, 2011 at 4:24 PM, Dan Stromberg > wrote: > > On Tue, Apr 19, 2011 at 4:03 PM, geremy condra > wrote: > >> On Tue, Apr 19, 2011 at 3:42 PM, Passiday wrote: > >>>

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 F

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong 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 routed across

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 -- http://mail.python.org/mailman/listinfo/python-li

Re: Problem receiving UDP broadcast packets.

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

Re: Teaching Python

2011-04-19 Thread Ben Finney
Dan Stromberg writes: > On Tue, Apr 19, 2011 at 4:03 PM, geremy condra 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 pejorative meaning of “hack” before

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong 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

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 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 have sent it to the

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 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): >            @clas

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards 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 set up the device. >

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 addit

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards > 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

Re: Remote Connection

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 6:04 PM, ray 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 will process

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards 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 should change the

Re: Teaching Python

2011-04-19 Thread John Bokma
Passiday 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 - website or book,

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/ http://ocw.mit.edu/courses/electrical-engi

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 Uÿhttp://itunes.apple.com/us/itunes-u/introduction-to-computer-science/id341597455,http://stuff.mit.edu/i

Re: Pickling over a socket

2011-04-19 Thread Jean-Paul Calderone
On Apr 19, 6:27 pm, Roger Alexander 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 accepts arbitr

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 James" 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, w

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards > 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 no

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":"c

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 6:15 PM, Grant Edwards 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 should change the

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Dan Stromberg
On Tue, Apr 19, 2011 at 8:12 PM, Dan Stromberg 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 Might be necessary

Re: List comprehension vs filter()

2011-04-19 Thread Chris Angelico
On Wed, Apr 20, 2011 at 1:10 PM, Chris Angelico 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 shouldn't

Re: List comprehension vs filter()

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico wrote: > 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 wrote: > On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico wrote: > >> 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 global variable still exists

Re: Remote Connection

2011-04-19 Thread ray
On Apr 19, 8:23 pm, Chris Rebert wrote: > On Tue, Apr 19, 2011 at 6:04 PM, ray 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 ma

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Roy Smith
In article , Grant Edwards wrote: > I'm trying to implement a device discovery/configuration protocol that > uses UDP broadcast packets to discover specific types of devices on > the local Ethernet segment. The management program broadcasts a > discovery command to a particular UDP port. All d

Re: IDLE bug

2011-04-19 Thread harrismh777
Terry Reedy wrote: If one is new to Python and perhaps not sure, or should not be sure, then I prefer that one ask here for a second opinion. Thanks Terry. I am not new to Python, but I am new to Python3, and I'm also relatively new to IDLE. Typically I edit with vi, test on the terminal, and

Re: List comprehension vs filter()

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 8:23 PM, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 1:22 PM, Chris Rebert wrote: >> On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico wrote: >> >>> type=lst[0]["type"].lower() >> >> Tangent: Don't call it "type"; you're shadowing the built-in class of >> the same name

  1   2   >