.
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
: 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
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
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
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
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
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
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
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?
>>>
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
# 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
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
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 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
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
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
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
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,
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
-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
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.
>>
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
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
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
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!
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
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
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
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
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
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
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
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
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.
>> >
>>>> 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
. (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
> 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
"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
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
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
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
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
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
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
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
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
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
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
'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
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
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
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
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
--
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
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
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
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
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-
. 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
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
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/
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
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
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
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
>
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
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
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
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
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
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
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
#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
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
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
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
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
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
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
# 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
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
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
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
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
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:
>>
>> -
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
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
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.
>
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
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
; 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
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
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
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
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
>>
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
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
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
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
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
>&
201 - 300 of 4400 matches
Mail list logo