Re: python and ARM memory types

2015-10-06 Thread Jorgen Grahn
oprofile and perf(1), and I guess the Python interpreter would introduce some noise there. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: Lightwight socket IO wrapper

2015-09-22 Thread Jorgen Grahn
re data has arrived So the buffer is a circular buffer of octets, which you chop up by parsing it so you can see it as a circular buffer of complete and incomplete entries or messages. At that level, yes, the line-oriented data and the binary data would coexist in the same application buffer. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: Lightwight socket IO wrapper

2015-09-22 Thread Jorgen Grahn
me, with certain UDP-based protocols which cannot pack multiple application-level messages into one datagram. Although perhaps you tend not to use Python in those situations. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: Lightwight socket IO wrapper

2015-09-21 Thread Jorgen Grahn
o the circular buffer might fill with > undeliverable headers) Those messages should be delivered to the receiving socket, in the sense that they are sanity-checked, used to wake up the application and mark the socket readable, fill up one entry in the read queue and so on ... Of course your system at work may have the rights to be more restrictive, if it's special-purpose. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: Socket programming

2015-01-04 Thread Jorgen Grahn
it should stop looking for more data and start /acting/ on it. And yes, you can't do much with a TCP soocket without setting up these rules. It's important to see that noone does it /for/ you. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-10 Thread Jorgen Grahn
ng the latter. Designing a limited /data/ language is often a good idea; designing something which eventually will need to become Turing-complete is not. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: New user's initial thoughts / criticisms of Python

2013-11-10 Thread Jorgen Grahn
s take a subexpression out and give it a new > name: And it's not just Python: programming languages have been designed that way since at least the 1960s. People are used to analysing expressions inside and out according to rules common for almost all languages. /Jorgen -- // Jorgen GrahnO o . -- https://mail.python.org/mailman/listinfo/python-list

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-19 Thread Jorgen Grahn
trivial though, so try to do without such things at first. It's not obvious that you should need an account for an experimental chat, anyway. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Jorgen Grahn
ter as a "blackbox" then there really isn't anything you > can do here except catch the exception and attempt to reconnect. Yes. Note that there *may* be some uncertainty re: "did the printer process the last request before the reset or not?" E.g. I wouldn't endlessly retry printing a 100-page document in that case. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Jorgen Grahn
t medium like Usenet. > (Note - unfiltered pcap files can be very large > on a busy network, but if you can quiet other traffic, you may not need > to filter at all.) Or simply filter. It's not hard -- the capture filter "host my-printer-hostname-or-address" is enough. /Jorg

Re: Diacretical incensitive search

2013-05-20 Thread Jorgen Grahn
elled "far" and still be understood. This is IMHO out of the scope of re, and perhaps case-insensitivity should have been too. Perhaps it /would/ have been, if regular expressions hadn't come from the ASCII world where these things are easy. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: please help me to debud my local chat network program

2012-11-28 Thread Jorgen Grahn
Or a Git repository at github.com or similar. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Imaging libraries in active development?

2012-11-28 Thread Jorgen Grahn
x times faster, because it uses libjpeg-turbo. Only some Linux > distributions have replaced libjpeg with the turbo implementation. That seems like an argument for *not* having support for many file formats in the imaging library itself -- just pipeline into the best standalone utilities available.

Re: Preventing crap email from google?

2012-10-20 Thread Jorgen Grahn
istory of creating broken Usenet postings in new and exciting ways. It's at least as bad as MS Outlook Express and AOL were in Usenet's past. Your own posting (or mail) is almost flawless: correct quoting, and a properly formatted response. But you seem to be using gmail and the mailing list

Re: Experimental Python-based shell

2012-10-03 Thread Jorgen Grahn
erms of > usability and searching above pinpointing files in heirarchies. > > I invite you to try it. Hard to do without a manual page, or any documentation at all except for a tiny "hello world"-style example ... /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: simple client data base

2012-09-08 Thread Jorgen Grahn
al circumstances) but it might equally well have ended with resentment. "Why did he sell this crap idea to me? Now I'm stuck with it." /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: strptime format string nasty default

2012-05-09 Thread Jorgen Grahn
this one looks quite odd and isn't very human-readable. If you have to use this format, I strongly recommend parsing it "manually" as text first. Then you can create an ISO date and feed that to strptime, or perhaps use your parsed (day, month, year) tuple directly. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast file data retrieval?

2012-03-13 Thread Jorgen Grahn
uld take ~3MB of memory. The time to move this from disk to a Python list of 9-tuples of strings would be almost only disk I/O. I think he should try to do it the dumb way first: read everything into memory once. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Compile 32bit C-lib on 64 bit

2011-05-02 Thread Jorgen Grahn
to, and the suppliers cannot even be bothered to compile it for the CPU architecture that has been standard for at least 6--7 years, start planning to replace it *now*. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

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

2011-05-02 Thread Jorgen Grahn
on. It's not part of the definition of C either -- C supports segmented memory (pre-386 Intel) and separate code/data address spaces. (Even if most C users tend not to think of it that way.) /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-17 Thread Jorgen Grahn
whatever at the gyms to help you use the equipment there safely and efficiently, there should be text editor instructors!) /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-16 Thread Jorgen Grahn
.. > emacs having the opposite problem, missing tabs (also, > selecting text with my mouse is something I do often). Does it *have* to be tabs? Why? Both Emacs and Vim can have multiple files open, and have various powerful ways to navigate between them. If you cannot stand non-tabbed

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Jorgen Grahn
ant those (vt200) had some exotic graphics mode. The VT-xxx series was pretty heterogenous, although most of us think of them as more or less fancy VT-100s. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: ImSim: Image Similarity

2011-03-05 Thread Jorgen Grahn
kes care of JPEG quality, scaling and possibly gamma correction, but not cropping or rotation. I'm sure there are better, well-known algorithms. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating Long Lists

2011-02-23 Thread Jorgen Grahn
them for that. If that's the *only* such use, I'd experiment with writing them as sortable text to file, and run GNU sort (the Unix utility) on the file. It seems to have a clever file-backed sort algorithm. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use Python well?

2011-02-19 Thread Jorgen Grahn
look similar in reality, but there are some pretty decent conventions which most follow). /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use Python well?

2011-02-18 Thread Jorgen Grahn
On Thu, 2011-02-17, Roy Smith wrote: > In article , > Jorgen Grahn wrote: > >> - Write user documentation and build/installation scripts. Since I'm >> on Unix, that means man pages and a Makefile. > > Wow, I haven't built a man page in eons. These days, us

Re: Archiving Modules

2011-02-18 Thread Jorgen Grahn
On Fri, 2011-02-18, Alexander Kapps wrote: > On 18.02.2011 19:51, Westley Martínez wrote: >> On Fri, 2011-02-18 at 04:55 -0800, peter wrote: >>> On Feb 17, 9:55 pm, Jorgen Grahn wrote: >>> >>> >>>> RAR is a proprietary format, which complicates th

Re: Archiving Modules

2011-02-17 Thread Jorgen Grahn
ftware which handles it. If Python included such a module, they'd be forced to remove it from their version. I wouldn't encourage its use by writing /more/ software which handles it. IMHO, archives should be widely readable forever, and to be that they need to be in a widely used, op

Re: How to use Python well?

2011-02-17 Thread Jorgen Grahn
case. No need to do anything more fancy if it turns out I'll never have to touch that program again. I use classes when I see a use for them. The "see" part comes from quite a few years' worth of experience with object-oriented design in Python and C++ ... not sure how to lea

Re: Fully functioning email client in Python

2011-02-06 Thread Jorgen Grahn
ed the text and the recipient address into /usr/lib/sendmail. If you build the interface on POP3 and SMTP, you have to bypass the system's builtin mail capabilities. If on the other hand it's on Windows, there's certainly some very different scheme you have to follow (or bypass). /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl Hacker, Python Initiate

2011-02-03 Thread Jorgen Grahn
l with this in Python too: I really suggest letting the user's $PATH decide which dig to call. /usr/bin is always in the path. /usr/sbin may not be, but if that's a problem for your users, just let your script start by appending it to the pre-existing $PATH. You don't even

Re: Digitally Signing a XML Document (using SHA1+RSA or SHA1+DSA)

2010-12-30 Thread Jorgen Grahn
get a binary signed file. If you really *do* have a requirement to make the result XML-like and incompatible with anything else, I'm afraid you're on your own, and will have a lot of extra work testing and making sure it's all secure. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-27 Thread Jorgen Grahn
On Tue, 2010-10-26, Carl Banks wrote: > On Oct 25, 11:20 pm, Jorgen Grahn wrote: >> On Mon, 2010-10-25, bruno.desthuilli...@gmail.com wrote: >> > On 25 oct, 15:34, Alex Willmer wrote: >> >> On Oct 25, 11:07 am, kj wrote: >> >> >> > In "Th

Re: Why "flat is better than nested"?

2010-10-25 Thread Jorgen Grahn
han a depth of 5+ and only >> a few top level items. >> > (snip) > > This also applies to inheritance hierarchies (which tend to be rather > flat in Python compared to most mainstreams OOPLs), as well as nested > classes etc. Which mainstream languages are you thinking of?

Re: how to handle network failures

2010-10-10 Thread Jorgen Grahn
o risk *not* getting told and hanging forever, or anyway for far longer than your application is likely to want to wait. For example if the peer host is suddenly disconnected from the network -- TCP will keep trying, in case a connection suddenly reappears much later. Try provoking that sit

Re: meta-class review

2010-10-06 Thread Jorgen Grahn
a), then just build them on-the-fly when you're printing: f.write('%s: %s\n' % (name, MyFormatted(value))) Class MyFormatted here is very much like dash_zero above; it has no methods except __init__ and __str__. I mostly do this in C++; perhaps it makes more sense in a language with static typing, overloading and templates. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: The trouble with "dynamic attributes".

2010-09-18 Thread Jorgen Grahn
ot;. I don't get it... > > You are subscribed to the python mailing list. > > Check your subscription status with the link below. JN's posting was technically a reply to JM's SL question -- a References: header led back to it. That's why he was confused. /Jorgen --

Re: socket.error: [Errno 98] Address already in use

2010-09-18 Thread Jorgen Grahn
He also noted in his book: "This scenario is one of the most frequently asked questions on Usenet." Possibly I missed something in the question, but it's worth googling for. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning inheritance

2010-09-18 Thread Jorgen Grahn
uot;Return the environment's $HTTP_HOST if it exists, otherwise $SERVER_NAME or (if that doesn't exist either) None. """ ... Perhaps you are focusing too much on inheritance in general. I personally almost never use it in Python -- it has much fewer uses h

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-07-01 Thread Jorgen Grahn
On Wed, 2010-06-30, Michael Torrie wrote: > On 06/30/2010 03:00 AM, Jorgen Grahn wrote: >> On Wed, 2010-06-30, Michael Torrie wrote: >>> On 06/29/2010 10:17 PM, Michael Torrie wrote: >>>> On 06/29/2010 10:05 PM, Michael Torrie wrote: >>>>> #include

Re: Why are String Formatted Queries Considered So Magical?

2010-07-01 Thread Jorgen Grahn
On Wed, 2010-06-30, Steven D'Aprano wrote: > On Wed, 30 Jun 2010 14:14:38 +, Jorgen Grahn wrote: > >> On Tue, 2010-06-29, Stephen Hansen wrote: >>> On 6/29/10 5:41 AM, Roy Smith wrote: >>>> Nobody wrote: >>>> >>>>>> And

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Jorgen Grahn
u start a new list, push the corresponding closing tag onto > a stack. Whenever your "indent level" decreases, pop the stack and > write out the closing tag you get. > > It's straightforward to use a python list as a stack. Or even simpler. You keep track of your current indentation level (0, 1, ...). If level==1 and you come to an indent: 2, you generate an and increase level to 2. Similarly for going left. When you reach the end you add s to go back up to level 1 (or maybe you want to call it level 0 instead). That probably assumes you use HTML (like you say) rather than XHTML (which your example hints at). In HTML you don't need to supply the s. I did all this in Perl earlier today, but in my case it was unsuitable because I skipped levels (had a list of HTML headings, wanted a table-of-contents, but sometimes a was followed by with no inbetween. I'd get invalid stuff like . /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Jorgen Grahn
, re is a tool -- and a useful one at that. But its also a tool which > /seems/ like an omnitool capable of tackling everything. That's more like my attitude towards them. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Ancient C string conventions (was Re: Why Is Escaping Data Considered So Magical?)

2010-06-30 Thread Jorgen Grahn
x27;m sure plenty of people have done what Gregory suggests ... but it's not clear that strncpy() was designed to support those people. I suppose it's all lost in history. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Jorgen Grahn
27;t make > a different. The code still crashes because the &buf is incorrect. I haven't tried to understand the rest ... but never write 'sizeof(char)' unless you might change the type later. 'sizeof(char)' is by definition 1 -- even on odd-ball architectures where a char is e.g. 16 bits. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread Jorgen Grahn
he distinction Bourne shell/bash. If you can get away with it, use bash for medium/large-sized scripts. Many people try to avoid bash-specific syntax, but they miss out on lots of things that make programs maintainable, like local variables. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a scripting language. Alternative to bash script?

2010-06-29 Thread Jorgen Grahn
urn was > an "int" or a "float". But that got fixed. Huh? The C we have today cannot return a float, and not even a full int. 0 and 1 work, small integers up to 255 are likely to work, but beyond that common systems (Unix) will chop off the high bits. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Jorgen Grahn
On Mon, 2010-06-28, Kushal Kumaran wrote: > On Mon, Jun 28, 2010 at 2:00 AM, Jorgen Grahn > wrote: >> On Sun, 2010-06-27, Lawrence D'Oliveiro wrote: >>> In message , Roy Smith wrote: >>> >>>> I recently fixed a bug in some production code.  The p

Re: Why Is Escaping Data Considered So Magical?

2010-06-27 Thread Jorgen Grahn
) in C can *never* safely be the only thing you do to the buffer: you also have to NUL-terminate it manually in some corner cases. See the documentation. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Is Escaping Data Considered So Magical?

2010-06-27 Thread Jorgen Grahn
On Fri, 2010-06-25, Nobody wrote: > On Fri, 25 Jun 2010 12:15:08 +0000, Jorgen Grahn wrote: > >> I don't do SQL and I don't even understand the terminology properly >> ... but the discussion around it bothers me. >> >> Do those people really do thi

Re: Why Is Escaping Data Considered So Magical?

2010-06-27 Thread Jorgen Grahn
On Sat, 2010-06-26, Lawrence D'Oliveiro wrote: > In message , Jorgen Grahn > wrote: > >> I thought it was well-known that the solution is *not* to try to >> sanitize the input -- it's to switch to an interface which doesn't >> involve generating an inter

Re: Pythonic Idiom For Searching An Include Path

2010-06-25 Thread Jorgen Grahn
er "recursive make considered harmful". It took compiler writers decades to realize what the best choice was there. (By the way, -I commonly means "search this directory for include files" rather than "include this file". You may want to avoid confusing people by choosing another letter, like -i.) /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Is Escaping Data Considered So Magical?

2010-06-25 Thread Jorgen Grahn
uld be something like os.popen2(['zcat', '-f', '--', untrusted]). Am I missing something? If not, I can go back to sleep -- and keep avoiding SQL and web programming like the plague until that community has entered the 21st century. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Python + vim + spaces vs tab

2010-06-09 Thread Jorgen Grahn
m. But as he wrote, that is not an option. And I can believe that -- if you are many programmers, working in parallel on some fairly big and mature project, the *last* thing you want is someone coming in and reindenting everything. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax problem - cannot solve it by myself

2010-06-09 Thread Jorgen Grahn
.python. I am still perfectly happy with Python 2.4 and 2.5. These are the versions which are installed by default in modern, recent Linux distributions. I bet it will be years before Python 3 replaces them. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe and pydocs. Downloads?

2010-01-21 Thread Jorgen Grahn
/bugs.python.org so it doesn't get forgotten. >> > > Done And for reference, it's <http://bugs.python.org/issue7749>, "pydoc error". /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended "new" way for config files

2010-01-08 Thread Jorgen Grahn
;t use .ini-style, but that's because I'm a Unix guy and they remind me of brief and painful experiments with Windows 3.1. Just remember to include support for commented-out lines. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Scripting (was Re: Python books, literature etc)

2010-01-08 Thread Jorgen Grahn
l put off when people call it "scripting"? I won't attempt a strict definition of the term "scripting language", but it seems like non-programmers use it to mean "less scary than what you might think of as programming", while programmers interpret it as "not useful as

Re: Do I have to use threads?

2010-01-08 Thread Jorgen Grahn
ocesses. There > is another possibility which is much more light-weight: asynchronous > I/O, available through the low level select module, or more usefully > via the higher-level asyncore module. Yeah, that would be my first choice too for a problem which isn't clearly CPU-bound. Or my second choice -- the first would be calling on a utility like wget(1). /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a script from another script and other script does not do busy wait.

2010-01-08 Thread Jorgen Grahn
On Thu, 2010-01-07, danmcle...@yahoo.com wrote: > On Jan 7, 9:18 am, Jorgen Grahn wrote: >> On Thu, 2010-01-07, Rajat wrote: >> > I want to run a python script( aka script2) from another python script >> > (aka script1). While script1 executes script2 it waits for scri

Re: Python books, literature etc

2010-01-07 Thread Jorgen Grahn
hell"?) on Python 2.2 and a bit of 2.3, plus the official documentation, plus this group, is all I think I need. But I had a lot of Unix, C, C++ and Perl experience to help me. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Do I have to use threads?

2010-01-07 Thread Jorgen Grahn
" makes me want to ask "Why?". If he's expecting *many* pictures, I doubt that the parallel download will buy him much. Reusing the same TCP socket for all of them is more likely to help, especially if the pictures aren't tiny. One long-lived TCP connection is much more efficient than dozens of short-lived ones. Personally, I'd popen() wget and let it do the job for me. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a script from another script and other script does not do busy wait.

2010-01-07 Thread Jorgen Grahn
> Please suggest how should I go about implementing it. > > I'm currently executing it as: > > import main from script2 > ret_code = main() > return ret_code > > which surely is not going to achieve me what I intend. > > > Thanks, > Rajat. /Jorgen --

Re: search python wifi module

2009-10-23 Thread Jorgen Grahn
en needed. What are you trying to do? /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to schedule system calls with Python

2009-10-23 Thread Jorgen Grahn
On Thu, 2009-10-22, Al Fansome wrote: > > > Jorgen Grahn wrote: >> On Fri, 2009-10-16, Jeremy wrote: >>> On Oct 15, 6:32 pm, MRAB wrote: >>>> TerryP wrote: >>>>> On Oct 15, 7:42 pm, Jeremy wrote: >>>>>> I need to write a

Re: Text file to XML representation

2009-10-22 Thread Jorgen Grahn
lf what the input format (language) is, (b) write a parser for it (which transform it to Python data structures and (c) write code to dump the data structures according to some DTD (or whatever the XML people call it these days). (c) seems to be the easy part. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: How to schedule system calls with Python

2009-10-21 Thread Jorgen Grahn
s sitting just waiting for one process each to die -- those threads contribute nothing to the multiprocessing you want. In Unix, you can have one process fork() and exec() as many programs as you like, have them run on whatever CPUs you have, and wait for them to die and reap them using wait() and rela

Re: How to schedule system calls with Python

2009-10-21 Thread Jorgen Grahn
popen() fits nicely into that category -- you have to eat the child's output or feed it with input, or it will eventually stall. > Python being made with much loving kindless, exposes each interface. Nicely put! /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-21 Thread Jorgen Grahn
C++ users often means "costs more than a semi-decent alternative". For example, Stroustrup claimed back in 1994 that the non-catching case can be implemented at no speed cost or no memory usage cost (Design and Evolution of C++, 1994, p397). /Jorgen -- // Jorgen GrahnO o .

Re: ANN: Testoob 1.15 released

2009-10-21 Thread Jorgen Grahn
On Mon, 2009-10-19, oripel wrote: > On Oct 14, 5:59 pm, Jorgen Grahn wrote: >> But this sentence on the home page >> >>     The documentation is sadly outdated, but may be >>     a starting point: >> >> made me stop looking.  As far as I can tell, you can

Re: how to handle broken pipes

2009-10-14 Thread Jorgen Grahn
yboardInterrupt exception thrown in his face where other languages would have exited silently by default. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
" is unfair. C++ is very different from Python, and has a different implementation of exceptions. You also tend to use the language to solve a different set of problems. That said, I still don't fully understand the rationale behind that advice or rule ... so I'm willing to break it, and sometimes I do. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
op tends to *not* have a boolean variable as the while ... expression. That smells like flag programming, and if I cannot come up with anything better that that, I often prefer a "while 1" with breaks in it. For a real-life loop, see for example http://en.wikipedia.org/wiki/Binary_search#

Re: The rap against "while True:" loops

2009-10-14 Thread Jorgen Grahn
nto > that block of code. Why not? To me, it obviously does. It would also help if you didn't use intentionally meaningless and annoying variable names in your examples. In reality you would have a meaningful expression like "not inputqueue.empty()" or "time() < deadline" or something. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there any modules for IRC, that work with Python 3.1?

2009-10-14 Thread Jorgen Grahn
ven the number of hackers who use it a lot) there were lots of good IRC clients, but I don't use it myself, so ... /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Testoob 1.15 released

2009-10-14 Thread Jorgen Grahn
a starting point: made me stop looking. As far as I can tell, you cannot even find out what's so advanced about it (or why "advanced" is a good thing) without starting to use it. A brief comparison with module unittest (which I am rather unhappy with) would have been nice, too

Re: python performance on Solaris

2009-10-14 Thread Jorgen Grahn
of virtualization thing, with low CPU overhead.) s/multi-threading/multi-programming/ I suppose. I certainly hope you can still get performance while running many separate true processes in parallel. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: cpython compilation parameter

2009-10-14 Thread Jorgen Grahn
d start by compiling it exactly like Ubuntu does. Just get the Ubuntu source packet -- it's all in there, Ubuntu doesn't keep it a secret. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: "Error en el bus" from python

2009-10-12 Thread Jorgen Grahn
ghly to "segmentation fault", but IIRC it is more about accessing memory words on nonaligned adresses than about accessing addresses your process doesn't own. [...] /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Daemon call python program

2009-10-12 Thread Jorgen Grahn
ompletely on the design of your daemon, and why it calls another program. And what it does while that other program is running. inetd/xinetd on Unix is one example, but they feed the program's output (all of it, both standard output and standard error, IIRC) to the remote client. Same with CGI

Re: start external program from python

2009-10-12 Thread Jorgen Grahn
clipboard? If you think you need it because you don't want a temporary file, maybe you can let AppMain read from standard input, and let the Python program write the data using os.popen or one of the alternatives. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: best vi / emacs python features

2009-10-12 Thread Jorgen Grahn
cs term, but it exists in Vim too). Also some other vital features which aren't specific to Python. The best help an editor can give is language- independent. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying a row in a textfile

2009-09-12 Thread Jorgen Grahn
here from each rows. > > for line in inf.readlines(): > if matches_criteria(line): >line = modify_line(line) > outf.write(line) In other words, no. You need to put the results in another file. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Distutils - can user designate install directory for windows installer?

2009-09-12 Thread Jorgen Grahn
don't know how that works. I *do* know that you can do "setup.py install --prefix somewhere" but the guy who does that needs to have the actual source code, not a windows installer. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a local variable scope.

2009-09-12 Thread Jorgen Grahn
hat kind of subtle improvements, I am also willing to restructure my code so the natural scopes become short enough. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: ubuntu dist-packages

2009-08-26 Thread Jorgen Grahn
On Wed, 26 Aug 2009 17:20:35 +0100, Robin Becker wrote: > Jorgen Grahn wrote: >> On Wed, 26 Aug 2009 12:46:13 +0200, Diez B. Roggisch > >> Well, if you are thinking about Debian Linux, it's not as much >> "ripping out" as "splitting into a

Re: ubuntu dist-packages

2009-08-26 Thread Jorgen Grahn
veloper-only > thing", Well, if you are thinking about Debian Linux, it's not as much "ripping out" as "splitting into a separate package with a non-obvious name". Annoying at times, but hardly an atrocity. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: Code formatting question: conditional expression

2009-08-26 Thread Jorgen Grahn
service provider. If you don't want that > happening, it's probably best to avoid Google Mail. But this is Usenet (or at least it gets gatewayed there) and there are such limits here (either by common agreement or by RFC). Probably not Google's fault. /Jorgen -- // Jorgen GrahnO o . -- http://mail.python.org/mailman/listinfo/python-list

Re: python and getopt and spaces in option

2009-06-10 Thread Jorgen Grahn
You are probably calling the program incorrectly. A non-broken getopt has no trouble with such things. When executing a program from a normal Unix shell, single or double quotes (like you do above) is enough. I'd expect other environments to behave in the same way. If -q only eats the string "SQL", where does "1 TABLE" go? It cannot just disappear; does it end up in 'args'? /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using logging module to log into flash drive

2009-06-10 Thread Jorgen Grahn
try_to_switch_to_file() do_the_actual_logging(something) unless it's vital that as many of these logs as possible survive a crash (in which case I guess the program would also refuse to exit until the user finds the physical flash memory device somewhere and mounts it correctly -- fl

Re: xml application advice

2009-06-10 Thread Jorgen Grahn
orithms to find out important stuff about such a data structure. You do not need (a) before you can do (b). You can even have Python as your input format, and eval() the file. Crude and insecure, but it works, at almost zero cost. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: Career Track: Computer Programmer

2009-06-10 Thread Jorgen Grahn
ns that the computer can actually follow. That's not a programmer, that's a compiler. Or (to at least *pretend* to be on topic) that's the Python interpreter. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: strip char from list of strings

2009-05-19 Thread Jorgen Grahn
he string. Strings are immutable. So the best way is probably to make sure the '\n's do not end up in the list in the first place. I suspect that is often more elegant too. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: Which C compiler?

2009-05-19 Thread Jorgen Grahn
7;s maintainers. I don't know if that's the reason, but my applications rarely or never break. So I'm not quite sure what happened in your case ... /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: stuck with PyOBEX

2009-04-29 Thread Jorgen Grahn
ou can't simply pass it in. > > Unix uses streams as abstraction for a lot of things - all kinds of devices > for example. You mean "uses the BSD Socket API as an abstraction" here. That's the framework where "AF_BLUETOOTH" apparently lives. /Jorgen

Re: Third Party Modules

2009-04-29 Thread Jorgen Grahn
m not going to put Python software out for public use again. I don't > have the time to deal with this crap. And which other language would have made it easier? Once you have odd third-party dependencies, you (or your users, rather) will have problems. /orgen -- // Jorgen Grahn

Re: CSV performance

2009-04-29 Thread Jorgen Grahn
o prefer text files tend to underestimate the usefullness of databases.) /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: A design problem I met again and again.

2009-04-02 Thread Jorgen Grahn
w from the data. To me, if I can find something with a certain lifetime, a certain set of invariants, and a suitable name and catchphrase describing it, then that's probably a class. Then I keep my fingers crossed and hope it works out reasonably well. If it doesn't, I try another approach. /Jorgen -- // Jorgen Grahn R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list

Re: how to handle/generate pcap file

2009-04-02 Thread Jorgen Grahn
ildebeeste Herder to the Masses > > > Yap, I found that dpkt can do this, Thanks all. I have used the 'pcapy' module successfully for this. Might be better than the ones mentioned above, might be worse. Also, the pcap file format isn't really hard: you can write such code

  1   2   3   4   >