Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-19, Grant Edwards wrote: > I'm have problems figuring out how to receive UDP broadcast packets on > Linux. Thanks to everybody for their help with what turned out to have little or nothing to do with Python itself. The main problem was reverse-path filtering (which is

Re: Problem receiving UDP broadcast packets.

2011-04-21 Thread Grant Edwards
On 2011-04-21, Dan Stromberg wrote: > On Wed, Apr 20, 2011 at 7:21 AM, Grant Edwards > wrote: >> On 2011-04-20, Dan Stromberg wrote: >>> On Tue, Apr 19, 2011 at 8:12 PM, Dan Stromberg wrote: >>>> I agree though that you're kind of pushing IP in a d

Re: NaN

2011-04-28 Thread Grant Edwards
sensors return a NaN when the value is unkown/invalid it seemed logical to continue with that paradigm in my Python code -- and it pretty much "just works". -- Grant Edwards grant.b.edwardsYow! If elected, Zippy

Re: NaN

2011-04-28 Thread Grant Edwards
x27;s in a float is a NaN, so all 9's in a BCD value is a NaN. Sort of makes sense if the BCD operations propogate "all-nine" values or raise exceptions when they are encountered (that's a big if). -- Grant Edwards grant.b.edwardsYow! If elected, Zippy

Re: What other languages use the same data model as Python?

2011-05-02 Thread Grant Edwards
bytes addressed from 0 to max-int or max-long" thing is merely an implicit assumption made by bad C programmers. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-03 Thread Grant Edwards
ather like a macro language (e.g. cpp) which merely performs a textual substitution of the argument name (the difference between pass-by-name and macro substitution is that the context of the argument evaluation is different). -- Grant Edwards grant.b.edwards

Re: What other languages use the same data model as Python?

2011-05-03 Thread Grant Edwards
topic, > actually.) It's not so wrong to think of Python's parameter handling as > ordinary assignments from outer namespaces to an inner namespace. As long as you think of "ordinary assignments" the Python way and not the C or PL/I way. :) -- Grant Edward

Re: vertical ordering of functions

2011-05-03 Thread Grant Edwards
lly expect the opposite: callees above, callers below, main at the bottom. However, that's mostly just a habit left over from C programming where such an ordering avoids having to litter the file with forward declarations for functions. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic interaction with another program

2011-05-04 Thread Grant Edwards
going to do the OP much good. Quoting from the web page: "Pexpect does not currently work on the standard Windows Python" > http://www.noah.org/wiki/pexpect Seriously? Yellow on brown text? -- Grant Edwards grant.b.edwardsYow! When this load is

Re: Basic interaction with another program

2011-05-04 Thread Grant Edwards
On 2011-05-04, Ian Kelly wrote: > On Wed, May 4, 2011 at 10:52 AM, Grant Edwards > wrote: >> On 2011-05-04, Matty Sarro wrote: >>> On Wed, May 4, 2011 at 12:34 PM, ETP wrote: >>>> I have a dos program (run in a window) that I would like to control >>

Re: Today's fun and educational Python recipe

2011-05-04 Thread Grant Edwards
nately the difficulty in debugging and maintaining code is often directly proportional to the cleverness exhibited by the original programmer. -- Grant Edwards grant.b.edwardsYow! I'm also against at BODY-SURFING!!

Re: What other languages use the same data model as Python?

2011-05-04 Thread Grant Edwards
> data item on the call stack as a parameter. C is pass by value. if I call foo(x) And this is foo: void foo (float param) { param = 1.23 } The value of x in the caller's namespace is not changed. If C used pass by reference, x would change. -- Grant Edwards

Re: What other languages use the same data model as Python?

2011-05-04 Thread Grant Edwards
On 2011-05-04, harrismh777 wrote: > Grant Edwards wrote: >>> We do not consider passing a pointer as*by value* because its an >>> > address; by definition, that is pass-by-reference. >> No, it isn't. It's pass by value. The fact that you are passing

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
On 2011-05-05, harrismh777 wrote: > Grant Edwards wrote: >> The "pass by value" and "pass by reference" parameter passing >> mechanisms are pretty well defined, and C uses "pass by value". > > Yeah, that's kind-a funny, cause I'm one o

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
by_value_ to a function. That function then uses the "*" operator to use that value to access some data. -- Grant Edwards grant.b.edwardsYow! DIDI ... is that a at MARTIAN name, or, are we gmail.comin ISRAEL? -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
using a language that doesn't directly implement such constructs. You might as well say that C is a linked-list language like Lisp since you can write a linked list implementation in C. If you said that you'd be just as wrong as saying that C uses call-by-reference. -- Grant Ed

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
eter. Every time the callee needs to > refer to the parameter, it evaluates this function. > > This allows some neat tricks, but it's massive overkill for most > uses. It also is a very good source of surprising bugs. -- Grant Edwards grant.b.edwardsYow!

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
Who is "most of the world" ? Pretty much everybody except you. Please see: > http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr233.htm Yea, I read that. It doesn't support your argument. It agrees with th

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
naive NetBSD "C" version. When we switched to the FreeBSD stack (and a newer compiler) a few years later, my assembly code got tossed out because was no longer any faster than the C version. -- Grant Edwards grant.b.edwardsYow! Half a mind is a

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
itecture And a lot of the are still full-up Harvard architecture (e.g. the entire Atmel AVR family and Intel 8051 family for example). -- Grant Edwards grant.b.edwardsYow! When this load is at DONE I think I'l

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
On 2011-05-05, Steven D'Aprano wrote: > On Thu, 05 May 2011 14:14:22 +0000, Grant Edwards wrote: > >> On 2011-05-05, harrismh777 wrote: >>> Grant Edwards wrote: >>>> The "pass by value" and "pass by reference" parameter passing >>

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
ecessary wear on the syncros (and I've had cars with pretty weak syncros -- Alfa-Romeo Spyders were famous for the 2nd gear syncro wearing out). > and if that isn't automatic, I don't know what is No, that's _not_ automatic if you have to do it yourself. It's a

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
On 2011-05-05, Roy Smith wrote: > In article , > Grant Edwards wrote: > >> That's what I was trying to say, but probably not as clearly. The "&" >> operatore returnas a _value_ that the OP passes _by_value_ to a >> function. That function then

Re: What other languages use the same data model as Python?

2011-05-05 Thread Grant Edwards
do some really cool stuff in the deep end. Until you get pulled under and drowned by some flailing goof who oughtn't be there. -- Grant Edwards grant.b.edwardsYow! Zippy's brain cells at are straining to brid

Re: What other languages use the same data model as Python?

2011-05-07 Thread Grant Edwards
On 2011-05-07, Gregory Ewing wrote: > Grant Edwards wrote: >> if you feel it just right and you have just the >>>right synchro-mesh setup, you can slide from 3rd into 4th without >>>every touching the clutch peddle... >> >>>and if that isn't automa

Re: What other languages use the same data model as Python?

2011-05-10 Thread Grant Edwards
se. > > Who says it has to have the Pascal/Fortran/etc sense? Because it's easier to communicate if everybody agrees on what a word means. -- Grant Edwards grant.b.edwardsYow! The SAME WAVE keeps at coming in and COL

Re: What other languages use the same data model as Python?

2011-05-10 Thread Grant Edwards
On 2011-05-10, Hans Georg Schaathun wrote: > On Tue, 10 May 2011 14:05:34 + (UTC), Grant Edwards > wrote: >: Because it's easier to communicate if everybody agrees on what a word >: means. > > Why should we agree on that particular word? Are there any other words &

Re: obviscating python code for distribution

2011-05-16 Thread Grant Edwards
code bases out there? The owner of something is free to determine how it is distributed -- he doesn't have any obligation to prove to you that some particular method of distribution is harmful to him or anybody else. -- Grant Edwards grant.b.edwardsYow!

Re: English Idiom in Unix: Directory Recursively

2011-05-21 Thread Grant Edwards
r 25+ years, almost all in C, and I don't think I've never seen such a compiler. Even on the register-starved 6800 architecture, the first parameter was passed in a register. On architectures with more registers (H8, MSP430, ARM, etc.) It's usually the first 3 or so parameter

Re: The worth of comments

2011-05-27 Thread Grant Edwards
follows >> can be described in full. > > This I disagree with. If a section of code is interesting enough to > deserve an explanation, then it is better to capture it in a > helpfully-named function with its doc string having the explanation. I consider docstrings to be the same as com

Re: The worth of comments

2011-05-27 Thread Grant Edwards
picture of them, my initial reaction is almost always "no, that's not at all what I thought he/she looked like". Odd. -- Grant Edwards grant.b.edwardsYow! I demand IMPUNITY! at

Re: The worth of comments

2011-05-27 Thread Grant Edwards
On 2011-05-27, Irmen de Jong wrote: > On 27-05-11 15:54, Grant Edwards wrote: >> On 2011-05-27, Ben Finney wrote: >>> Richard Parker writes: >>> >>>> On May 26, 2011, at 4:28 AM, python-list-requ...@python.org wrote: >>>> >>>>&

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

2011-05-28 Thread Grant Edwards
ual to itself. No, it's not. >>> x = float("nan") >>> y = x >>> x is y True >>> x == y False > I can't cite this in a spec, but it makes sense (to me) that two things > which are nan are not necessarily the same nan. Even if they _are_ the same nan, it's still not equal to itself. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

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

2011-05-29 Thread Grant Edwards
on >> python-dev, and the decision was to leave things as-is. > > On Sonntag 29 Mai 2011, Grant Edwards wrote: >> Even if they are the same nan, it's still not equal to itself. > > if I understand this thread correctly, they are not equal to itself > as specified by IEEE

Re: The worth of comments

2011-05-29 Thread Grant Edwards
code so it's purpose and operation is obvious from the code, and then delete the comment. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

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

2011-06-01 Thread Grant Edwards
ogation of non-signalling nans, the behavior of infinities, etc. > I'm glad I don't often need floating point numbers. They can be so > annoying! They can be -- especially if one pretends one is working with real numbers instead of fixed-length binary floating point numbers.

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

2011-06-01 Thread Grant Edwards
On 2011-06-01, Roy Smith wrote: > In article > Carl Banks wrote: > >> pretty much everyone uses IEEE format > > Is there *any* hardware in use today which supports floating point using > a format other than IEEE? Well, there are probably still some VAXes around in o

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

2011-06-01 Thread Grant Edwards
t would violate the IEEE standard. IEEE-754 has it's warts, but we're far better off than we were with dozens of incompatible, undocumented, vendor-specific schemes (most of which had more warts than IEEE-754). -- Grant Edwards grant.b.edwardsYow! I'm dressing

Re: Case-insensitive string equality

2017-09-05 Thread Grant Edwards
of rules, but it's almost universally considered bad style and you will lose points with your teacher, editor, etc. On the inter-tubes generally indicates you're shouting, or just a kook. I guess if either of those is true, then it's good style. -- Gr

Re: Run python module from console

2017-09-05 Thread Grant Edwards
On 2017-09-05, Andrej Viktorovich wrote: > Hello, > > I suppose I can run python module by passing module as param for executable: > > python.exe myscr.py > > But how to run script when I'm inside of console and have python prompt: > >>>> os.system(

Re: A question on modification of a list via a function invocation

2017-09-05 Thread Grant Edwards
recent GCC on a 32-bit CPU, it generated pretty much the same code either way... -- Grant Edwards grant.b.edwardsYow! Someone in DAYTON, at Ohio is selling USED gmail.comCARPETS to a

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Grant Edwards
ecorded with 'O' > despite going first, which is contrary to the conventions of the > game. I assumed that was a regional thing. -- Grant Edwards grant.b.edwardsYow! You mean you don't at want to watch WRESTLI

Re: Using Python 2

2017-09-08 Thread Grant Edwards
and written a 'bytes' class for Python2 that would be compatible with Python3. -- Grant Edwards grant.b.edwardsYow! Uh-oh!! I forgot at to submit to COMPULSORY gmail.comURINALYSIS! -- https://mail.python.org/mailman/listinfo/python-list

Re: "tkinter"

2017-09-13 Thread Grant Edwards
've never heard anybody try to pronounce TCL/Tk. -- Grant Edwards grant.b.edwardsYow! Now we can become at alcoholics! gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: += and =+

2017-09-13 Thread Grant Edwards
"credits" or "license" for more information. >>> i=1 >>> i=+ File "", line 1 i=+ ^ SyntaxError: invalid syntax >>> -- Grant Edwards grant.b.edwardsYow! It's NO USE ... I've at gone to "CLUB MED"!! gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: "tkinter"

2017-09-13 Thread Grant Edwards
3. No matter how hard you try, Tkinter apps always look a bit foreign. I've just given up trying to them to look like native apps: it doesn't work, and it annoys the mule. [1] After wasting several days fighting with TCL's quoting sematics, I gave up and wrot

Re: "tkinter"

2017-09-13 Thread Grant Edwards
probably said it aloud less than a half-dozen times in the past twenty-whatever years. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Even Older Man Yells At Whippersnappers

2017-09-19 Thread Grant Edwards
k in my undergrad days we used AHPL and implemented something like a simplified PDP-11 ISA.] Alternatively, you should design an instruction set and implement it using microcode and AM2900 bit-slice processors. -- Grant Edwards grant.b.edwardsYow! Could I

Re: Old Man Yells At Cloud

2017-09-19 Thread Grant Edwards
just adding to the cost. When I was a kid, making change like that was something we were all taught in school. I have a feeling that's been dropped from most curricula. -- Grant Edwards grant.b.edwardsYow! MMM-MM!! So THIS is at

Re: Old Man Yells At Cloud

2017-09-19 Thread Grant Edwards
et the lowest price that way. (But you also get the lowest price applying them in any other order.) A simple experiment would show that it doesn't matter, but none of the ever thought to try it. -- Grant Edwards grant.b.edwardsYow! Send your questions to

Re: Even Older Man Yells At Whippersnappers

2017-09-20 Thread Grant Edwards
, SPARC) it's fine (in some wasy simpler and easier than on many 8-bit processors). On x86_64 it's a mess -- just like it was a mess on x86 (and to a large extent on 8086). -- Grant Edwards grant.b.edwardsYow! So this is what it

Re: Even Older Man Yells At Whippersnappers

2017-09-20 Thread Grant Edwards
On 2017-09-20, Gregory Ewing wrote: > Grant Edwards wrote: >> Alternatively, you should design an instruction set and implement it >> using microcode and AM2900 bit-slice processors. > > AMD2900? That's cheating! You should design and build your > own logic gates.

Re: Old Man Yells At Cloud

2017-09-20 Thread Grant Edwards
Now I am supposed to add /what/ to the cost? >>Start at the smallest end. You need to make 21 cents up to 25. So hand >>back four pennies. > > Yes, but to know this ("four") I have to do a /subtraction/: > > 25 - 21 = 4. No, you don't. You start at &qu

Re: TypeError with map with no len()

2017-09-25 Thread Grant Edwards
; y1 = map(math.sin, math.pi*t) > plt.plot(t,y1) > > However, at this point, I get a TypeError that says > > object of type 'map' has no len() you probably need to convert y1 from a 'map' object (a type of an iterator) to an array. y1 = map(ma

Re: Grumpy-pants spoil-sport [was Re: [Tutor] beginning to code]

2017-09-26 Thread Grant Edwards
to be used in all threas arguing about what to call the Python argument passing scheme? That way the other 99% of us could pre-emptively plonk it? -- Grant Edwards grant.b.edwardsYow! My BIOLOGICAL ALARM

Re: Grumpy-pants spoil-sport [was Re: [Tutor] beginning to code]

2017-09-26 Thread Grant Edwards
On 2017-09-26, alister via Python-list wrote: > On Tue, 26 Sep 2017 14:16:47 +0000, Grant Edwards wrote: > >> On 2017-09-26, Ned Batchelder wrote: >>> On 9/25/17 10:20 PM, Steve D'Aprano wrote: >>>> On Tue, 26 Sep 2017 02:54 am, Ned Batchelder wrote: &g

Re: The "loop and a half"

2017-10-04 Thread Grant Edwards
thon for twenty years, and I don't think I have > ever once read from a file using a while loop. You're right, that construct isn't used for reading from files in Python. It _is_ commonly used for reading from things like sockets: mysock.connect(...) while

Re: The "loop and a half"

2017-10-05 Thread Grant Edwards
On 2017-10-05, bartc wrote: > Note that Unix way isn't the ONLY way of doing things. Of course not, but it is the CORRECT way of doing things. :) -- Grant Edwards grant.b.edwardsYow! Am I in GRADUATE at SC

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Grant Edwards
On 2017-10-06, Thomas Jollans wrote: > Seriously? sys.stdin can be None? That's terrifying. Why? Unix daemons usually run with no stdin, stderr, or stdout. And yes, people do write Unix daemons in Python. -- Grant Edwards grant.b.edwardsYow! VICARIOUSLY ex

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Grant Edwards
On 2017-10-06, Chris Angelico wrote: > On Sat, Oct 7, 2017 at 4:05 AM, Grant Edwards > wrote: >> On 2017-10-06, Thomas Jollans wrote: >> >>> Seriously? sys.stdin can be None? That's terrifying. >> >> Why? >> >> Unix daemons usually run wi

Re: The "loop and a half"

2017-10-06 Thread Grant Edwards
eal with remote systems connected via satellites links, low-bandwidth RF modems, and whatnot. Even cellular network connections often have high latency and low bandwidth. -- Grant Edwards grant.b.edwardsYow! BELA LUGOSI is my at

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-06 Thread Grant Edwards
run a lot of GTK programs from the command line, and I would say 90% or more of them spew a steady stream of meaningless (to the user) diagnostic messages. That's pretty sloppy programming if you ask me... -- Grant Edwards grant.b.edwardsYow!

Re: The "loop and a half"

2017-10-06 Thread Grant Edwards
editor, and then a separate terminal (or, as > I tend to do, *many* separate terminals) to run commands in. Indeed, I find that to be very efficient. I'm always amazed how long it takes people to accomplish simple tasks when they refuse to use anything other than eclipse and a web br

Re: The "loop and a half"

2017-10-06 Thread Grant Edwards
On 2017-10-06, bartc wrote: > For sort, there is no real need. You use a text editor to create > your data. Then use existing file-based sort. I sort streams on stdin far more often than I sort named files. -- Grant Edwards grant.b.edwardsYow! Do you like &

Re: The "loop and a half"

2017-10-07 Thread Grant Edwards
On 2017-10-07, bartc wrote: > Interactive Python requires quit() or exit(), complete with parentheses. Nonsense. On Unix you can just press ctrl-D (or whatever you have configured as eof) at the command prompt. On windows, it's Ctrl-Z . > Unless you've redefined quit and exit as something else

Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

2017-10-07 Thread Grant Edwards
source programs is far, far better -- maintainers often actually care whether the program works correclty and does useful things. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: The "loop and a half"

2017-10-07 Thread Grant Edwards
don't get me started on command-line utilities that use colored output that's only usable if yor terminal is configured with a black background. Hint to gentoo portage authors: yellow-on-white text is _not_ readable. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: exception should not stop program.

2017-10-07 Thread Grant Edwards
syslog.syslog("%s: %s\n" % (sys.argv[0], traceback.format_exc())) sys.exit(1) If it's a GUI program, then popping up an error dialog instead of sending it to syslog might make more sense -- if you can be reasonably sure that the GUI framework is still oper

Re: The "loop and a half"

2017-10-08 Thread Grant Edwards
t; > Using Ctrl+Z (0x1A) isn't specific to Python. The Windows CRT's > text-mode I/O inherits this from MS-DOS, which took it from CP/M. Which took it from RSX-11. Or probably more specifically from FILES-11. I woldn't be surprised if the enineers at DEC got it from somewhere else before that. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: The "loop and a half"

2017-10-09 Thread Grant Edwards
On 2017-10-09, Gregory Ewing wrote: > Grant Edwards wrote: >> Which took it from RSX-11. Or probably more specifically from >> FILES-11. I woldn't be surprised if the enineers at DEC got it from >> somewhere else before that. > > Quite possibly it goes back to

Re: The "loop and a half"

2017-10-09 Thread Grant Edwards
t sub-gigabit network speeds. The toolkit designers have botched things up so that even the most trivial operation requires hundreds of round-trips between server and client. -- Grant Edwards grant.b.edwardsYow! Did YOU find a at

Re: The "loop and a half"

2017-10-09 Thread Grant Edwards
On 2017-10-09, Marko Rauhamaa wrote: > Grant Edwards : > >> On 2017-10-09, alister via Python-list wrote: >> >>> or if you want the luxury of a GUI editor simply ssh to the remote >>> machine & run the editor there (using X forwarding to route the >>

Re: The "loop and a half"

2017-10-09 Thread Grant Edwards
+--+ > | Wayland | > | compositor | > +-+ > > > Which will get rid of the network transparency altogether. For all practial purposes, X11 network transparancy has been gone for years: it only works for apps that nobody cares about. I still u

Re: Is there a way to globally set the print function separator?

2017-10-09 Thread Grant Edwards
p='' each time? Yep. Just define a new function with a new name: def myprint(*args, **kw): print(*args, sep='', **kw) Redefining builtins is just going get you sworn at down the road a bit. If not by yourself, then by somebody else... -- Grant Edwards

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
On 2017-10-11, Bill wrote: > [...] I'm not here to "cast stones", I like Python. I just think > that you shouldn't cast stones at C/C++. Not while PHP exists. There aren't enough stones in the world... -- Grant Edwards grant.b.edwards

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
sually not as bad as the > example), crop up often enough to be a nuisance. The easiest way to make stuff like that readable is to unroll them into a sequence of typedefs. But, a lot of people never really learn how to do that... -- Grant Edwards

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
On 2017-10-11, Bill wrote: > Grant Edwards wrote: >> On 2017-10-11, Bill wrote: >> >> >>> [...] I'm not here to "cast stones", I like Python. I just think >>> that you shouldn't cast stones at C/C++. >> Not while PHP exists. Th

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
world... >>>> >>> PHP seems (seemed?) popular for laying out web pages. Are their vastly >>> superior options? >> Python? Superior syntax for sure > > I believe that. What accounts for the popularity of PHP then? I ask myself that ev

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
ng, but it's very incomplete, and leaves a _lot_ of things undefined. Of course the PHP lanugage itself is such a mess, it's often not very easy to understand what's going on. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
in Python? I like them in C because it allows the linker to place them in ROM with the code. It also _sometimes_ provides useful diagnostics when you pass a pointer to something which shouldn't be modified to something that is going to try to modify it. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Grant Edwards
ues. Nope. If sizeof char is not 1, then it's not C. That doesn't mean that a char can't be 9, 11, 16, 20, 32, or 64 bits, but sizeof char is 1. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
st with strings in C with amateurish libraries is a headache because _some_people_ will write their declarations so as to require pointers to mutable strings even when they have no intention of mutating them. Those people should be hunted down and slapped with a herring until they understand the er

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
g through their teeth. That's indeed a problem. Personally, I would just use two prototypes: char *strcstr(const char *s, char *s); const char *cstrstr(const char *s, const char *s); Whether you want to invoke some linker-script magic to make them refer t

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
On 2017-10-12, Steve D'Aprano wrote: > On Thu, 12 Oct 2017 04:41 pm, Grant Edwards wrote: > > >>> Even two >>> different C compilers could return different values. >> >> Nope. If sizeof char is not 1, then it's not C. > > Today I Learned.

Re: Want to write a python code for sending and receiving frames over wifi/wlan0 using python

2017-10-12 Thread Grant Edwards
Windows have had to convert all of our applicatoins which used to use raw packets to use UDP instead. I'm told that recent windows versions have made raw packet access from userspace (even by admin apps) virtually impossible. -- Grant Edwards grant.b.edwardsYow! Hello?

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
On 2017-10-12, Marko Rauhamaa wrote: > Grant Edwards : > >> Using const with strings in C with amateurish libraries is a headache >> because _some_people_ will write their declarations so as to require >> pointers to mutable strings even when they have no intention of

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
On 2017-10-12, Rhodri James wrote: > On 12/10/17 16:06, Grant Edwards wrote: >> On 2017-10-12, Steve D'Aprano wrote: >>> On Thu, 12 Oct 2017 04:41 pm, Grant Edwards wrote: >>> >>>>> Even two different C compilers could return different values. >

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
On 2017-10-12, Steve D'Aprano wrote: > On Fri, 13 Oct 2017 02:06 am, Grant Edwards wrote: > >> It sure was an education the first I wrote C code for >> a machine where >> >> 1 == sizeof char == sizeof int == sizeof long == sizeof float == sizeof >> double

Re: Lies in education [was Re: The "loop and a half"]

2017-10-12 Thread Grant Edwards
On 2017-10-13, Stefan Ram wrote: > Grant Edwards writes: There is no such >>thing as a "byte" in C. > > ยป3.6 > > 1 byte > > addressable unit of data storage large enough to hold > any member of the basic character set of the exec

Re: Heroku (was Re: Lies in education [was Re: The "loop and a half"])

2017-10-13 Thread Grant Edwards
e a difference, and everyone's > acknowledged this - PHP built up some inertia - but there's now no > real reason for it other than "it's popular, therefore people use it". Well, it's said that suffering builds character... What they don&

Re: Lies in education [was Re: The "loop and a half"]

2017-10-13 Thread Grant Edwards
build machines that simulated armies of ladies > with sewing needles! I interviewed at a company that was still making core memory in 1989. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: how to read in the newsreader

2017-10-16 Thread Grant Edwards
gmane, I don't bother with it. -- Grant Edwards grant.b.edwardsYow! Were these parsnips at CORRECTLY MARINATED in gmail.comTACO SAUCE? -- https://mail.python.org/mailman/listinfo/python-list

Re: how to read in the newsreader

2017-10-16 Thread Grant Edwards
On 2017-10-16, Paul Moore wrote: > On 16 October 2017 at 15:41, Grant Edwards wrote: >> On 2017-10-16, Terry Reedy wrote: >>> On 10/15/2017 10:50 PM, Andrew Z wrote: >>>> Gents, >>>> how do i get this group in a newsreader? >>> >>>

Re: Just a quick question about main()

2017-10-27 Thread Grant Edwards
ften far easier and faster to also include a main() for deveopment and testing of the functions provided to the GUI. -- Grant Edwards grant.b.edwardsYow! ONE LIFE TO LIVE for at ALL MY CHILDREN in

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Grant Edwards
from run to run (it may be the same "place" in the > > Since the process virtual memory space should be the same on each run Not with modern OS kernels: https://en.wikipedia.org/wiki/Address_space_layout_randomization -- Grant Edwards

Re: String changing size on failure?

2017-11-01 Thread Grant Edwards
tion is >> identical to those or the original string, so it can share them. > > That explains why b is larger than a to begin with No, that size difference is due to the additional bytes required for the internal representation of the string. > but it doesn't explain why float(b)

Re: Thread safety issue (I think) with defaultdict

2017-11-03 Thread Grant Edwards
can have accidental coupling. With multiprocessing, code you have to explicitly work to create coupling. That said, I do a lot of threading coding (in both Python and C), and have never found it particularly tricky. It does require that you understand what you're doing and probably doesn&

Re: Easiest way to access C module in Python

2017-11-06 Thread Grant Edwards
home I looking for the approach with the least learning curve. When I want to test C modules (usually destined for an embedded system) using a Python framework, I use ctypes. https://docs.python.org/3/library/ctypes.html -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Ideas about how software should behave

2017-11-07 Thread Grant Edwards
fset = ctypes.sizeof(ctypes.c_size_t) + >ctypes.sizeof(ctypes.c_voidp) >|>>> ob_ival = ctypes.c_int.from_address(id(value)+ob_ival_offset) >|>>> ob_ival.value = 3 >|>>> >|>>> print 2 >|3 I vaguely remember being able to do that in some implementa

Re: Ideas about how software should behave

2017-11-07 Thread Grant Edwards
gt; guarantees are out the window. In FORTRAN, the only language gurantees were 1) When running your program, you'd almost, but not always, get all of your cards back. 2) The probability (P) of finding an available IBM 29 cardpunch was approximately D**2 where D is how many day's

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