Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Grant Edwards
. It's easy as long as you deal with nothing but ASCII and Latin-1. ;) -- Grant Edwards grant.b.edwardsYow! Somewhere in Tenafly, at New Jersey, a chiropractor gmail.comis viewing "Lea

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Grant Edwards
: 33 are non-printing control characters (now mostly obsolete) that affect how text and space is processed and 95 printable characters, including the space (which is considered an invisible graphic). -- Grant Edwards grant.b.edwardsYow

Re: I look for a package to make some simple console "form"

2012-04-02 Thread Grant Edwards
their console-mode-installer (which was written in Python). But, the docs are pretty sparse, and it's not very active these days. > I would like very low level feature, form like sphinx quick start or > modern-package-template? Sorry, no clue what those are... -- Grant Edwards

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-04-03 Thread Grant Edwards
the new code an hooking it into the indicated spot with jump instructions. The mind wobbled. -- Grant Edwards grant.b.edwardsYow! I'm a fuschia bowling at ball somewhere in Brittany gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Grant Edwards
On 2012-04-11, Antti J Ylikoski wrote: > I wrote about a straightforward way to program D. E. Knuth in Python, Yikes. I think if you're going to try to write AI in Pyton, you might want to start out programming something a bit simpler... ;) -- Grant Edwards grant.b

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Grant Edwards
tmp_file) >> result = os.system(cmd) >> >> ... on a Windows box it will fail because 'ssh' isn't part of Windows. > > ssh isn't guaranteed to be part of Unix/Linux systems surely. It's not absolutely, 100%, iron-clad guaranteed, but

Re: hex to bin 16 bit word

2012-04-27 Thread Grant Edwards
7;t exceed 0x1. This is probably better: n = int('0xc0a8'16) & 0x -- Grant Edwards grant.b.edwardsYow! What PROGRAM are they at watching? gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: hex to bin 16 bit word

2012-04-27 Thread Grant Edwards
On 2012-04-27, Grant Edwards wrote: > On 2012-04-27, Paul Rubin wrote: >> python writes: >>> What to decode hex '0xC0A8' and return signed short int. >> >> Is this right? >> >> n = int('0xC0A8', 16) >> if n >= 0xf

Re: hex to bin 16 bit word

2012-04-27 Thread Grant Edwards
On 2012-04-27, Grant Edwards wrote: > On 2012-04-27, Grant Edwards wrote: >> On 2012-04-27, Paul Rubin wrote: >>> python writes: >>>> What to decode hex '0xC0A8' and return signed short int. >>> >>> Is this right? >>>

Re: serial module

2012-05-22 Thread Grant Edwards
the normal ISA/PCI-attached drivers. The main things you'll notice are differences in buffer/fifo sizes and the timing of things like commands to set/clear modem control lines. -- Grant Edwards grant.b.edwardsYow! I didn't order any

Re: serial module

2012-05-22 Thread Grant Edwards
# close port And here to try to open and already-opened port: > ser.open() > > Why do I get this error? Becaue the port is already opened. :) -- Grant Edwards grant.b.edwardsYow! Sign my PETITION. at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: serial module

2012-05-22 Thread Grant Edwards
On 2012-05-19, Paul Simon wrote: > "Ron Eggler" wrote: >> [...] my code looks like this: >> #!/usr/bin/python [...] >>port='/dev/ttyUSB0', > Sounds like you may be using this on a Windows machine. I don't think so. :) -- Grant

Re: serial module

2012-05-22 Thread Grant Edwards
On 2012-05-22, John Nagle wrote: > On 5/22/2012 8:42 AM, Grant Edwards wrote: >> On 2012-05-22, Albert van der Horst wrote: > >>> It is anybody's guess what they do in USB. >> >> They do exactly what they're supposed to regardless of what sort of >

Re: serial module

2012-05-22 Thread Grant Edwards
re were issues with this. I've used probably a dozen different ones. I've read about some people having odd problems with them, but I've never seen any of the those problems. They've all "just worked" for me. -- Grant Edwards

Re: Email Id Verification

2012-05-25 Thread Grant Edwards
kes your users hate your > program? Don't do it! Write good code, useful code! Validating email > addresses is the wrong thing to do. I have to agree with Steven. Nothing will make your users swear at you as certainly as when you refuse to accept the e-mail address at which the reeiv

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Grant Edwards
eted over the years via some sort of random-walk process. PHP seems to encourage (if not require) bad practices such as returning values from functions via global or instance variables. -- Grant Edwards grant.b.edwardsYow! ! I'm in a very

Re: Pythonic cross-platform GUI desingers ?? la Interface Builder (Re: what gui designer is everyone using)

2012-06-14 Thread Grant Edwards
ou ever tried to _use_ a program built by a casual user? [OK, I'm half joking.] If casual users want a GUI builder they can use, then let 'em write one...:) -- Grant Edwards grant.b.edwardsYow! My nose feels like a at

Re: float("nan") in set or as key

2011-06-02 Thread Grant Edwards
ickle et al. 2) The string representations produced by repr() and accepted by float() weren't standardized across platforms. I think the latter has finally been fixed, hasn't it? -- Grant Edwards grant.b.edwardsYow! Remember, in 2039,

Re: float("nan") in set or as key

2011-06-03 Thread Grant Edwards
the standard says so" is actaully a darned good reason. Years of experience has also shown to me that it's a very practical decision. > If anything, it has proven to be a major nuisance. It takes a lot of > effort to create (or even specify) code which does the right thin

Re: float("nan") in set or as key

2011-06-06 Thread Grant Edwards
-of-A, I have a brief mental clash that, > if I am not careful, could result in various bad things. :-) I find that I do mostly OK driving "on the wrong side of the road" [except for the constant windshield/turn-signal mixups], but I have a horrible time as a

Re: float("nan") in set or as key

2011-06-06 Thread Grant Edwards
a behavior that's the same as with quiet NaNs? >>>> The correct answer to "nan == nan" is to raise an exception, >>>> because you have asked a question for which the answer is nether True >>>> nor False. >>> >>> Wrong. >>

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-13 Thread Grant Edwards
mouse. That's why I always buy keyboards without numeric keypads. :) Another good solution is to put the mouse on the left-hand side. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: search through this list's email archives

2011-06-24 Thread Grant Edwards
rovides a search capability also: > http://blog.gmane.org/gmane.comp.python.general FWIW, I've found the Gmane search feature to be very unreliable. It often overlooks a lot of matching articles for no apparent reason. -- Grant Edwards grant.b.edwardsYow! Were the

Re: Safely modify a file in place -- am I doing it right?

2011-06-29 Thread Grant Edwards
That's how Unix programs have modified files "in place" since time immemorial. > Is there a better/safer way? Many programs rename the original file with a "backup" suffix (a tilde is popular). -- Grant Edwards grant.b.edwardsYow! It's NO USE ... I've at gone to "CLUB MED"!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem!!

2011-07-03 Thread Grant Edwards
On 2011-07-03, amir chaouki wrote: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? Yes. -- Grant Edwards grant.b.edwardsYow! LOOK!

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
there a reason for not using Doxygen / Autodoc / etc, or at least > something in the same style? They work from specially-formatted > comments in the source code, rather than the compiled module object. Because those specially-formatted comments are wrong. -- Grant Edwards

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
thon feature I didn't know about > or have forgotten. You could probably implement at least two more languages using nothing but Python features I don't know about or have forgotten. :) Yet I still manage to get a lot accomplished using Python. -- Grant Edwards

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
On 2011-07-05, Waldek M. wrote: > Dnia Tue, 5 Jul 2011 14:11:56 + (UTC), Grant Edwards napisa?(a): >> Because those specially-formatted comments are wrong. > > ... because? In my experience, they're wrong because somebody changes the code and not the comments. > No

Re: Testing if a global is defined in a module

2011-07-07 Thread Grant Edwards
you have in mind > any better replacement? You write code that's easy to read, and you provide the language with introspection capabilities that allow you do do things like write a program that will list the symbols exported by a module. -- Grant Edwards grant.b.edwards

Re: Serial & reset of the device

2011-07-08 Thread Grant Edwards
TR and RTS off when a port is closed and turns them on when it's opened. I don't know what Windows does. A quick glance through the pyserial sources shows that it turns on DTR and RTS when a port is opened, and does nothing with them when a port is closed. If you need RTS/DTR to stay in

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Grant Edwards
nto one line. >> e.g. if a == 1: print a >> >> However I do not find it to be a particularly strong argument. I think >> PEP8 does not recommend this kind of coding style anyway, so one-liner >> should not be used in the first place! > > Basically, it looks better

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-13 Thread Grant Edwards
noun in the sentence makes it abundantly clear whether the noun is an object or a subject, yet we still often have two cases (it's "I run" rather than "Me run"). -- Grant Edwards grant.b.edwardsYow! I'm having an

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-13 Thread Grant Edwards
gives the reader a clue to expect additional information, > that the indented block that follows is not an independent > block, floating in space for its own reasons, but is intimately > linked to the previous line. Yup. [1] Since all posts criticising grammar or s

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-14 Thread Grant Edwards
On 2011-07-13, Thorsten Kampe wrote: > * Grant Edwards (Wed, 13 Jul 2011 13:03:22 + (UTC)) >> On 2011-07-13, Thorsten Kampe wrote: >> >> >> and that that block is to be considered in relation to what was just >> >> said, before the colon. >> >

Re: os.path.isdir do not work for Foder named '2011-07-03'

2011-07-19 Thread Grant Edwards
>>>> os.path.isdir("C:\Users\??\Desktop\logs\2011-07-03") > False You're not using backslashes corrrectly. Try assigning the path names to a "variable" and printing them. I think you'll see what's wrong. I

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Grant Edwards
. (and > PyPy, apparently) And there are always people trying to figure out how to get rid of it. So far the cures have been worse than the disease, but that may not always be the case... -- Grant Edwards grant.b.edwardsYow! ... the HIGHWAY is

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Grant Edwards
> has a standard library!) > > I've no idea what this means. I happily use pygtk. I agree. PyGTK works great -- on platforms where GTK works great. -- Grant Edwards grant.b.edwardsYow! !! I am having fun!!! at

Re: Convert '165.0' to int

2011-07-21 Thread Grant Edwards
"close as possible to the original float value" was the goal. Perhaps the OP just wants it truncated. -- Grant Edwards grant.b.edwardsYow! OVER the underpass! at UNDER the overpass! gma

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
to import decimal and use it >>> for rounding to work properly. >> >> It should be floor() though, for that is what int() does. > > Um, what? The example given by the OP implied that int(float(s)) did what he wanted. That is _not_ rounding the float. It's the equiv

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
On 2011-07-22, Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: > On 07/22/2011 10:21 AM, Grant Edwards wrote: >> While that may be clear to you, that's because you've made some >> assumptions. "Convert a properly formatted st

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
On 2011-07-22, Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: > On 07/22/2011 10:58 AM, Grant Edwards wrote: >> On 2011-07-22, Billy >> Mays<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: >>> Proper

Re: I am fed up with Python GUI toolkits...

2011-07-24 Thread Grant Edwards
ter does? I thought PyGUI it was based on GTk? That's what the web page seems to indicate. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: os.path needs immediate attention!

2011-07-30 Thread Grant Edwards
On 2011-07-30, Michael Poeltl wrote: > join 'Python-Dev'-mailinglist and tell them! > > from now on I will just ignore threads you initiated > > does trolling really make that much fun? RR must think so, considering how much effort he seems to put into it. It

Re: Hardlink sub-directories and files

2011-08-03 Thread Grant Edwards
ht. > I suppose it is a good thing systems don't allow that now. It wouldn't be a problem, except there are some important places in Unix where it is assume that filesystems are trees. Hard linking directories causes that assumption to be false. -- Grant

Re: Get the name of a function

2011-08-05 Thread Grant Edwards
quot; probably isn't what you're interested in: http://www.ibm.com/developerworks/library/l-pyint/index.html Here's a stack-overflow question similar to yours: http://stackoverflow.com/questions/1538342/how-can-i-get-the-name-of-an-object-in-python -- Grant Edwards

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread Grant Edwards
nd read it again, you have to use > the seek method: > > f.seek(0) It's too bad Python doesn't support the f.rewind() spelling for that operation. Rewinding disk files always made me smile... -- Grant Edwards grant.b.edwardsYow! Did I say I was

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Grant Edwards
erver service, and I need to get the packages sent to the old server >> and send them to my new server service to make sure it works well >> .How can I get the package and resent them to my new service? Is >> there such a tool or is there some functionality that tools such as

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Grant Edwards
On 2011-08-31, Steven D'Aprano wrote: > Well obviously the C++ people thought so :) Well _that's_ certainly a ringing endorsement in the context of designing a language that's easy to understand and use. ;) -- Grant Edwards grant.b.edwardsYow! Wh

Re: Threads in Python

2011-09-01 Thread Grant Edwards
't really comment on it much, but it may > be misusing the 'thread' word, but I somehow doubt it. I suspect > you're just mistaken about what Java is offering. Sure sounds like it. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Python fails on math

2011-02-24 Thread Grant Edwards
produce the same results as if the store had been done. IOW, I don't see that there's any difference between Python and C either. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Python fails on math

2011-02-24 Thread Grant Edwards
there aren't any intemediate values to store. > Or does Python use its own floating-point math? No, but the C compiler has no way of knowing what the Python expression is. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: urlopen returns forbidden

2011-02-28 Thread Grant Edwards
Referrer header for pages that don't allow direct-linking from "outside". As somebody else has already said, if the site provides an API that they want you to use you should do so rather than hammering their web server with a screen-scraper. Not only is is a lot less load on the sit

Re: Callbacks on program exiting/aborting

2011-03-03 Thread Grant Edwards
On 2011-03-03, Pengcheng Chen wrote: > What callback mechanisms can we use in Python? We have some device > drivers are in Python and sometimes they crash. I'd like to do some > cleanup before program abort/crash. Any suggestions? http://docs.python.org/library/atexit.html --

Re: question about endswith()

2011-03-03 Thread Grant Edwards
pect it to do, 2) what you see it do. IMPORTANT: Do _not_ retype code, input or output into your posting. Cut/paste both code and input/output into your posting. -- Grant Edwards grant.b.edwardsYow! How's it going in

Re: question about endswith()

2011-03-03 Thread Grant Edwards
On 2011-03-04, Matt Funk wrote: > Hi Grant, > first of all sorry for the many typos in my previous email. > > To clarify, I have a python list full of file names called 'files'. > Every single filename has extension='.hdf' except for one file which has > an

Re: What do I need to know in order to write a web application in python?

2011-03-06 Thread Grant Edwards
to make GUI applications, do they? I've been doing (mostly smallish) GUI programs on and off for 20 years, and that's all I've ever used. I tried the point-and-grunt method a couple and found it to be time consuming and the results to be bad (resizing never worked right). -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-09 Thread Grant Edwards
quot;other end" of the pipe or pty to which the program's stdin/stdout is attached. -- Grant Edwards grant.b.edwardsYow! All of life is a blur at of Republicans and meat! gmail.com

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
but that was a long time ago (25 years). At first first I thought he was talking about ReGIS, but that wasn't available on the vt200 (it was on vt240/330/340). -- Grant Edwards grant.b.edwardsYow! I didn't order any at WOO-

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
. It was a character-based, mostly-ANSI-escape-sequence, computer terminal connected via async serial (RS-232 typically) to a mini/mainframe computer (a DEC VAX running VMS in this context). -- Grant Edwards grant.b.edwardsYow! Gibble, Gobble, we

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
On 2011-03-10, GrayShark wrote: > On Thu, 10 Mar 2011 18:02:41 +0000, Grant Edwards wrote: > >> On 2011-03-10, Adam Tauno Williams wrote: >>> On Thu, 2011-03-10 at 00:38 -0600, GrayShark wrote: >>>> Once, many, many, years ago, I programmed some type of 

Re: attach to process by pid?

2011-03-10 Thread Grant Edwards
riting to /proc/fd/7346/fd/2 sends the data to the tty where the write was done, since /proc/fd/7346/fd/2 points to /dev/tty, and /dev/tty points to different things depending on who's doing the writing. There are _some_ cases where you can write to /proc/

Re: attach to process by pid?

2011-03-10 Thread Grant Edwards
x@frittenbude:~$ grep foobar >> >> 2: >> alex@frittenbude:~$ ps ax|grep 'grep foobar' >> 13075 pts/4 ?? ??S+ ?? ?? 0:00 grep --color=auto grep foobar >> alex@frittenbude:~$ echo foobar > /proc/13075/fd/0 > > This works fine on the

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Dennis Lee Bieber wrote: > On Thu, 10 Mar 2011 19:55:02 + (UTC), Grant Edwards > declaimed the following in > gmane.comp.python.general: > >> vt200 terminals. The vt200 wasn't a TV. It was a character-based, >> mostly-ANSI-escape-sequence, co

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Anssi Saari wrote: > Grant Edwards writes: > >> C wasn't very widely used under VMS, and VMS had it's own screen >> formatting and form handling libraries. > > Just curious, what language was widely used in VMS? >From what I remember, F

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Dennis Lee Bieber wrote: > On Fri, 11 Mar 2011 11:17:08 +0200, Anssi Saari declaimed > the following in gmane.comp.python.general: > >> Grant Edwards writes: >> >> > C wasn't very widely used under VMS, and VMS had it's own screen >

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
moving second hand on a 240. Comparing a vt220 to a vt240 is like comparing a black-and-white epson 9-pin dot-matrix printer that can't do graphics with a balck-and-white epson 9-pin dot-matrix printer than can do graphics. -- Grant Edwards grant.b.edwa

Re: Purely historic question: VT200 text graphic programming

2011-03-12 Thread Grant Edwards
ought 240's instead of 220's. It's not like anybody spent a lot of time looking at drawings of wombats -- in fact, I was probably the only person at the company who knew you could. [Talk about obscure VMS allusions...] -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-12 Thread Grant Edwards
and across a network. Oh, Certainly. The OP's question was so vague that I think we all know this is just an academic discussion and has nothing (practical) to do with the OP. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Purely historic question: VT200 text graphic programming

2011-03-12 Thread Grant Edwards
On 2011-03-12, Martin Gregorie wrote: > On Sat, 12 Mar 2011 17:11:37 +0000, Grant Edwards wrote: > >> The point I was trying to make was that the 240 was a >> superset of the 220, and could be used identically as the 220 was used. >> > Fair enough: I bow to hands-on

Re: Get Path of current Script

2011-03-14 Thread Grant Edwards
x world, finding out the path to the running program is almost always the wrong way to solve the problem. However, since we don't know the problem that's being solved, it's hard to suggest the "right" way to solve it. -- Grant Edwards g

Re: Get Path of current Script

2011-03-14 Thread Grant Edwards
sr/local/etc/muyprog.conf or something like that. Notice that it has nothing to do with the location of the program's executable. Not all Unix apps look in all 5 places (#2, is probably not quite as universal as the rest). Some apps have a directory of config files

Re: value of pi and 22/7

2011-03-18 Thread Grant Edwards
i=3. End Of. There's nothing wrong with that value. The measurements were given with one significant digit, so the ratio of the two measurements should only have one significant digit. -- Grant Edwards grant.b.edwardsYow! It's some people

Re: Directly Executable Files in Python

2011-03-29 Thread Grant Edwards
#x27;t buy it... Then don't. > it has to be reproducing the byte code interpreter in the code > segment and the byte code in the data segment... Something like that. -- Grant Edwards grant.b.edwardsYow! Either CONFESS now or

Re: Spam on the mailing list

2011-04-07 Thread Grant Edwards
er filtering out stuff and in part to my .score file entry that automatically discards anything posted via groups.google.com. -- Grant Edwards grant.b.edwardsYow! Do you have exactly at what I want in a plaid

Re: Argument of the bool function

2011-04-09 Thread Grant Edwards
ot take *keyword* > arguments; instead dir() takes *positional* argument: > > dir("Explicit is better than implicit") I think the point is that both cases are documented exactly the same. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread Grant Edwards
something() return something() or None return? somethingelse() return somethingelse() or None log("didn't find an answer") log("didn't find an answer") raise ValueError raise ValueError Are you saying the two snippets above are equivalent? -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread Grant Edwards
On 2011-04-12, James Mills wrote: > On Tue, Apr 12, 2011 at 11:44 AM, Grant Edwards > wrote: >> How is that the same? >> >> ??return? something() ?? ?? ?? ?? ?? ?? ?? ?? ??return something() or None >> ??return? somethingelse() ?? ?? ?? ?? ?? ?? ??return somethinge

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
On 2011-04-12, James Mills wrote: > On Tue, Apr 12, 2011 at 12:18 PM, Grant Edwards > wrote: >> You stated that >> >> ??return? >> >> was equivalent to >> >> ??return or None > > This is _not_ what I said. > > Quoting from my earli

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
does not return if expr is false. What you proposed returns None when expr is false. -- Grant Edwards grant.b.edwardsYow! Well, I'm INVISIBLE at AGAIN ... I might as well

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
# these two lines are ... if __temp__: return __temp__ # the OP's code snippet ... print "the code snippet did not return" ... >>> print foo(9) 9 >>> >>> print foo(0) the code snippet did not return None

Re: Egos, heartlessness, and limitations

2011-04-14 Thread Grant Edwards
On 2011-04-14, rantingrick wrote: > [the usual bait] One has to congratulate RR on how many fish he catches. I guess we should just be glad that in this electronic ocean overfishing doesn't cause a population crash. -- Grant Edwards grant.b.edwardsYow! Everyb

Re: An unusual question...

2011-04-18 Thread Grant Edwards
stion I have had for a while; when is PSF going > to forward PythonX on over to a formal standards committee like ansi or iso? Oh please no. Anything but that. Seriously. -- Grant Edwards grant.b.edwardsYow! Hmmm ... an arrogant

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

2011-04-19 Thread Grant Edwards
it, but there isn't an 'xor' operator to go along with 'or' and 'and'. Must not be something I need very often. -- Grant Edwards grant.b.edwardsYow! I am having FUN... at I wonder if it's

Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
ives UDP broadcast packets regardless of their source IP address? This probably is more of a Linux networking question than a Python question, but I'm hoping somebody has solved this problem in Python. -- Grant Edwards grant.b.edwardsYow! I want

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

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, broadca

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: >&g

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

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 no

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 requir

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
; popping the network adapter into promiscuous mode. In fact, it Might > be necessary irrespective of the rest of your approach. The network adapter is already receiving all the packets I want to receive, so putting it into promiscuous mode would only increase the number of

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Roy Smith wrote: > 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

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Heiko Wundram wrote: > Am 20.04.2011 01:54, schrieb Grant Edwards: >> I guess the problem is that I expected to receive a packet on an >> interface anytime a packet was received with a destination IP address >> that matched that of the the interface. A

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Dan Stromberg wrote: > 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 req

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Thomas Heller wrote: > Am 20.04.2011 00:21, schrieb Grant Edwards: >> I'm have problems figuring out how to receive UDP broadcast packets on >> Linux. > [...] >> >> On the receiving machine, I've used tcpdump to verify that broadcast >>

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Heiko Wundram wrote: > Am 20.04.2011 16:30, schrieb Grant Edwards: >>> If you need to see the packets regardless, either use a promiscuous mode >>> sniffer (i.e., tcpdump, but that's relatively easy to mirror in Python >>> using SOCK_RAW, capt

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Grant Edwards wrote: > On 2011-04-20, Heiko Wundram wrote: >>> I've thought about the SOCK_RAW option, but the CPU load of looking >>> all received Ethernet packets in user-space would be a big down-side. >> >> Not necessarily: instead o

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Adam Tauno Williams wrote: > On Wed, 2011-04-20 at 06:07 -0400, Sherm Pendley wrote: >> Grant Edwards writes: >> > I'm trying to implement a device discovery/configuration protocol that >> > uses UDP broadcast packets to discover specific ty

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
it didn't make any differnce. -- Grant Edwards grant.b.edwardsYow! My EARS are GONE!! at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Grant Edwards wrote: > On 2011-04-20, Heiko Wundram wrote: >> Am 20.04.2011 01:54, schrieb Grant Edwards: >>> I guess the problem is that I expected to receive a packet on an >>> interface anytime a packet was received with a destination IP address >&

<    1   2   3   4   5   6   7   8   9   10   >