Re: Instance of 'dict' has no 'replace' member

2019-02-01 Thread Dan Sommers
On 2/1/19 7:15 AM, sinless...@gmail.com wrote: Hello guys can you help me to solve problem when i compile proram got error like this "Instance of 'dict' has no 'replace' member[no member](67;14)". Python dicts don't have a replace method. It looks like you're trying to replace strings inside

Re: Switch function

2019-02-03 Thread Dan Sommers
On 2/3/19 5:40 PM, Avi Gross wrote: Bottom line, does anyone bother using anything like this? It is actually a bunch of hidden IF statements matched in order but may meet many needs. I sure don't. In the rare case that I might use a switch statement in another language, I just use a series of

Re: Switch function

2019-02-03 Thread Dan Sommers
On 2/3/19 9:03 PM, Avi Gross wrote: > The example I show above could in many cases be done as you describe > but what are you gaining? > > I mean if I subtract the integer representation of a keyboard > alphabetic letter (ASCII for the example) from letter 'a' or 'A' then > A maps to 0 and B maps

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Dan Sommers
On 2/11/19 9:25 AM, Neal Becker wrote: I have code with structure: ``` if cond1: [some code] if cond2: #where cond2 depends on the above [some code] [ more code] else: [ do xxyy ] else: [ do the same xxyy as above ] ``` So what's the best style to handle this? As coded, i

Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread Dan Sommers
On 2/13/19 7:21 AM, ast wrote: Hello >>> float('Nan') == float('Nan') False Why ? Because the IEEE-754 Standard demands it, and people smarter than I worked on the IEEE-754 Standard. is a quick starting point for a deeper dive. -- https://mail.python.org/

Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread Dan Sommers
On 2/13/19 1:53 PM, Grant Edwards wrote: Floating point is sort of the quantum mechanics of computer science. At first glance, it seems sort of weird. But after you work with it a while, it gets even worse. Yep! :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: revisiting the "What am I running on?" question

2019-02-17 Thread Dan Sommers
On 2/17/19 8:46 PM, songbird wrote: simply put. if i'm running on a computer and i don't easily know why kind of computer how can i answer this in a quick way without getting overly complicated that also will cover most of the easy cases? i came up with this: comments? additions? c

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dan Sommers
On 2/27/19 9:37 AM, Dave wrote: I have two Python 3 (3.6) apps that will get the full GUI treatment very soon. I'm in the process of choosing a GUI, and that may be where you/your book can help. Seems this is not a trivial effort (wishing that Python was like VB6 from the 90's). Anyway, here

Re: Not Defined error in basic code

2019-03-14 Thread Dan Sommers
On 3/14/19 9:05 AM, Jack Dangler wrote: Just getting started with tutorials and such, and don't understand this - class weapon:     weaponId     manufacturerName The previous two lines attempt to refer to existing names, but neither name exists.     def printWeaponInfo(self):  

Re: subprocess svn checkout password issue

2019-03-16 Thread Dan Sommers
On 3/16/19 1:50 AM, Martin De Kauwe wrote: On Saturday, 16 March 2019 16:50:23 UTC+11, dieter wrote: Martin De Kauwe writes: > I'm trying to write a script that will make a checkout from a svn repo and build the result for the user. However, when I attempt to interface with the shell it asks

Re: Can my python program send me a text message?

2019-03-19 Thread Dan Sommers
On 3/19/19 2:35 PM, Chris Angelico wrote: On Wed, Mar 20, 2019 at 6:31 AM Steve wrote: I have a program that triggers a reminder timer. When that timer is done, I would like to receive a text message on my phone to tell me that it is time to reset the experiment. Can this be done using Pyt

Re: What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread Dan Sommers
On 3/25/19 2:30 PM, CrazyVideoGamez wrote: I have no idea what "TypeError: unsupported operand type(s) for +: 'function' and 'int'" means It means that you're trying to add an int to a function. > ... and I don't know how to fix it. Help! Don't do that? It's possible that with the correct c

Re: Library for parsing binary structures

2019-03-29 Thread Dan Sommers
On 3/29/19 12:13 PM, Peter J. Holzer wrote: Obviously you need some way to describe the specific binary format you want to parse - in other words, a grammar. The library could then use the grammar to parse the input - either by interpreting it directly, or by generating (Python) code from it. Th

Re: How call method from a method in same class?

2019-04-01 Thread Dan Sommers
On 4/1/19 10:02 PM, Dave wrote: def validScale(self, scaleName): if scaleName.upper == 'F' or 'C' or 'K': return True else: return False def convertTemp(self): """ Converts temperature scale if scales valid.""" if v

Re: Function to determine list max without itertools

2019-04-19 Thread Dan Sommers
On 4/19/19 4:01 AM, Sayth Renshaw wrote: Now, what happens when the code is tested with various (different) sets of test-data? (remember the last question from my previous msg!?) It fails on any list entry that isn't a float or an int, giving a TypeError. What if the *first* entry isn't a

Re: Accumulate , Range and Zeros

2019-07-13 Thread Dan Sommers
On 7/13/19 5:54 AM, Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > > > Given this snippet > > > > from itertools import * > > import operator > > > > > > x = [1, 2, 3] # [0, 1, 2, 3, ..., 10] > > > > y = accumulate(x, operator.mul) > > > > print(list(y)) > > > > why does x = list(range(5))

Re: Proper shebang for python3

2019-07-25 Thread Dan Sommers
On 7/24/19 10:24 PM, Michael Torrie wrote: > ... In more recent times, binaries that are mostly applicable to the > super user go there. I don't see why you would want to merge those. > A normal user rarely has need of much in /sbin. Already /bin has way > too much stuff in it (although I don't

Re: Boolean comparison & PEP8

2019-07-29 Thread Dan Sommers
On 7/29/19 10:02 AM, David Raymond wrote: > I think the other part of the discussion to be had here is: how do you > name your booleans? Yep. > ... To me the name of a boolean variable should be obvious that it's a > boolean ... Well, yeah, maybe. If it's really only a boolean, and its value

Re: if bytes != str:

2019-08-04 Thread Dan Sommers
On 8/4/19 10:56 AM, Hongyi Zhao wrote: Hi, I read and learn the the following code now: https://github.com/shadowsocksr-backup/shadowsocksr-libev/blob/master/src/ ssrlink.py In this script, there are the following two customized functions: -- def to_bytes(s): if bytes != str:

Re: Python help needed

2019-08-08 Thread Dan Sommers
On 8/8/19 12:26 PM, Paolo G. Cantore wrote: > I think the special case treatment could be avoided. > > First: Join all items with ' and ' > Second: Replace all ' and ' with ', ' except the last That works great, until one of the elements of the original list is "spam and eggs": >>> spam = [

Re: String slices

2019-08-09 Thread Dan Sommers
On 8/9/19 10:13 AM, Paul St George wrote: In the code (below) I want a new line like this: Plane rotation X: 0.0 Plane rotation Y: 0.0 Plane rotation Z: 0.0 But not like this: Plane rotation X: 0.0 Plane rotation Y: 0.0 Plane rotation Z: 0.0 Is it possible? (I am using Python 3.5 within Blend

Re: itertools cycle() docs question

2019-08-21 Thread Dan Sommers
On 8/21/19 2:32 PM, Calvin Spealman wrote: The point is to demonstrate the effect, not the specific implementation. Once you've gone through the iterable once, it's falsey, which means that the while loop will end. But if you copy all the elements to a real list, then the while loop is infinit

Re: fileinput module not yielding expected results

2019-09-07 Thread Dan Sommers
On 9/7/19 11:12 AM, Jason Friedman wrote: $ grep "File number" ~/result | sort | uniq File number: 3 I expected that last grep to yield: File number: 1 File number: 2 File number: 3 File number: 4 File number: 5 File number: 6 As per https://docs.python.org/3/library/fileinput.html#fileinput.

Re: Spread a statement over various lines

2019-09-17 Thread Dan Sommers
On 9/17/19 2:59 PM, Manfred Lotz wrote: > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ >.replace('%', '.') \ >.replace('*', '.*') > > return '^' + rfpat + '$' > > As I don't want to have the replace() functions in on

Re: Recursive method in class

2019-09-27 Thread Dan Sommers
On 9/27/19 7:54 AM, ast wrote: Hello Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2) + fib(self, n-1) return self.fib(n

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system f

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 8:40 AM, Barry Scott wrote: > > >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >> On 9/30/19 4:28 AM, Barry Scott wrote: >>>> On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: >>

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 10:33 AM, Barry Scott wrote: On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com <mailto:2qdxy4rzwzuui...@potatochowder.com>> wrote: That's the wording I read.  I inferred that "path-handling operations which don't actually ac

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: In the totality of a Path object that claims to represent paths to files, including the arguably troublesome read_bytes and write_bytes methods, and a rename

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com <mailto:2qdxy4rzwzuui...@potatochowder.com>> wrote: In the totality of a Path object that claims to represent paths to files, It represents string that *should* i

Re: pathlib

2019-10-02 Thread Dan Sommers
On 10/2/19 4:14 AM, DL Neil via Python-list wrote: In the case that sparked this enquiry, and in most others, there is no need for a path that doesn't actually lead somewhere. The paths that are used, identify files, open them, rename them, create directories, etc. The idea of a path that just '

Re: pathlib

2019-10-03 Thread Dan Sommers
On 10/2/19 6:58 PM, DL Neil via Python-list wrote: > On 3/10/19 12:42 AM, Dan Sommers wrote: > Certainly, although some may have quietly given-up talking to a > non-OOP native - and one so 'slow', I am appreciative of all > help-given! I also speak OO as a second lan

Re: low-level csv

2019-11-17 Thread Dan Sommers
On 11/17/19 7:18 AM, Antoon Pardon wrote: This is python 2.6->2.7 and 3.5->3.7 I need to convert a string that is a csv line to a list and vice versa. I thought to find functions doing this in the csv module but that doesn't seem to be the case. I can of course write special classes that would

Re: IOError: cannot open resource

2019-12-07 Thread Dan Sommers
On 12/7/19 9:43 AM, RobH wrote: When I run a python project with an oled display on a rasperry pi zero, it calls for the Minecraftia.ttf font. I have the said file in home/pi/.fonts/ Do you mean /home/pi/.fonts (with a leading slash, an absolute path rather than a relative one)? Dan -- https:/

Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Dan Sommers
On 12/21/19 4:46 PM, Ben Hearn wrote: import difflib print('\n'.join(difflib.ndiff([a], [b]))) - /Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! _PromoMix_.wav ? ^^ + /Users/ma

Re: Grepping words for match in a file

2019-12-28 Thread Dan Sommers
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote: Hi I have some lines in a text file like ADD R1, R2 ADD3 R4, R5, R6 ADD.MOV R1, R2, [0x10] If I grep words with this code for line in fp: if my_word in line: Then if my_word is "ADD", I get 3 matches. However, if I grep word with t

Re: Grepping words for match in a file

2019-12-28 Thread Dan Sommers
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote: Hi I have some lines in a text file like ADD R1, R2 ADD3 R4, R5, R6 ADD.MOV R1, R2, [0x10] If I grep words with this code for line in fp: if my_word in line: Then if my_word is "ADD", I get 3 matches. However, if I grep word with t

Re: Friday Finking: Source code organisation

2019-12-28 Thread Dan Sommers
On 12/28/19 6:52 PM, Greg Ewing wrote: > On 29/12/19 11:49 am, Chris Angelico wrote: >> "Define before use" is a broad principle that I try to follow, even >> when the code itself doesn't mandate this. > But strangely, I tend to do the opposite for methods of a class. I > don't really know why.

Re: Threading

2020-01-24 Thread Dan Sommers
(for whatever definition of job you have) from a queue. Once > the queue is exhausted, the threads terminate cleanly, and then you > can join() each thread to wait for the entire queue to be completed. Or use a thread pool: https://docs.python.org/3/library/concurrent.futures.html D

Re: Suggestions on mechanism or existing code - maintain persistence of file download history

2020-01-29 Thread Dan Sommers
; digits of the hash in the file name, so > http://some.domain.example/some/path/filename.html might get saved > into "a39321604c - filename.html". That way, if you want to know if > it's been downloaded already, you just hash the URL and see if any > file begins with those dig

Re: Was: Dynamic Data type assignment

2020-01-30 Thread Dan Sommers
trings to parser.parse_args instead of letting that function default to the list of command line arguments. ¹ e.g., https://docs.python.org/3/library/argparse.html#parents Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.pyth

Re: Suggestions on mechanism or existing code - maintain persistence of file download history

2020-01-30 Thread Dan Sommers
e words C, Fortran, and Common Lisp crossed out and Python and ACID Database written in crayon. Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: queue versus list

2020-03-20 Thread Dan Sommers
e are proportionally fewer calls to malloc() and free(). The data blocks of consecutive pointers also improve cache locality. ¹ https://github.com/python/cpython/blob/3.8/Modules/_collectionsmodule.c#L19-L78 Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.t

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Dan Sommers
r inch printed page, a desktop 72 or 96 pixel per inch display screen, and a handheld 320 pixel per inch screen would all be optimized separately (through one sort of style sheet mechanism or another). But these days, they spend more time and money on ads and SEO than typesetting. Dan --

Re: python script to give a list of prime no.

2020-04-05 Thread Dan Sommers
On Sun, 05 Apr 2020 19:46:00 +0200 Pieter van Oostrum wrote: > Sathvik Babu Veligatla writes: > > > hi, > > I am new to python, and i am trying to output the prime numbers > > beginning from 3 and i cannot get the required output. It stops > > after giving the output "7" and that's it. > > COD

Re: Floating point problem

2020-04-18 Thread Dan Sommers
le.com/cd/E19957-01/806-3568/ncg_goldberg.html; YMMV. Yes, it's highly technical, but well worth the effort. Or an extended session at the feet of the timbot, which is much harder to come by. Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: What user-defined request error levels are recommended?

2020-04-30 Thread Dan Sommers
's the actual use case? (Also, this isn't really a Python question; it's either a plain HTTP question, or perhaps one specific to your web server.) -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: =+ for strings

2020-05-03 Thread Dan Sommers
;.format(day) > > Why can't I do the shortcut on strings? ITYM: dt += "{:02d}".format(day) Note += rather than =+ (which is parsed as an assignment operator followed by a unary plus operator). -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: why no camelCase in PEP 8?

2020-05-18 Thread Dan Sommers
On Tue, 19 May 2020 09:55:04 +1200 Juergen Brendel wrote: > ... he prefers snake-case. That's not snake_case. That's kebab-case.¹ ¹ https://wiki.c2.com/?KebabCase -- https://mail.python.org/mailman/listinfo/python-list

Re: exiting a while loop

2020-05-22 Thread Dan Sommers
> n += 1 > > print("\n", n, "terms are required.") -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: How to design a class that will listen on stdin?

2020-05-23 Thread Dan Sommers
On Saturday, May 23, 2020, at 07:24 -0400, zljubi...@gmail.com wrote: > I have to talk to outer system by stdin/stdout. > Each line that comes to stdin should be processed and its result returned > back to stdout. Logging should go to stderr. > > How to design a class that will listed to stdin

Re: Silly function call lookup stuff?

2005-09-27 Thread Dan Sommers
gt; Would you apply this optimization to all lookups in outer scopes, or >> just callables? Why? ;-) > Hmmm callables have probably the highest chance of being recalled. def print_the_results( list_of_things_with_results ): for x in list_of_things_with_results: print x.

Re: sorting tuples...

2005-09-27 Thread Dan Sommers
en each item in the dictionary can be just one (who, message) tuple. If the dates are not unique, then you'll have to manage each item of the dictionary as a list of (who, message) tuples. And before you ask: no, dictionaries are *not* sorted; you'll have to sort a separate

Re: Python 3! Finally!

2005-09-30 Thread Dan Sommers
the changes needed to merit a V3 weren't that big after all... Or maybe the python development team is smart enough to write python 3 such that its bzipped tarball has the same size and the same MD5 sum as the python 2.4.2 bzipped tarball ;-) Regards, Dan -- Dan Sommers <http://

Re: os.access with wildcards

2005-10-07 Thread Dan Sommers
quot; Don't put anything there: if glob.glob('2005*'): print 'there is at least one matching file' else: print 'there are no matching files' Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: when and how do you use Self?

2005-11-03 Thread Dan Sommers
s of the class. > Context will make it both clear and obvious which use case is desired. Can I use the 'other' identifier in, e.g., an __add__ method? Please? ;-) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: is parameter an iterable?

2005-11-15 Thread Dan Sommers
3 4 5 6 7 >>> foo("hello") h e l l o Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: is parameter an iterable?

2005-11-15 Thread Dan Sommers
else: > # re-raise the exception > raise But what it do_stuff tries to iterate over a non-sequence? Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: using openurl to log into Yahoo services

2005-11-16 Thread Dan Sommers
ot;challenge" field is created by yahoo's server based on the request that caused the server to serve the login page; perhaps it contains a hash of the user agent that sent the request. When you reply to that challenge at a much later time, or with a different user agent, or with som

Re: Simulating call-by-reference

2005-11-17 Thread Dan Sommers
results['foo'], etc. Or look up the Borg pattern in the ASPN cookbook and you can access the results as results.foo, etc. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulating call-by-reference

2005-11-17 Thread Dan Sommers
On Thu, 17 Nov 2005 12:31:08 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: > Dan Sommers <[EMAIL PROTECTED]> wrote: >... >> Put the results into a dictionary (untested code follows!): [ example code snipped ] >> Now you can access the results as results['f

Re: Precision for equality of two floats?

2005-11-29 Thread Dan Sommers
l be) seemingly endless debates about this on comp.std.c (even without the possibility of NaNs, for similar reasons to the one you cite). I don't know if the Lisp and/or IEEE-754 crowds have worked all of this out. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: advice : how do you iterate with an acc ?

2005-12-02 Thread Dan Sommers
d see what it does (since your code is conceptually very similar to it). OTOH, FWIW, your version is very clean and very readable and fits my brain perfectly. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Equivalent to Text::Autoformat

2005-12-04 Thread Dan Sommers
t; formatters use: most require an empty line to terminate a paragraph. > Paragraphs may also be denoted by bulleting, numbering, or quoting . . > ." Try the formatter module: http://www.python.org/doc/current/lib/module-formatter.html Regards, Dan -- Dan Sommers <http://www.

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-07 Thread Dan Sommers
chance that x might be useful elsewhere, then I should have called it something other than x (or immediately rename it as soon as I start to think about using its contents again). (Okay, now I sound like a curmudgeon, but I'm not. At least I don't think I am. I'm just trying to present an alternate view, one in which the issue of needing more scoping controls isn't an issue.) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Bitching about the documentation...

2005-12-07 Thread Dan Sommers
ver-ambiguous: Women can fish. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI, anydbm.open() and linux file permissions

2005-01-11 Thread Dan Sommers
robably runs as user "nobody" or another special user ID set up specifically for running CGI scripts (rather than your user id). Check your web server's documentation, or render the output of sys.getuid, sys.geteuid, sys.getgid, and sys.getedig. One solution is to op

Re: Octal notation: severe deprecation

2005-01-13 Thread Dan Sommers
ier" like aa is read by the parser as a numeric constant with the decimal value of 170. Obviously, this has to be used with care, but makes reading external data files written in strange bases very easy. > nothing-new-under-the-sun-ly y'rs - steve every-language-

Re: Avoiding deadlocks in concurrent programming

2005-06-22 Thread Dan Sommers
need that many queries. As Paul noted, RDBMSes are well- studied and well-understood; they are also extremely powerful when used to their potential. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Plain text email?

2005-06-27 Thread Dan Sommers
d Yo! ? That depends on the client. IMO, HTML belongs on web pages, not in email. YMMV. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-29 Thread Dan Sommers
ause of the region's cultural isolation, perhaps the locals here do actually speak as they did (and as their ancestors in England did) a few hundred years ago. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading output from a child process non-blockingly

2005-06-29 Thread Dan Sommers
On Wed, 29 Jun 2005 15:45:20 +0200, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Check out.log with "tail" or "less +F". Do you see the data appear in > small chunks? ... You'll need "tail -f", I think. Regards, Dan -- Dan Sommers <http://www.

Re: Programmers Contest: Fit pictures on a page

2005-06-29 Thread Dan Sommers
now. It could also beat his "best guy." Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Help please: How to assign an object name at runtime

2005-06-29 Thread Dan Sommers
s will create a dictionary that maps the string 'ca1017' to a newly created Machine object. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmers Contest: Fit pictures on a page

2005-06-30 Thread Dan Sommers
7;s some sort of irony or something in there about not writing the best genetic algorithm, but I can't quite put my finger on it. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-06 Thread Dan Sommers
s? Lots more hard-to-find errors from code like this: filehandle = open( 'somefile' ) do_something_with_an_open_file( file_handle ) filehandle.close( ) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Dan Sommers
f Code looked like, but that's even farther off-topic) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-06 Thread Dan Sommers
On Wed, 06 Jul 2005 15:18:31 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> On Wed, 06 Jul 2005 14:33:47 GMT, >> Ron Adam <[EMAIL PROTECTED]> wrote: >> >>> Since this is a Python 3k item... What would be the consequence of >>>

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-06 Thread Dan Sommers
med "this": class A: method __init__(): this.x = 0 method make_my_day(foo): this.x += foo there-aren't-enough-winks-in-the-universe'ly yours, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sha.new

2005-07-09 Thread Dan Sommers
path > f = open(path) > sha = sha.new(f.read()) ^^^ Now the name "sha" no longer refers to the sha module, but to the object returned by sha.new. Use a different name. > sha.update(f.read()) > print sha.hexdigest() Regards, Dan

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Dan Sommers
meters do_something_with_y() where "self" in "self.x" and "self.y" would have to match the first parameter (so that the pathological among us could write this: def __init__(this, this.x, y, this.z): do_something_with_y() instead). (Sorry if this

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Dan Sommers
On Sun, 10 Jul 2005 20:11:38 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Dan Sommers" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> That's a pretty big change; now all formal parameters beginning with >> an

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Dan Sommers
On Mon, 11 Jul 2005 08:34:45 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: >> Dan Sommers schrieb: >> >>> How about this: >>> >>> def __init__(self, self.x, y, self.z): >>> # self.x, self.z from fi

Re: __autoinit__

2005-07-11 Thread Dan Sommers
e "help", "copyright", "credits" or "license" for more information. >>> x, x['abc'] = {}, 3 >>> print x {'abc': 3} >>> x, x['abc'], x['abc'][4] = {}, range(10), - >&

Re: System calls not using correct permissions?

2005-07-14 Thread Dan Sommers
nning, what version of Python you're running, an actual error message, a traceback, what your program is supposed to do that you think it isn't doing, etc.), it's absolutely impossible for anyone to make even an educated guess. See also www.catb.org/~esr/faqs/smart-question

Re: Generating a list of None

2005-07-14 Thread Dan Sommers
On 14 Jul 2005 19:28:14 -0700, "Nicolas Couture" <[EMAIL PROTECTED]> wrote: > if vals == [None * len(vals)]: if vals == [None] * len(vals): Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: System calls not using correct permissions?

2005-07-15 Thread Dan Sommers
guess, but one of (the many) reasons not to use tcsh is that it has some very strange (to me, anyway) rules about which startup files (e.g., .login) to run when. Perhaps one of your such files is being executed in one case and not the other, and is doing something relevant to an environment variable

Re: getting the class name of a subclass

2005-07-20 Thread Dan Sommers
_name__ > print "Class ",A.__name__ Why "A.__name__" and not "self.__class__.__name__"? Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting environment variables for tcsh session

2005-07-21 Thread Dan Sommers
best you can do is have your script output the right commands and have your shell read them. See "Command Substitution" in the tcsh man page. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting environment variables for tcsh session

2005-07-22 Thread Dan Sommers
` $ echo $foo bar or you could it like this: changefoo.py: print 'foo bar' end of changefoo.py Then the shell session would look like this: % setenv `python changefoo.py` % echo $foo bar But we're veering dangerously off topic for c

Re: how to write a line in a text file

2005-07-25 Thread Dan Sommers
line > * re-open the file for writing: f = open('filename.txt', 'w') > * write the list to the file: f.writelines(content) > * close the file: f.close() HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-28 Thread Dan Sommers
;Namespaces are > one honking great idea -- let's do more of those!" Then I shall be > enlightened. And when the one obvious way to do something *is* be obvious at first, then I shall be Dutch! Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-28 Thread Dan Sommers
n to be working on at the time, but such is the nature of Zen. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-29 Thread Dan Sommers
l. But as usual, Zen is not easily nailed to a tree. Was Tim writing about developing Python itself, or about developing other programs with Python? Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-29 Thread Dan Sommers
On 29 Jul 2005 07:45:33 -0700, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Dan Sommers <[EMAIL PROTECTED]> wrote: >> >> Was Tim writing about developing Python itself, or about developing >> other programs with Python? > Yes.

Re: How to do this?

2005-07-30 Thread Dan Sommers
ute "fun()" and > "fun2()", foo will call "self.__base.fun()" or "self.__base.fun2()". > when a attr can't be find in foo, it's will try to search 'self.__base". I > think this maybe need to use "__getattr__" and "

Re: showing help(M) when running module M standalone

2005-07-30 Thread Dan Sommers
.__doc__" > Works but does not seem right using exec for such a task. So don't use exec. > any hint would be great! for x in __all__: print x.__doc__ HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: functions without parentheses

2005-07-30 Thread Dan Sommers
On Sat, 30 Jul 2005 18:42:59 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: > or > arr = (ArrayElementAggregator() > 11 12 13 > 21 22 23 > ) What was that again about every other computer language wanting to be Lisp? ;-) Regards, Dan

Re: showing help(M) when running module M standalone

2005-07-30 Thread Dan Sommers
On Sat, 30 Jul 2005 22:02:49 +0200, Chris <[EMAIL PROTECTED]> wrote: > I tried that, problem is that __all__ containts strings... Oops. I should have looked before I lept. Sorry, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: showing help(M) when running module M standalone

2005-07-30 Thread Dan Sommers
On Sat, 30 Jul 2005 22:02:49 +0200, Chris <[EMAIL PROTECTED]> wrote: > I tried that, problem is that __all__ containts strings... Okay, that's twice I've lept before I looked. How about this: for a in __all__: print globals()[a].__doc__ HTH, Dan --

<    1   2   3   4   5   >