Authentication

2005-04-19 Thread cameron
I am new to Python so please excuse my ignorance. Are there a nice set of libraries/modules that abstract authentication in a platform independent manner? I am working on an application that would like to be able to hook into the native authentication mechanisms on Linux and OpenBSD. I would lik

accumulator generators

2008-05-30 Thread Cameron
I was reading this http://www.paulgraham.com/icad.html";>Paul Graham article and he builds an accumuator generator function in the appendix. His looks like this: def foo(n): s = [n] def bar(i): s[0] += i return s[0] return bar Why does that work, but not this: def foo(n): s =

Re: accumulator generators

2008-05-30 Thread Cameron
On May 30, 1:04 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Cameron schrieb: > > > > > I was reading this http://www.paulgraham.com/icad.html";>Paul > > Graham article and he builds an accumuator generator function in > > the appendi

Re: Style question -- plural of class name?

2013-05-08 Thread Cameron Simpson
| > "A list of FooEntry instances" | | This is also acceptable, although a little wordy. Do you write "a list of | strings" or "a list of str instances"? How about "a FooEntry list"? -- Cameron Simpson Yes Officer, yes Officer, I will Officer. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
thod of making a lockfile even today if you expect to work over NFS, where not that many things are synchronous. You open a file with "0" modes, so that it is _immediately_ not writable. Other attempts to make the lock file thus fail because of the lack of write, even over NFS. Cheers, --

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 09May2013 11:30, Steven D'Aprano wrote: | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: | | > On 09May2013 19:54, Greg Ewing wrote: | > | Steven D'Aprano wrote: | > | > There is no sensible use-case for creating a file WITHOUT OPENING | > | >

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 10May2013 10:56, Greg Ewing wrote: | Cameron Simpson wrote: | >You open a file with "0" modes, so | >that it is _immediately_ not writable. Other attempts to make the | >lock file thus fail because of the lack of write, | | I don't think that's quite right. You

Re: object.enable() anti-pattern

2013-05-10 Thread Cameron Simpson
descriptor. (Yes, the in-program number is just a number either way.) The descriptor table is an in-kernel data structure, filled with file descriptors. All you have is a label that may or may not access a file descriptor. Anyway, we all know _what_ goes on. We're just having terminology issue

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Cameron Simpson
> does not really. Cheers, -- Cameron Simpson -- http://mail.python.org/mailman/listinfo/python-list

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Cameron Simpson
On 13May2013 21:41, Dave Angel wrote: | On 05/13/2013 07:30 PM, Cameron Simpson wrote: | >On 13May2013 19:22, Dave Angel wrote: | >| On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >| >I much prefer the alternative <> for != but some silly people insisted | >| >that this

mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Cameron Simpson
in place? (That doesn't break math, preferably; I don't do arithmetic with these things but they are, after all, ints...) Cheers, -- Cameron Simpson Why does "philosophy of consciousness/nature of reality" seem to interest you so much? Take away consciousness and reality and there's not much left. - Greg Egan, interview in Eidolon 15 -- http://mail.python.org/mailman/listinfo/python-list

Re: mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Cameron Simpson
On 19May2013 11:11, Chris Angelico wrote: | On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson wrote: | > Before I toss this approach and retreat to my former "object" | > technique, does anyone see a way forward to modify an int subclass | > instance in place? (That

Re: Please help with Threading

2013-05-18 Thread Cameron Simpson
ython code. Plenty of OS system calls (and calls to other libraries from the interpreter) release the GIL during the call. Other python threads can run during that window. And there are other Python implementations other than CPython. Cheers, -- Cameron Simpson Processes are like potatoes.-

Re: How to run a python script twice randomly in a day?

2013-05-19 Thread Cameron Simpson
t midnight, pick two random times. Sleep until the first time, run the script, sleep until the second time, run the script. There are various ways to do the sleeping and midnight bits; they're up to you. Enjoy, -- Cameron Simpson The ZZR-1100 is not the bike for me, but the day they invent &

Re: mutable ints: I think I have painted myself into a corner

2013-05-19 Thread Cameron Simpson
On 19May2013 09:01, Peter Otten <__pete...@web.de> wrote: | Cameron Simpson wrote: | | > TL;DR: I think I want to modify an int value "in place". | > | > Yesterday I was thinking about various "flag set" objects I have | > floating around which are essen

Re: mutable ints: I think I have painted myself into a corner

2013-05-19 Thread Cameron Simpson
On 20May2013 13:23, Greg Ewing wrote: | Cameron Simpson wrote: | >It's an int _subclass_ so that it is no bigger than an int. | | If you use __slots__ to eliminate the overhead of an | instance dict, you'll get an object consisting of a | header plus one reference, which is proba

Re: How to run a python script twice randomly in a day?

2013-05-20 Thread Cameron Simpson
On 20May2013 09:47, Avnesh Shakya wrote: | On Mon, May 20, 2013 at 9:42 AM, Cameron Simpson wrote: | > On 19May2013 20:54, Avnesh Shakya wrote: | > |How to run a python script twice randomly in a day? Actually | > | I want to run my script randomly in a day and twice only. Please |

Re: Please help with Threading

2013-05-20 Thread Cameron Simpson
n to release the GIL, and then to do meaningful work until it needs to return to python land. Most C extensions will do that around non-trivial sections, and anything that may stall in the OS. So your use case for the context manager doesn't fit well. -- Cameron Simpson Gentle suggestions being

Re: Please help with Threading

2013-05-20 Thread Cameron Simpson
ds on what you mean by "fast". It will be slower than code with no lock; how much would require measurement. Cheers, -- Cameron Simpson My own suspicion is that the universe is not only queerer than we suppose, but queerer than we *can* suppose. - J.B.S. Haldane "On

Re: Please help with Threading

2013-05-20 Thread Cameron Simpson
On 20May2013 19:09, Chris Angelico wrote: | On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote: | > _lock = Lock() | > | > def lprint(*a, **kw): | > global _lock | > with _lock: | > print(*a, **kw) | > | > and use lprint() everywhere? | | Fun lit

Re: How to run a python script twice randomly in a day?

2013-05-20 Thread Cameron Simpson
atetime module) the date and time each job should run, and invoke "at" using the subprocess module, piping the text "/home/avin/cronJob/test.sh\n" to it. Cheers, -- Cameron Simpson On a related topic, has anyone looked at doing a clean-room copy of CSS a la RC2 and RC4 a few y

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Cameron Simpson
On 21May2013 17:56, Chris Angelico wrote: | On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | > - randrange() is like other python ranges: it does not include the end value. | > So your call picks a number from 0..58, not 0..59. | > Say randrange(0,60). Think "

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Cameron Simpson
On 21May2013 09:54, Dave Angel wrote: | On 05/21/2013 06:32 AM, Cameron Simpson wrote: | >On 21May2013 17:56, Chris Angelico wrote: | >| On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | >| > - randrange() is like other python ranges: it does not include the end value.

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
with_traceback = This is symptomatic of sys.stdin (well, whatever you're writing to) being open in binary mode instead of text mode. And you're passing a str. Try passing std.encode(). Cheers, -- Cameron Simpson Yes, [congress is] petty and venal and selfish. That's why they're called _representatives_. - Will Durst -- http://mail.python.org/mailman/listinfo/python-list

Re: This mail never gets delivered. Any ideas why?

2013-05-26 Thread Cameron Simpson
| | args = ("'str' does not support the buffer interface",) | | with_traceback = | | This is symptomatic of sys.stdin (well, whatever you're writing to) | being open in binary mode instead of text mode. And you're passing | a str. Try passing std.enc

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Cameron Simpson
script headers: koukos.py | >[Sun May 26 19:07:41 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py | > | >what is that suexec? | | What has this got to do with Python? Little, and I've already explained what suexec is to him some weeks ago, off list

Re: Python error codes and messages location

2013-05-26 Thread Cameron Simpson
t goes bang, handle the errors you expect and understand. If you get something else, go bang for real because you _don't_ know what should happen, and proceeding is probably insane. Cheers, -- Cameron Simpson Motorcycles are like peanuts... who can stop at just one? - Zebee Johnstone aus.moto

Re: Short-circuit Logic

2013-05-26 Thread Cameron Simpson
ble to perform the second test. Example: if s is not None and len(s) > 0: ... do something with the non-empty string `s` ... In this example, None is a sentinel value for "no valid string" and calling "len(s)" would raise an exception because None doesn't have a

Re: Python error codes and messages location

2013-05-26 Thread Cameron Simpson
On 27May2013 04:49, Carlos Nepomuceno wrote: | > From: steve+comp.lang.pyt...@pearwood.info | > On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote: | >> Where can I find all error codes and messages that Python throws (actual | >> codes and messages from exceptions raised by stdlib)? | >

Re: Short-circuit Logic

2013-05-26 Thread Cameron Simpson
On 27May2013 06:59, Vito De Tullio wrote: | Cameron Simpson wrote: | > if s is not None and len(s) > 0: | > ... do something with the non-empty string `s` ... | > | > In this example, None is a sentinel value for "no valid string" and | > calling "len(s)&

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Cameron Simpson
s like badly written English. Cheers, -- Cameron Simpson Helicopters are considerably more expensive [than fixed wing aircraft], which is only right because they don't actually fly, but just beat the air into submission.- Paul Tomblin -- http://mail.python.org/mailman/listinfo/python-list

Re: python b'...' notation

2013-05-29 Thread Cameron Simpson
this what you want? | | >>> ''.join('%02x' % x for x in b'hello world') | '68656c6c6f20776f726c64' Not to forget binascii.hexlify. -- Cameron Simpson Every particle continues in its state of rest or uniform motion in a straight line exce

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-29 Thread Cameron Simpson
And files need a filesystem. But even then pipes are still small fixed length buffers; they don't grow without bound as you might have inferred from the quoted statement. Cheers, -- Cameron Simpson ERROR 155 - You can't do that. - Data General S200 Fortran error code list -- http://mail.python.org/mailman/listinfo/python-list

Re: sendmail smtplib.SMTP('localhost') Where is the email?

2013-05-30 Thread Cameron Simpson
rough the logs to find out where. If the message is in the queue then the "mailq" command will probably give a suggestion as to why. Cheers, -- Cameron Simpson As you can see, unraveling even a small part of 'sendmail' can introduce more complexity than answers.- B

Re: Surprising difference between StringIO.StringIO and io.StringIO

2013-05-30 Thread Cameron Simpson
ch expects strs. On that basis, io.StringIO is a text stream, expecting Unicode objects for transcription. 'str' is, in that context, probably considered as 'bytes' in Python 3. Cheers, -- Cameron Simpson A ship in harbor is safe - but that is not what ships are for. - John A. Shedd -- http://mail.python.org/mailman/listinfo/python-list

Re: usage of os.posix_fadvise

2013-05-30 Thread Cameron Simpson
us that users _must_ go and consult their platform's documentation for specifics on how their platform implents the interface. On UNIX, that means "man 2 blah" or "man 3 blah", depending. Cheers, -- Cameron Simpson I suppose the solution would be to close the composition w

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Cameron Simpson
s not. -- Cameron Simpson Well, it's one louder, isn't it? It's not ten. You see, most blokes are gonna be playing at ten, you're on ten here, all the way up, all the way up, all the way up, you're on ten on your guitar, where can you go from there? Where? Nowhere, exactly.

Re: Is this code correct?

2013-05-31 Thread Cameron Simpson
27;am not that stupid :) | | I intend to ask questions unrelated to Python to a list unrelated to Python but related to my subject, whish is 'suexec', that would mean a linux list. Actually, you need an apache httpd list for suexec. It is part of the web server CGI implementation

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-01 Thread Cameron Simpson
ources/Repositories Probably one of these has Python 3. Or build it from source; it's not hard. -- Cameron Simpson Luge strategy? Lie flat and try not to die. - Carman Boyle, Olympic Luge Gold Medalist -- http://mail.python.org/mailman/listinfo/python-list

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-01 Thread Cameron Simpson
On 01Jun2013 01:30, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | Τη Σάββατο, 1 Ιουνίου 2013 11:21:14 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: | > On 01Jun2013 00:51, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | > | Τη Σάββατο, 1 Ιουνίου 2013 9:18:26 π.μ. UTC+3, ο χρήστης

Re: Errin when executing a cgi script that sets a cookie in the browser

2013-06-05 Thread Cameron Simpson
. Then you'll end the headers there:-) A more robust approach might be to build a dict (or possibly better, list) of headers without newlines and then as a separate act to print them with newlines and add the spacer newline later, before writing the message body. Cheers, -- Cameron Simpson Drill

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-06 Thread Cameron Simpson
ding user filenames, the common policy these days is to use utf-8 throughout. Of course you need to get everything into that regime to start with. -- Cameron Simpson ...but C++ gloggles the cheesewad, thus causing a type conflict. - David Jevans, jev...@apple.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store a variable when a script is executing for next time execution?

2013-06-06 Thread Cameron Simpson
me and it can create file fast.. | | Please give me suggestion for it.. How is it possible? Write it to a file? Read the file next time the script runs? BTW, trying to open zillions of files is slow. But using listdir to read the directory you can see all the names. Pick the next free one (and

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-06 Thread Cameron Simpson
ld do: cp -rpl original-dir test-dir Then test stuff in test-dir. -- Cameron Simpson Too much of a good thing is never enough. - Luba -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-06 Thread Cameron Simpson
is two different thigns right? Yes. Display requires the byte stream to be decoded. Wrong decoding display wrong characters/glyphs. | Ευχη του Ιησου.mp3 | EΟΟΞ�-ΟΞΏΟ-ΞΞ·ΟΞΏΟ | | is the way the filaname is displayed in the terminal depending | on the encoding the terminal uses, correct? But no matt

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Cameron Simpson
Python syntax. Two totally separate languages. -- Cameron Simpson Cynic, n. A blackguard whose faulty vision sees things as they are, not as they ought to be. Ambrose Bierce (1842-1914), U.S. author. The Devil's Dictionary (1881-1906). -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Cameron Simpson
On 07Jun2013 09:56, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | On 7/6/2013 4:01 πμ, Cameron Simpson wrote: | >On 06Jun2013 11:46, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | >| Τη Πέμπτη, 6 Ιουνίου 2013 3:44:52 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: | >|

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Cameron Simpson
pt headers: files.py | --- | i dont know why that if statement errors. Python statements that continue (if, while, try etc) end in a colon, so: if flag == 'greek': Cheers, -- Cameron Simpson Hello, my name is Yog-Sothoth, and I'll be your eldritch ho

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Cameron Simpson
On 07Jun2013 04:53, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | Τη Παρασκευή, 7 Ιουνίου 2013 11:53:04 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: | > | >| errors='replace' mean dont break in case or error? | > | > | >Yes. The result will be correct for correc

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-08 Thread Cameron Simpson
re they stored as hex instead or you just said so to avoid printing 0s and 1s? They're stored as bits at the gate level. But writing hex codes _in_ _text_ is more compact, and more readable for humans. Cheers, -- Cameron Simpson A lot of people don't know the difference between a violin and a viola, so I'll tell you. A viola burns longer. - Victor Borge -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
en your Terminal local settings and the encoding that was chosen for the filenames that you get garbage listings, one way or another. Cheers, -- Cameron Simpson But then, I'm only 50. Things may well get a bit much for me when I reach the gasping heights of senile decrepitude of which old A

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
(since ordinal is > 127 ) | 'a chinese ideogramm' to be utf8 encoded needs 4 byte to be stored ? (since ordinal > 65000 ) | | The amount of bytes needed to store a character solely depends on the character's ordinal value in the Unicode table? Essentially. You can read up

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
byted_filenames to utf-8_byted. | | That's a very good question. It works for me when I test it, so I cannot | explain why it fails for you. If he's lucky the UnicodeEncodeError occurred while trying to print an error message, printing a greek Unicode string in the error with ASCII as the output encoding (default when not a tty IIRC). Cheers, -- Cameron Simpson I generally avoid temptation unless I can't resist it. - Mae West -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-12 Thread Cameron Simpson
head. | | i hav epribted all values of those variables and they are all correct. | i just dont see why ti fails to enter the specific if case. Gah! _Show_ us the values! And _specify_ which part of the if-statement should run. -- Cameron Simpson It's a vague science. - Rory Tate, circle resea

Re: A few questiosn about encoding

2013-06-13 Thread Cameron Simpson
ing first. | | "16474".encode('utf-8') | b'16474' | | That 'b' stand for bytes. Syntactic details. Read this: http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals | How can i view this byte's object representation as h

Re: My son wants me to teach him Python

2013-06-13 Thread Cameron Simpson
crude, he will be forced to encounter the basic tools of coding anyway. Cheers, -- Cameron Simpson This is not my farewell to you. My only wish is to fight as a soldier in the battle of ideas. I shall continue to write under the heading of 'Reflections by comrade Fidel.' It will be j

Re: A few questiosn about encoding

2013-06-14 Thread Cameron Simpson
ike that is textual information. Internally to Python, various types are used: strings, bytes, integers etc. But when you print something, text is output. Cheers, -- Cameron Simpson A long-forgotten loved one will appear soon. Buy the negatives at any price. -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questiosn about encoding

2013-06-14 Thread Cameron Simpson
On 14Jun2013 09:59, Nikos as SuperHost Support wrote: | On 14/6/2013 4:00 πμ, Cameron Simpson wrote: | >On 13Jun2013 17:19, Nikos as SuperHost Support wrote: | >| A code-point and the code-point's ordinal value are associated into | >| a Unicode charset. They have the so call

Re: A few questiosn about encoding

2013-06-14 Thread Cameron Simpson
On 14Jun2013 15:59, Nikos as SuperHost Support wrote: | So, a numeral = a string representation of a number. Is this correct? No, a numeral is an individual digit from the string representation of a number. So: 65 requires two numerals: '6' and '5'. -- Cameron Simpson

Re: A few questiosn about encoding

2013-06-14 Thread Cameron Simpson
On 14Jun2013 16:58, Nikos as SuperHost Support wrote: | On 14/6/2013 1:14 μμ, Cameron Simpson wrote: | >Normally a character in a b'...' item represents the byte value | >matching the character's Unicode ordinal value. | | The only thing that i didn't understood is this

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Cameron Simpson
the first False). But for what you are doing, "and" and "or" are not good operations. Something like: "k" in (name+month+year) or "k" in name or "k" in month or "k" in year is a more direct and accurate way to write what I imagine you're trying to do. Cheers, -- Cameron Simpson No one is completely worthless... they can always serve as a bad example. -- http://mail.python.org/mailman/listinfo/python-list

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Cameron Simpson
than one NAN, right? I was not. Interesting. | If my | calculations are correct, there are 9007199254740992 distinct float NANs | in Python (although there is no direct way of distinguishing them). Wouldn't id() do it? At least in terms of telling them apart? I gather they're not i

Re: Don't feed the troll...

2013-06-14 Thread Cameron Simpson
better mail client until they fix that. Sorry, I could have sworn you said you weren't using a mail client for this... -- Cameron Simpson You've read the book. You've seen the movie. Now eat the cast. - Julian Macassey, describing "Watership Down" -- http://mail.python.org/mailman/listinfo/python-list

Re: My son wants me to teach him Python

2013-06-16 Thread Cameron Simpson
und like they reinvented the wheel. Again, years later:-( Cheers, -- Cameron Simpson Those who do not understand Unix are condemned to reinvent it, poorly. - Henry Spencer @ U of Toronto Zoology, he...@zoo.toronto.edu -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questiosn about encoding

2013-06-17 Thread Cameron Simpson
On 17Jun2013 08:49, Antoon Pardon wrote: | Op 15-06-13 02:28, Cameron Simpson schreef: | > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: | > | So, a numeral = a string representation of a number. Is this correct? | > | > No, a numeral is an individual digit from the string re

Re: Problem with the "for" loop syntax

2013-06-19 Thread Cameron Simpson
stions to aid finding this kind of thing without outside help. Cheers, -- Cameron Simpson Are you experiencing more Windows95 crashes than the norm? How on earth would you _know_? - John Brook reporting about a new virus -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with the "for" loop syntax

2013-06-20 Thread Cameron Simpson
On 20Jun2013 15:33, Oscar Benjamin wrote: | On 20 June 2013 04:11, Cameron Simpson wrote: | > I use vi/vim and it both shows the matching bracket when the cursor | > is on one and also have a keystroke to bounce the curser between | > this bracket and the matching one. | > | > If

Re: Problem with the "for" loop syntax

2013-06-20 Thread Cameron Simpson
On 20Jun2013 13:55, Neil Cerutti wrote: | On 2013-06-20, Joshua Landau wrote: | > On 20 June 2013 04:11, Cameron Simpson wrote: | >> Also, opening-and-not-closing a set of brackets is almost the | >> only way in Python to make this kind of error (syntax at one | >> lin

Re: Python development tools

2013-06-24 Thread Cameron Simpson
1) vi/vim 2) Cpython 3) mercurial 4) local copy of http://www.python.org/doc/ for python 2 and 3 (lets me work offline and snappier to browse) 5) python-list@python.org | 99.9% of the programs I write are command-line tools. 99.9% of the programs I write are command-line tools. Cheers, -- C

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Cameron Simpson
e command lines. I'm beginning to be pleased I'm still using Getopt for that instead of feeling I'm lagging behind the times. Cheers, -- Cameron Simpson If it can't be turned off, it's not a feature. - Karl Heuer -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a pass form cgi => webpy framework

2013-06-27 Thread Cameron Simpson
TML would use a templating system of some kind I imagine; I don't generate HTML very often. Pick a simple framework or templating engine and try it. I have no recommendations to make in this area myself. Cheers, -- Cameron Simpson I'm behind a corporate Exchange Server which se

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Cameron Simpson
fault. | | Libraries should not call sys.exit, or raise SystemExit. Whether to quit | or not is not the library's decision to make, that decision belongs to | the application layer. Yes, the application could always catch | SystemExit, but it shouldn't have to. +1 -- Cameron Simpson

Re: Stupid ways to spell simple code

2013-06-30 Thread Cameron Simpson
turn this into comp.lang.perl? Once I was JAPH... -- Cameron Simpson Yes, sometimes Perl looks like line-noise to the uninitiated, but to the seasoned Perl programmer, it looks like checksummed line-noise with a mission in life.- The Llama Book -- http://mail.python.org/mailman/listinfo/python-list

Re: OSError [Errno 26] ?!?!

2013-07-01 Thread Cameron Simpson
aracters, I'd say they've been double escaped. Let's undo that: [/Users/cameron]fleet*> py3 Python 3.3.2 (default, May 21 2013, 11:50:47) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin Type "help", "copyright", &qu

Re: OSError [Errno 26] ?!?!

2013-07-02 Thread Cameron Simpson
no window where the "live" file is being written to. The live file is the old one, and then later it is the new one. Cheers, -- Cameron Simpson No team manager will tell you this; but they all want to see you come walking back into the pits sometimes, carrying the steering wheel

Re: Python list code of conduct

2013-07-02 Thread Cameron Simpson
sion will end up | with, "Yeah, that's a bug". In either case, it serves as a good initial | filter for whether I should file a bug or not, and the discussion is | often educational. +1 I've certinly been educated that way. -- Cameron Simpson Try not to get sucked into the

Re: Coping with cyclic imports

2013-07-04 Thread Cameron Simpson
l should it be necessary. If they make a new post I have to go digging through archives if I need to do that. Cheers, -- Cameron Simpson -- http://mail.python.org/mailman/listinfo/python-list

Re: Important features for editors

2013-07-04 Thread Cameron Simpson
[ Digressing to tuning remote access. Sorry. - Cameron ] On 04Jul2013 21:50, Roy Smith wrote: | Does Sublime have some sort of remote mode? We've got one guy who loves | it, but needs to work on a remote machine (i.e. in AWS). I got X11 | working for him (he has a Mac desktop), so he ca

Re: Important features for editors

2013-07-05 Thread Cameron Simpson
controls must be control-this and meta/escape-that. For this reason, I often expand EMACS as Escape Meta Alt Control Shift. I'm a vi user. Once I mastered "hit ESC by reflex when you pause typing an insert" I was never confused above which mode I was in. And now my fingers k

Re: How to check for threads being finished?

2013-07-05 Thread Cameron Simpson
reads): | pass This spins. How about: for t in threads: t.join() Blocks instead of polls. Cheers, -- Cameron Simpson Processes are like potatoes.- NCR device driver manual -- http://mail.python.org/mailman/listinfo/python-list

Re: Coping with cyclic imports

2013-07-05 Thread Cameron Simpson
On 05Jul2013 10:36, Oscar Benjamin wrote: | On 5 July 2013 02:24, Cameron Simpson wrote: | > On 04Jul2013 16:03, Oscar Benjamin wrote: | > | Is there some reason you're responding to a post from 5 years ago? | > | > Is there some reason not to, if no newer solutions are avai

Re: Concurrent writes to the same file

2013-07-10 Thread Cameron Simpson
n beta at present for a personal project. It won't suit all use cases; mine is well defined. Cheers, -- Cameron Simpson Is it true, Sen. Bedfellow, that your wife rides with bikers? - Milo Bloom -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-30 Thread Cameron Simpson
he indent(1) command? DESCRIPTION indent is a C program formatter. It reformats the C program in the input_file according to the switches. The switches which can be speci‐ fied are described below. They may appear before or after the file names. Very handy sometimes.

Re: Python script help

2013-07-30 Thread Cameron Simpson
utifulSoup/bs4/download/4.0/ Cheers, -- Cameron Simpson You can be psychotic and still be competent. - John L. Young, American Academy of Psychiatry and the Law on Ted Kaczynski, and probably most internet users -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP8 79 char max

2013-07-30 Thread Cameron Simpson
actually executes, and then try to figure out for yourself whether the line length or the source code will affect that execution. Cheers, -- Cameron Simpson "How do you know I'm Mad?" asked Alice. "You must be," said the Cat, "or you wouldn't have come here.&

Re: 2 + 2 = 5

2012-07-04 Thread Cameron Simpson
nostalgic for old Fortran, which, supposedly, allowed you | to change the values of literals by passing them to a function by | reference and then modifying the value. Yeah, I was thinking that too. Because all parameters were pass-by-reference in early fortran IIRC. You could, for example, set pi

Re: Python Interview Questions

2012-07-09 Thread Cameron Simpson
thon, in this case from someone with a strong (or rigid) Java background who is not adept with Python idioms. It has nothing to do with OOP one way or the other. Surely we've all seen (and doubtless written) clumsy python code; this is an example. Cheers, -- Cameron Simpson A strong convi

Re: Python Interview Questions

2012-07-09 Thread Cameron Simpson
Having seen this: http://www.youtube.com/watch?v=Z8xxgFpK-NM I am now convinced :-) -- Cameron Simpson Hit the button Chewie! - Han Solo -- http://mail.python.org/mailman/listinfo/python-list

Re: I thought I understood how import worked...

2012-08-07 Thread Cameron Simpson
ion with a name? I would argue for the latter. With such a change, the "a module can't be imported twice" would then be true (barring hacking around in sys.modules between imports). Cheers, -- Cameron Simpson As you can see, unraveling even a small part of 'sendmail'

Re: I thought I understood how import worked...

2012-08-08 Thread Cameron Simpson
On 08Aug2012 14:14, Ben Finney wrote: | Cameron Simpson writes: | > All of you are saying "two names for the same module", and variations | > thereof. And that is why the doco confuses. | > | > I would expect less confusion if the above example were described as | > _tw

Re: Sharing code between different projects?

2012-08-14 Thread Cameron Simpson
jectAdir projectA-perforce-checkout utilities-perforce-checkout projectBdir projectB-perforce-checkout utilities-perforce-checkout Personally I become more and more resistent to cut/paste even for small things as soon as multiple people use it; you will n

Re: Flushing buffer on file copy on linux

2012-08-14 Thread Cameron Simpson
ng or utterly mad (eg database) data integrity, they generally aren't:-) Cheers, -- Cameron Simpson English is a living language, but simple illiteracy is no basis for linguistic evolution. - Dwight MacDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Cameron Simpson
't support other than 2.6, you install 2.6. Indeed. And this is a strong reason to keep out of the vendor's /usr filesystem space, also. Cheers, -- Cameron Simpson -- http://mail.python.org/mailman/listinfo/python-list

Re: Make error when installing Python 1.5

2012-08-26 Thread Cameron Simpson
nt, with some macro definition occuring between the first and second occurence. Cheers, -- Cameron Simpson -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 and Sqlite3 - Slow

2012-08-28 Thread Cameron Simpson
uot; over the net, and the server does local-to-the-server file access to obtain the data. So all the "per record" latency is at its end, and very small. Not to mention any cacheing it may do. Of course, if your requirements are very simple you might be better off with a flat text file,

Re: Sending USB commands with Python

2012-08-29 Thread Cameron Simpson
our way? Disclaimer: I'm really not a Windows guy. -- Cameron Simpson There are too many people now for everyone to be entitled to his own opinion. - Dr. Handelman -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending USB commands with Python

2012-08-29 Thread Cameron Simpson
On 30Aug2012 08:29, I wrote: | UTF-16? ISTR that Windows often uses big endian UTF-16 [...] Sorry, little-endian. Anyway... -- Cameron Simpson Ed Campbell's pointers for long trips: 3. Stop and take a break before you really need it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending USB commands with Python

2012-08-30 Thread Cameron Simpson
y to byte values out. You're speaking a binary protocol, not text, so you want a one to one mapping. Better still would be to be using a bytes I/O layer instead of one with a text->byte translation; I do not know if the USB library you're using offers such. So try 'iso8859-1'; at

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-06 Thread Cameron Simpson
d of slapping people down when they haven't reached your private bar. Cheers, -- Cameron Simpson Microsoft: Where do you want to go today? UNIX: Been there, done that! -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-08 Thread Cameron Simpson
instance(synset_list, list) | assert isinstance(lemma_list, list) | assert isinstance(lemma_list[0], str) | | and so on. +1 to all of this, too. Cheers, -- Cameron Simpson Too much of a good thing is never enough. - Luba -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >