Re: creating class objects inside methods

2009-10-04 Thread Rob Williscroft
xample". > statement and it gets turned into byte code at execution time. Just > like any other language, when Python hits a runtime error, it stops. > Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Plotting multiple datasets with gnuplot

2009-10-09 Thread Rob Garrett
to gnuplot automatically. Any help would be much appreciated! Thanks, Rob PS mulitplot isn't the solution - this places plots literally on top of each other, it doesn't plot different sets of data on the same axes. -- http://mail.python.org/mailman/listinfo/python-list

Query about doing fortran-esque repeat formatting

2009-11-08 Thread Rob Briggs
quot;%s 7%-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7], tmp[i][8], tmp[i][9]) regards, Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Rob Briggs
Thanks to the chaps who answered, I knew there would be an efficient answer to this. regards, Rob On Mon, 2009-11-09 at 13:31 +0100, Jean-Michel Pichavant wrote: > Glenn Hutchings wrote: > > Rob Briggs mun.ca> writes: > > > > > > > Is there a way

Re: Help with database planning

2009-11-14 Thread Rob Williscroft
; in the above looks worryingly like you have structure embedded in the data field, if so you should extract is so its in its own field or table. > (...) > 97420 ZULU DEFINITION VALUE "a language or dialect > spoken in south africa and others" > 97421 ZU

Re: pointless musings on performance

2009-11-24 Thread Rob Williscroft
ST0 (nonevar) 34 JUMP_IF_FALSE4 (to 41) Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: pointless musings on performance

2009-11-24 Thread Rob Williscroft
ondition is more general: nonevar or zerovar can be > '', 0, or None. So I thought it was more work for interpreter to compare > those, while I thought that "is not None" is translated to one, more > low-level and faster action. Apparently not. > > As Rob pointe

Re: Problem Regarding Queue

2010-02-09 Thread Rob Williscroft
> Q_2.put(l) > continue > d=pollard(l) > if(d==l):Q_1.put(l) > else: As the help page above points out also check out the deque Class: http://docs.python.org/library/collections.html#collections.deque Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: python crash on windows but not on linux

2010-02-12 Thread Rob Williscroft
BOX ) at the start of you programme, should stop the "Critical Error" dialog box you are seeing and you may get a chance to see a traceback. Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: Method / Functions - What are the differences?

2010-02-28 Thread Rob Williscroft
Michael Rudolf wrote in news:hmdo3m$28...@news.urz.uni-heidelberg.de in comp.lang.python: > Note that all I did was moving the list and foo into the instance. Still > no self and no cls, but also no static behaviour any more. Yes in the first case foo was an attribute of the class, and in the s

Re: affectation in if statement

2010-03-16 Thread Rob Williscroft
pat, string ) return self.match is not None clip = ... re = ReMatch() if re( r'\s*TM(\d+)', clip ): ... elif re( r'\s*(https?://.*)', clip ): ... elif re( r'\d{12}$', clip ): ... Rob. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Sublassing tuple works, subclassing list does not

2010-03-31 Thread Rob Williscroft
Frank Millman wrote in news:mailman.1360.1270018159.23598.python- l...@python.org in comp.lang.python: > I came up with a simple solution that seems to work - > class MyTuple(tuple): > ... def __new__(cls, names, values): > ... for name, value in zip(names, values): > ... setattr

64 bit memory usage

2010-12-08 Thread Rob Randall
. Can anyone tell me what is happening or where I may be going wrong? Thanks, Rob Randall -- http://mail.python.org/mailman/listinfo/python-list

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
But the C++ program using up memory does not slow up. It has gone to 40GB without much trouble. Does anyone have a 64 bit python application that uses more the 2GB? On 9 December 2010 16:54, Antoine Pitrou wrote: > On Wed, 8 Dec 2010 14:44:30 + > Rob Randall wrote: > > I

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
mory exceptions when running the same sort of stuff on 32 bit, but never 64 bit. On 9 December 2010 16:54, Antoine Pitrou wrote: > On Wed, 8 Dec 2010 14:44:30 + > Rob Randall wrote: > > I am trying to understand how much memory is available to a 64 bit python > > p

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
I will give it a try with the garbage collector disabled. On 9 December 2010 17:29, Benjamin Kaplan wrote: > On Thursday, December 9, 2010, Rob Randall wrote: > > But the C++ program using up memory does not slow up. > > It has gone to 40GB without much trouble. > >

Re: 64 bit memory usage

2010-12-10 Thread Rob Randall
. Thanks, Rob. On 9 December 2010 22:44, John Nagle wrote: > On 12/8/2010 10:42 PM, Dennis Lee Bieber wrote: > >> On Wed, 8 Dec 2010 14:44:30 +, Rob Randall >> declaimed the following in gmane.comp.python.general: >> >> I am trying to understand how much memory i

Re: 64 bit memory usage

2010-12-10 Thread Rob Randall
I manged to get my python app past 3GB on a smaller 64 bit machine. On a test to check memory usage with gc disabled only an extra 6MB was used. The figures were 1693MB to 1687MB. This is great. Thanks again for the help. On 10 December 2010 13:54, Rob Randall wrote: > You guys are ri

RE: Exception handling in Python 3.x

2010-12-13 Thread Rob Richardson
Arnaud, Wouldn't your first suggestion exit after the first element in iterable? And would your second suggestion throw an exception after normal processing of all elements in the interator? RobR -Original Message- I missed the start of this discussion but there are two simpler ways:

RE: If/then style question

2010-12-17 Thread Rob Richardson
-Original Message- What about, def myMethod(): for condition, exitCode in [ (cond1, 'error1'), (cond2, 'very bad error'), ]: if not condition: break else: do_some_usefull_stuff() # executed only if the we never hit the break

RE: If/then style question

2010-12-17 Thread Rob Richardson
My thanks for pointing out the existence of the else: suite in the for statement. However, I remain confused. For reference, here's the original code: > def myMethod(): > for condition, exitCode in [ > (cond1, 'error1'), > (cond2, 'very bad error'), > ]: >

RE: If/then style question

2010-12-17 Thread Rob Richardson
-Original Message- You have outlined what happens when cond1 and cond2 both evaluate to True -- what happens if, say, cond2 evaluates to False? - I reply And the light goes on! (And palm strikes forehead.) I was thinking that the error we were processing was raised by

Re: list 2 dict?

2011-01-02 Thread Rob Williscroft
tuple-bytearray-buffer-xrange> That will make 3 lists before it makes the dict thought, so if the list is large: >>> dict( ( l[ i ], l[ i + 1 ] ) for i in xrange( 0, len( l ), 2 ) ) may be better. Rob. -- http://mail.python.org/mailman/listinfo/python-list

RE: Help with code-lists and strings

2011-01-05 Thread Rob Richardson
You take a sentence and break it up into words, storing it in a list named "list". Then, for each word in the list, you set list2 to a boolean value of true or false, depending on the result of isupper() and istitle(). Note that the variable "list2" does not refer to a list. It refers to whateve

RE: Help with code-lists and strings

2011-01-06 Thread Rob Richardson
Cathy, Please take another try at writing your program, using what advice you have received so far that you understand. I think this discussion is going rather far away from what you need, and seeing another step in the evolution of your program should help bring it back on track. I like your op

RE: Understanding def foo(*args)

2011-01-31 Thread Rob Richardson
My thanks both to the original poster and to JM for an excellent answer. I saw this syntax for the first time recently, and I've been curious about it too. RobR -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Write grep in Emacs Lisp (tutorial)

2011-02-09 Thread Rob Warnock
y one arg!! IT FOUND THE PATTERN, BUT DIDN'T TELL ME WHAT !@^%!$@#@! FILE IT WAS IN!! :-{ The trailing "/dev/null" fixes that. ;-} -Rob - Rob Warnock 627 26th Avenue http://rpw3.org/> San Mateo, CA 94403 (650)572-2607 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Write grep in Emacs Lisp (tutorial)

2011-02-09 Thread Rob Warnock
. [At least, it wasn't in FreeBSD 4.6, though it seems to be in FreeBSD 6.x and later...] Thanks, guys!! -Rob - Rob Warnock 627 26th Avenue http://rpw3.org/> San Mateo, CA 94403 (650)572-2607 -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess pipe question

2011-02-22 Thread Rob Williscroft
f you don't need the processes output then don't use the PIPE argument. If you do you will need to read from p.stdout until the process is complete, then get the return code: while True: buf = p.stdout.read( 1024 ) # do somthing with buf if len( buf ) &l

Re: subprocess pipe question

2011-02-23 Thread Rob Williscroft
Rita wrote in news:AANLkTi=88dcpm_kqrs2g620obsnxz0majubfwpeme...@mail.gmail.com in gmane.comp.python.general: [Top post relocated] > On Tue, Feb 22, 2011 at 7:57 PM, Rob Williscroft > wrote: > >> Rita wrote in >> news:AANLkTi=w95gxosc1tkt2bntgjqys1cbmdnojhokq4

Re: py2exe help

2010-05-11 Thread Rob Williscroft
is incorrect. > Reinstalling the application may fix this problem. > > > Anyone have the same problem with this?. http://www.py2exe.org/index.cgi/Py2exeAndWin32ui Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Rob Williscroft
unziped = gzip.GzipFile( "wahatever", mode = 'rb', fileobj = buf ) html = unziped.read().decode('utf-8') print( html.encode( "ascii", "backslashreplace" ) ) Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeDecodeError having fetch web page

2010-05-26 Thread Rob Williscroft
Kushal Kumaran wrote in news:1274889564.2339.16.ca...@nitrogen in gmane.comp.python.general: > On Tue, 2010-05-25 at 20:12 +0000, Rob Williscroft wrote: >> Barry wrote in news:83dc485a-5a20-403b-99ee-c8c627bdbab3 >> @m21g2000vbr.googlegroups.com in gmane.comp.python.gener

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Rob Williscroft
r: r = ( random() * 11 ) if r < 1: picklist = truck_list elif r < 4: picklist = bike_list else: picklist = car_list # now pick the final item from pick list. Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: dumping generator

2010-08-09 Thread Rob Williscroft
next() > except StopIteration: > print "Done" > else: > raise > > is there a much simpler way ? print list( gen ) > > like for printing list we do > list = range(10) > print list > would print > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Rob. -- http://mail.python.org/mailman/listinfo/python-list

Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Rob Newman
group 391 May 19 22:40 /path/to/files/ BNLO_info.pf myhost{me}12% ls -la /path/to/file/B11A_info.pf -rw-rw-r-- 1 me group 391 May 19 22:27 /path/to/files/ B11A_info.pf I might be doing this completely wrong, but I thought this would be the way to list the files dynamically. Admittedly this is just a stepping stone to running the actual shell script I want to run. Can anyone point me in the right direction or offer any advice for using these packages? Thanks in advance for any help or insight. - Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Rob Newman
Thanks Matt - that worked. Kind regards, - Rob On Jun 16, 2009, at 12:47 PM, Matt wrote: Try replacing: cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] with: cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] Basically, the first is the con

Re: ODE, GUI, plotter in Python

2009-06-17 Thread Rob Clewley
There was just an announcement on this list and the scipy list for PyLab_Works, which sounds exactly like what you're looking for. I would not recommend starting over with a new simulator at this point. -Rob On Tue, Jun 16, 2009 at 12:00 PM, Ala wrote: > Hello everyone. > > I

RSA cryptography between Python and Java

2009-07-25 Thread Rob Knop
e key. Are there any python libraries that will take a public key in this format and do RSA encoding on it? -- --Rob Knop E-mail:rk...@pobox.com Home Page: http://www.pobox.com/~rknop/ Blog: http://www.sonic.net/~rknop/blog/ -- http://mail.python.org/mailman/listinfo/python-list

Re: RSA cryptography between Python and Java

2009-07-25 Thread Rob Knop
ibed, and where the cipertext can later be decrypted with the corresponding secret key in Java. -- --Rob Knop E-mail:rk...@pobox.com Home Page: http://www.pobox.com/~rknop/ Blog: http://www.sonic.net/~rknop/blog/ -- http://mail.python.org/mailman/listinfo/python-list

write Unicode to sys.out.write without access to sitecustomize.py

2009-08-28 Thread Rob Knop
I would like to tell the system that it's OK to write Unicode to sys.out and sys.err. However, I'm doing this in a CGI script where I don't have access to the system directories, and as such can't use sys.setdefaultencoding in sitecustomize.py. Is there a way to make thi

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
data (the pointer and the length) that is really copied, the strings character data stays where it is. So the code you cite is in fact O(N) as the copy is constant size. Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
ase that CPython optimizes. s[:] is s. If > you repeat your test with s[1:], you'll see memory climb as one might > normally expect. > Thanks for the correction (to Jack also) Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Rob Warnock
it is that we find that the mass of the Sun is 1.48 km or 4.93 us, see: http://en.wikipedia.org/wiki/Solar_mass#Related_units In this limited sense, then, one could convert both 1 inch and 1 second to masses[1], and *then* add them, hence: 1 inch + 1 second = ~4.03e38 grams. ;-} ;-} -R

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Rob Warnock
Fortran programs in 1410 mode with output to a mag tape, then rebooted into 1401 mode to run the program that plotted the data on the tape, then rebooted back into 1410 mode for the next guy who needed the machine. -Rob - Rob Warnock 627 26th Avenue http://

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Rob Warnock
| Now that I think about it, I still can't. :-) +--- Write it our longhand and it's easier to grok: 9.8 m/s^2 ==> 9.8 m/(s*s) ==> 9.8 m/(s*s) ==> (9.8 meters per second) per second. \ / \__ speed added __/ per second

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Rob Warnock
RG wrote: +--- | r...@rpw3.org (Rob Warnock) wrote: | > Write it our longhand and it's easier to grok: | > 9.8 m/s^2 ==> 9.8 m/(s*s) ==> 9.8 m/(s*s) ==> | > (9.8 meters per second) per second. | > \ / | > \__ speed a

Re: How to test if a module exists?

2010-11-06 Thread Rob Williscroft
python.org/library/imp.html#imp.find_module Rob. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store properties

2017-02-08 Thread Rob Gaddi
ove on; wheel reinvention is for suckers. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Re: Repeating of posts

2017-02-10 Thread Rob Gaddi
eternal-september, and he figured out why comp.lang.python has been getting all those weird echos from f38.n261.nz, hunted down the malefactor and put a stop to it. So that part of the problem should at least be fixed. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email

Re: Python application launcher (for Python code)

2017-02-21 Thread Rob Gaddi
u might want, which is a functioning shell under Windows, and yes it works all the way back to XP. At the low low price of free, you'll definitely get your money's worth. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order

Re: Python under PowerShell adds characters

2017-03-29 Thread Rob Gaddi
o, better. How about something that integrates with no preexisting workflow in the world. E1: Wait, but what commands would it use? E2: New ones. E1: But, then how would it behave? E2: Totally new. Never before seen. New commands, new semantics, whole 9 yards. If anyone's ever used it,

Re: Two variable dictionary comprehension

2017-04-03 Thread Rob Gaddi
mon usages. This could be a good exercise to clarify some of the fuzzy areas. Deborah And don't forget dict_comp : { k:v for (k,v) in kv_provider } set_comp : { item for item in item_provider } set_of_tuples_comp : { (k,v) for (k,v) in kv_provider } Just to make things more complicated.

Re: Appending data to a json file

2017-04-04 Thread Rob Gaddi
ent: what happens if you get a powerfail midway through. I'm not saying it's the right answer, but it's not nearly so much flyswatting with a sledgehammer as you may think. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently o

Re: Two variable dictionary comprehension

2017-04-04 Thread Rob Gaddi
re so many types of comprehensions, yet under 'comprehensions' in the Index, you only see 'list'. And there are no entries for the other types, by their names. Deborah Does it seem... incomprehensible? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email addr

Re: "Goto" statement in Python

2017-04-12 Thread Rob Gaddi
g. if I would use Python for modelling "pipeline" algorithms this could be helpful also. Now if I count in the nested loops breaking problematic, seems that there is at least a prerequisite for existence of "goto". Am I right? Mikhail def finder: for s in S: if s == 

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
ed differently in Python than in C. I try very hard to write Python when I write Python, and to write C when I write C. And to write through the tears when I write C++. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
return_val; But the point is, in Python we have context managers and exceptions and classes, all of which serve to allow you to not have to explicitly lay out how to wind yourself step-by-step back out of the situation you've gotten yourself into. -- Rob Gaddi, Highland Technology -- ww

Re: "Goto" statement in Python

2017-04-14 Thread Rob Gaddi
the only useful use of GOTO in any reasonable language in a simple, easy to visualize way. If your GOTOs are crossing you've done something wrong. If more people had good mechanisms for visualizing their code I'd use far less profanity literally every day of my life. --

Re: Regular Expressions, Speed, Python, and NFA

2017-04-14 Thread Rob Gaddi
as difficult to read as a regex, but still simple enough to be solved by one. And that ground is definitely occupied. But not vast. So is it worth the time to try to write a more efficient regex parser for Python? Yours if you want it to be, but not mine. -- Rob Gaddi, Highland Technolo

Buffers and pointers (Py3.4)

2017-04-17 Thread Rob Gaddi
7274 about this nearly a year ago, but no actual action. I really want to take all of this low-level horribleness, wrap it up into a higher-level API, and never be subject to the gory details again. This pointer thing is about the last hangup. Ideas? -- Rob Gaddi, Highland Technology -- w

Re: Buffers and pointers (Py3.4)

2017-04-17 Thread Rob Gaddi
On 04/17/2017 02:49 PM, eryk sun wrote: On Mon, Apr 17, 2017 at 5:58 PM, Rob Gaddi wrote: buffertype = c_uint8 * size return addressof(buffertype.from_buffer(buf, offset)) works but is inefficient and woefully inelegant. A lot of the cost there is in creating buffertype, but why do you need

Re: HOT LIST

2017-04-18 Thread Rob Gaddi
prosperous relationship of not doing business with your demonstrably useless organization, and wish you all the best luck in falling down a flight of stairs. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix

Re: Buffers and pointers (Py3.4)

2017-04-18 Thread Rob Gaddi
On 04/17/2017 11:47 AM, Chris Angelico wrote: On Tue, Apr 18, 2017 at 3:58 AM, Rob Gaddi wrote: If I were writing this as a C extension, getting that information from any buffer object would be trivial, but that changes my project from a pure Python wrapper using ctypes to a mixed language

Re: Write a function sorting(L).

2017-04-21 Thread Rob Gaddi
of getting some help here Have you tried a) Googling for information on sorting algorithms and then b) implementing one in Python? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.o

Re: Array column separations for beginners

2017-05-01 Thread Rob Gaddi
else? THanks! Get rid of the leading (. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Re: Promiscuous ports under Linux

2017-05-03 Thread Rob Gaddi
Thanks. Tried running it as root? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Low level I/O: because I could

2017-05-10 Thread Rob Gaddi
fer(mm) And it just works. Behaves exactly the same way memory-mapping that struct in C would. Sure the accesses take dict lookups, and that definitely slows you down a bit. If you REALLY really needed that speed you'd be writing C. But it works. -- Rob Gaddi,

Re: Concatenating files in order

2017-05-23 Thread Rob Gaddi
ite a key function that extracts the numbery bits, sort the list based on that key function, and go to town. Alternatively, when you create the files in the first place, make sure to use more leading zeros than you could possibly need. xxx_chunk_01 sorts less than xxx

Re: Generator and return value

2017-06-07 Thread Rob Gaddi
e', 'try', 'to', 'put', 'us', 'down') self.final = 'talking about' mygen = MyGeneration() for item in mygen: print(item) print(mygen.final) -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Re: API Help

2017-06-14 Thread Rob Gaddi
tyAvailable":1.0},{"warehouseCode":"WA-1-US","quantityAvailable":0.0},{"warehouseCode":"PO-1-CA","quantityAvailable":0.0}]}] Indeed. So, I think we're agreed that it's definitely one or the other. It's both a floor wax _and_ a dessert topping! Since it's viable directly as Python code, you should just eval() the random thing you got from the Internet and use the result.[*]_ .. [*] Don't do that. Don't ever, EVER do that. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Project Structure

2017-06-19 Thread Rob Gaddi
standard way of pretty-printing and paging the reST to the terminal. And, more the point, this all feels VERY tangled. Like there's something that other people just know to do and I missed the memo. Anyone have any ideas on a cleaner implementation? -- Rob Gaddi, Highland Technology --

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Rob Gaddi
nderlying rhyme or reason; just a collection of stuff and if you do all the stuff then magic. Eggs and wheels and twine make me feel like I'm playing the world's worst Settlers of Catan knockoff every time I try to make a project all pretty, and the XKCD 927 factor is in full and glorio

Re: Users of namedtuple: do you use the _source attribute?

2017-07-17 Thread Rob Gaddi
27;s a straightforward namedtuple implementation that calls type() directly rather than having to exec. I know that exec-gunshyness is overblown, but is there a simple answer as to why it's necessary here? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email addr

Re: Best way to assert unit test cases with many conditions

2017-07-18 Thread Rob Gaddi
trying to drive nails with the butt of a screwdriver. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Rob Gaddi
would you ever know that test2 is even doing its job? Why is this superior to writing five tests, all of which always run? Note that "runtime" is not a valid answer unless you're talking about multiple minutes of it. -- Rob Gaddi, Highland Technology -- www.highlandtec

Re: pyserial and end-of-line specification

2017-07-19 Thread Rob Gaddi
sable code and makes it easy to integrate logging, retries, integrating "*OPC?" handshakes, whatever sort of things turn out to be necessary on a given device. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list

Re: Nesting concurrent.futures.ThreadPoolExecutor

2017-07-20 Thread Rob Gaddi
awns B, A blocks on something that B is supposed to do (such as completing a Future), but due to the thread limit of the pool, the mere existence of A is preventing B from being executed, and you have a deadlock. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address doma

Re: Exponential Smoothing program

2017-08-31 Thread Rob Gaddi
mpy, Scipy, Matplotlib and, if you're going to be doing stocks, Pandas. There's a LOT there between them, it's a bit of a drink from the firehose problem. I like Wes McKinney's "Python for Data Analysis" book and consider it a good investment if you need to get up to s

Re: Dictionaries

2006-10-18 Thread Rob De Almeida
Lad wrote: > Let's suppose I have > > a={'c':1,'d':2} > b={'c':2} > but > a.update(b) > will make > {'c': 2, 'd': 2} > > and I would need > {'c': 3, 'd': 2} > > (because `c` is 1 in `a` dictionary and `c` is 2 in `b` dictionary, so > 1+2=3) > > How can be done that? dict([(k, a.get(k, 0) + b.ge

Re: Where to find fpconst?

2006-09-04 Thread Rob De Almeida
> Anybody know where I can find fpconst? I uploaded the lastest copy I could find to the Cheese Shop (http://www.python.org/pypi/fpconst/). I'm not affiliated in any way with fpconst, btw. Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: ancestor class' __init__ doesn't call other methods

2006-09-15 Thread Rob De Almeida
nit__(self, par) s = Sistema("par") --Rob -- http://mail.python.org/mailman/listinfo/python-list

Compile AST to bytecode?

2006-09-19 Thread Rob De Almeida
line 1, in ? TypeError: compilest() argument 1 must be parser.st, not instance Any hints? TIA, --Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Compile AST to bytecode?

2006-09-19 Thread Rob De Almeida
Module actually does. Thanks, Duncan. It worked perfectly. :-) For arbitrary nodes I just had to wrap them inside an Expression node: >>> ast = compiler.ast.Expression(node) >>> ast.filename = 'dummy' >>> c = compiler.pycodegen.ExpressionCodeGenerator

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Rob De Almeida
LaundroMat wrote: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. If you *absolutely* w

Re: WSGI with mod_python (was: Python, WSGI, legacy web application)

2006-11-23 Thread Rob De Almeida
I have a short description of different ways to run a WSGI app here: http://pydap.org/docs/server.html Though it's focused on a specific WSGI app I wrote it uses Paste Deploy, so you can generalize it easily. --Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: What was that web interaction library called again?

2007-06-22 Thread Rob De Almeida
On Jun 22, 11:19 am, Harald Korneliussen <[EMAIL PROTECTED]> wrote: > Hi, > > I remember I came across a python library that made it radically > simple to interact with web sites, connecting to gmail and logging in > with four or five lines, for example. I thought, "that's interesting, > I must loo

Re: Rappresenting infinite

2007-06-27 Thread Rob De Almeida
On Jun 27, 6:41 am, andrea <[EMAIL PROTECTED]> wrote: > I would like to have a useful rappresentation of infinite, is there > already something?? from numpy import inf -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing 2 similar strings?

2005-05-28 Thread Rob W. W. Hooft
memory. Time taken and memory used is proportional to the product of the lengths of the input strings. Use for strings longer than 25 characters is entirely for your own risk. Regards, Rob Hooft -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing 2 similar strings?

2005-05-28 Thread Rob W. W. Hooft
all different (score 0.0), but the strings are not even equally long (hence <0.0). The gap-open and gap-elongation penalties can be adjusted in the module. The -0.3 and -0.2 values were set after some experimentation to make the relative scores of different matches "feel" nat

Re: Style for docstring

2022-04-22 Thread Rob Cliffe via Python-list
ive.  But who is it addresed to?  Is a function considered to be a sentient entity that can respond to a command?  Is it an invocation to the lines of code following the docstring: "Do this!" Might not the programmer mistakenly think (if only for a moment) that the imperative is a

Re: Style for docstring

2022-04-25 Thread Rob Cliffe via Python-list
Well, de gustibus non est disputandum.  For me, the switch from the imperative mode to the descriptive mode produces a mild cognitive dissonance. Best wishes Rob Cliffe On 25/04/2022 23:34, Cameron Simpson wrote: On 23Apr2022 03:26, Avi Gross wrote: We know some people using "profess

Re: Printing Unicode strings in a list

2022-04-28 Thread Rob Cliffe via Python-list
doing that. Still, if you're feeling noble, you could start the work of making your code Python 3 compatible.😁 Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
#x27;x', 'y') and sometimes ('x', 'y') ('y', 'x') Can anyone explain why running identical code should result in traversing a set in a different order? Thanks Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
On 16/05/2022 04:13, Dan Stromberg wrote: On Sun, May 15, 2022 at 8:01 PM Rob Cliffe via Python-list wrote: I was shocked to discover that when repeatedly running the following program (condensed from a "real" program) under Python 3.8.3 for p in { ('x

Re: Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
Thanks, Paul.  Question answered! Rob Cliffe On 16/05/2022 04:36, Paul Bryan wrote: This may explain it: https://stackoverflow.com/questions/27522626/hash-function-in-python-3-3-returns-different-results-between-sessions On Mon, 2022-05-16 at 04:20 +0100, Rob Cliffe via Python-list wrote

REPL with multiple function definitions

2022-06-26 Thread Rob Cliffe via Python-list
ot; for more information. >>> def f(): pass ... def g(): pass   File "", line 2     def g(): pass     ^ SyntaxError: invalid syntax >>> Is there a good reason for this? Thanks Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: REPL with multiple function definitions

2022-06-28 Thread Rob Cliffe via Python-list
On 26/06/2022 23:22, Jon Ribbens via Python-list wrote: On 2022-06-26, Rob Cliffe wrote: This 2-line program def f(): pass def g(): pass runs silently (no Exception).  But: 23:07:02 c:\>python Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on wi

Byte arrays and DLLs

2022-06-30 Thread Rob Cliffe via Python-list
a sensible approach, or am I still missing something? AKAIK it is not possible to give ctypes a bytearray object and persuade it to give you a pointer to the actual array data, suitable for passing to a DLL.  Is this (a) false (b) for historical reasons (c) for some other good reason? TIA Rob

Re: Byte arrays and DLLs

2022-07-03 Thread Rob Cliffe via Python-list
That worked.  Many thanks Eryk. Rob On 30/06/2022 23:45, Eryk Sun wrote: On 6/30/22, Rob Cliffe via Python-list wrote: AKAIK it is not possible to give ctypes a bytearray object and persuade it to give you a pointer to the actual array data, suitable for passing to a DLL. You're overlo

<    4   5   6   7   8   9   10   11   >