Re: initializing parameters class in Python only once?

2014-07-14 Thread Rob Gaddi
, and import params from all over the rest of the program. Once the interpreter has imported it for the first time, everyone else just gets a link to the same instance of the module rather than running it all over and over again. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email

Re: Exploring Python for next desktop GUI Project

2014-07-24 Thread Rob Gaddi
of my codebase on Python 2.x., and didn't feel like wxPython Phoenix was ready for prime time. To the best of my knowledge, PySide is still under active development, including as the day job for Robin Dunn, the lead developer of wxPython. -- Rob Gaddi, Highland Technology

Re: Making every no-arg method a property?

2014-08-05 Thread Rob Gaddi
to talk about the function itself rather than the value thereof. No more help from the interactive console. No more passing the function as an argument. All to save '()', which is what tells other programmers that you're calling a function. -- Rob Gaddi, Highland Technology

Re: Making every no-arg method a property?

2014-08-06 Thread Rob Gaddi
No, no. Options use up commas, not parentheses. Maybe equals signs if you're feeling particularly verbose. Clearly there's a market for some sort of well-diversified punctuation fund. The only problem becomes listing it. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address

Re: Begginer in python trying to load a .dll

2014-08-12 Thread Rob Gaddi
(sessionVar) p3 = ctypes.c_int (1) p4 = ctypes.c_int (0) hllApi (ctypes.byref (p1), p2, ctypes.byref (p3), ctypes.byref (p4)) Great. And that fails in what way, on which line, with what error message? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain

Re: Suitable Python code to scrape specific details from web pages.

2014-08-12 Thread Rob Gaddi
web scraping, you want to use http://www.crummy.com/software/BeautifulSoup/ . End of story. -- 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: Captcha identify

2014-08-13 Thread Rob Gaddi
to do with the coding work itself. Don't say something to prove you're so noble. Hai guyz I am new to biochemistry and so I need lots of help with things.can you tell me how to make anthrax? I need it for stuff, so dont worry -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com

Logging multiple formats to the same file

2014-08-15 Thread Rob Gaddi
.') -- 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

Efficiency, threading, and concurrent.futures

2014-08-20 Thread Rob Gaddi
those were pretty dead on even. Any idea what I'm seeing here? -- 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: Global indent

2014-08-22 Thread Rob Gaddi
it looks like I might have to try Emacs. Thanks everyone Emacs and vim both have huge learning curves that I've decided aren't worth climbing. Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. -- Rob Gaddi, Highland Technology

Re: Raspberry pi, python and robotics

2014-09-02 Thread Rob Gaddi
it to spend. Actually do all that and you'll understand as much about circuits as anyone they're giving an EE degree to these days. Then you can start. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https

Re: Python is going to be hard

2014-09-03 Thread Rob Gaddi
in steve. This would have been clear if you were to add a print(x) into the loop. -- 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: Python is going to be hard

2014-09-03 Thread Rob Gaddi
item in the list. . . . Keep persisting! -- ~Ethan~ Python 'for' is better read as 'for each'. -- 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: Fuzzy Counter?

2014-09-23 Thread Rob Gaddi
go into that bin, but 2.1 would go into a different one. TL;DR you need to think very hard about your problem definition and what you want to happen before you actually try to implement this. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out

Re: Fuzzy Counter?

2014-09-26 Thread Rob Gaddi
On Tue, 23 Sep 2014 22:01:51 -0700 (PDT) Miki Tebeka miki.teb...@gmail.com wrote: On Tuesday, September 23, 2014 7:33:06 PM UTC+3, Rob Gaddi wrote: While you're at it, think long and hard about that definition of fuzziness. If you can make it closer to the concept of histogram bins

Re: Fuzzy Counter?

2014-09-26 Thread Rob Gaddi
On Fri, 26 Sep 2014 15:10:43 -0400 random...@fastmail.us wrote: On Fri, Sep 26, 2014, at 14:30, Rob Gaddi wrote: The histogram bin solution that everyone keeps trying to steer you towards is almost certainly what you really want. Epsilon is your resolution. You cannot resolve any

Re: while loop - multiple condition

2014-10-13 Thread Rob Gaddi
is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. -- 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: while loop - multiple condition

2014-10-13 Thread Rob Gaddi
On Mon, 13 Oct 2014 09:26:57 -0700 (PDT) Rustom Mody rustompm...@gmail.com wrote: On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote: On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano wrote: When you have multiple clauses in the condition, it's easier to reason about

Re: Classes

2014-10-30 Thread Rob Gaddi
there is no age. This is because you are trying to call a function of the class object, rather than a function of an instance of the class. pax=pet() -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org

Re: Classes

2014-10-31 Thread Rob Gaddi
nothing. Figuring out how to hunt down the syntax errors your retyping has induced teaches much. -- 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: Classes

2014-10-31 Thread Rob Gaddi
and width remain locked, and that perimeter() and area() work correctly. -- 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: Classes

2014-10-31 Thread Rob Gaddi
On Fri, 31 Oct 2014 14:24:11 -0700 (PDT) sohcahto...@gmail.com wrote: On Friday, October 31, 2014 1:51:23 PM UTC-7, Chris Angelico wrote: On Sat, Nov 1, 2014 at 4:43 AM, Rob Gaddi rgaddi@technologyhighland.invalid wrote: Define a Square class, subclassed from Rectangle. Use getters

Re: Advice

2014-11-11 Thread Rob Gaddi
-2.30am everyday. Is this possible? I would appreciate any help. Thank you for your time. Regards Mary-Frances Your keyword search is 'cron'. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https

Re: I love assert

2014-11-11 Thread Rob Gaddi
-discipline. assert obj.read_accesses 10 -- 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: Combining lists to dictionary

2014-11-11 Thread Rob Gaddi
, and really that concerned about the extra memory used by zip returning a list rather than an iterator, you can use itertools.izip -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman

Re: How to access Qt components loaded from file?

2014-11-19 Thread Rob Gaddi
the things that you want to do in some defined order. -- 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: Most gratuitous comments

2014-12-04 Thread Rob Gaddi
simplifies knowing where to start looking for documentation. -- 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

[issue20629] Python ctypes BigEndianStructure bitfield assignment misbehavior in Linux

2014-02-19 Thread Rob Gaddi
Rob Gaddi added the comment: I was just working on similar things, and found the same problem. I can confirm failure on both Python 2.7.4 and Python 3.3.1 running on 64-bit Linux, and that the Windows builds do not have this problem. My code: from __future__ import print_function from

Re: pymongo and attribute dictionaries

2015-02-04 Thread Rob Gaddi
. def docs(dicts): return map(Doc, dicts) Or, if you really wanted to be crazy for d in client.db.radios.find({’_id': {’$regex’: ‘^[ABC]'}}): doc = Doc(d) pprint(doc) I mean, I realize linefeeds don't grow on trees and all... -- Rob Gaddi, Highland Technology

Setuptools, __init__ and __main__

2015-02-06 Thread Rob Gaddi
up with an elegant solution, but does anyone already have one? -- 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: Setuptools, __init__ and __main__

2015-02-06 Thread Rob Gaddi
On Fri, 06 Feb 2015 16:44:26 -0500, Dave Angel wrote: On 02/06/2015 04:35 PM, Ben Finney wrote: Rob Gaddi rgaddi@technologyhighland.invalid writes: So I'm trying to wrap my head around packaging issues Congratulations on tackling this. You will likely find the Python Packaging User Guide

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Rob Gaddi
On Thu, 05 Feb 2015 11:25:42 -0800, Paul Moore wrote: On Thursday, 5 February 2015 16:57:07 UTC, Rob Gaddi wrote: You don't need the whole scipy stack, numpy will let you do everything you want. The trick to working in numpy is to parallelize your problem; you don't do a thing a thousand

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Rob Gaddi
(axis=1) -- 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: Comparisons and sorting of a numeric class....

2015-01-15 Thread Rob Gaddi
) methods to say Alright, well when you do finally have to make a decision on this thing, here's how you make it. And obviously, you can add on as many additional data members to carry additional information as your heart desires. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email

Re: Python Peewee Query Example Needed

2015-02-17 Thread Rob Gaddi
= then) -- 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: Is there a more elegant way to spell this?

2015-01-27 Thread Rob Gaddi
: do_something_to(x) -- Chris Warrick https://chriswarrick.com/ Sent from my Galaxy S3. Or the somewhat less indenty for x in seq: if not some_predicate: continue do_something_to(x) -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order

Re: __next__ and StopIteration

2015-02-09 Thread Rob Gaddi
). -- 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

Matplotlib and cx_Freeze

2015-03-09 Thread Rob Gaddi
of the freeze. I'm pretty much out of ideas at this point. Anyone have any advice? -- 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: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Rob Gaddi
(): if invalid_argument_combination: raise ValueError('Hey jerk, read the documentation.') # otherwise you do your thing in here. -- 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

Setuptools Confusion

2015-03-30 Thread Rob Gaddi
? Is it really as complicated as all this, or is there something trivial and stupid that I'm just missing? -- 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 practice: Sharing object between different objects

2015-02-23 Thread Rob Gaddi
to be code for code's sake. -- 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: Regex Python Help

2015-03-24 Thread Rob Gaddi
Python only. I do have dummy files with the regex string. Thanks again, Gregg Gregg -- First, please don't top-post. Secondly, os.listdir only does exactly that; it lists everything on one directory. You're looking for os.walk. -- Rob -- Rob Gaddi, Highland Technology

Re: Regex Python Help

2015-03-24 Thread Rob Gaddi
the entire thing as $ find . -type f | xargs grep DECRYPT_I -- 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: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Rob Gaddi
out to disk, one page per file, and then use something like pdftk to stitch them all together after the fact. -- 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: l = range(int(1E9))

2015-04-30 Thread Rob Gaddi
legacy support. I'd understand if you were trying to maintain an old codebase with lots of legacy code that was having problematic migrations, but with the opportunity to start fresh? Start fresh. You'll be happier for it. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email

Re: Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?

2015-05-12 Thread Rob Gaddi
haven't written a line of it in 20 years. It's the ability to read a map. A lack of C is the person blindly following their GPS and hoping for the best. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https

Updating a package on PyPi, testing and etiquette

2015-05-12 Thread Rob Gaddi
avoided using features I know are newer, like yield from and Enums, but I won't swear it'll work on 3.0 if I can't test it that way. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman

Re: Updating a package on PyPi, testing and etiquette

2015-05-12 Thread Rob Gaddi
On Wed, 13 May 2015 08:35:02 +1000, Ben Finney wrote: Rob Gaddi rgaddi@technologyhighland.invalid writes: B) If I can't manage that, what's the etiquette behind having later versions of a module break compatibility with older versions of Python. Consult your user community, tell them

Re: New to Python - block grouping (spaces)

2015-04-16 Thread Rob Gaddi
for making dead horses fly [33 posts in 13 hours and going strong] Catapult and a dream, man. Catapult and a dream. -- 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

Re: A question about numpy

2015-04-14 Thread Rob Gaddi
On Tue, 14 Apr 2015 23:41:56 +0100, Paulo da Silva wrote: Supposing I have 2 vectors v1 and v2 and a value (constant) k. I want to build a vector r with all values of v1 greater than k and the others from v2. You're looking for numpy.where() . -- Rob Gaddi, Highland Technology

Re: How to inverse a particle emitter

2015-06-04 Thread Rob Gaddi
On Thu, 04 Jun 2015 16:15:20 -0700, stephenppraneel7 wrote: hey, i really need help, im a straight up beginner in scripting and i need to figure out how to make an inverted particle emitter using python in maya This is why we can't have nice large hadron colliders. -- Rob Gaddi, Highland

Re: How to use an iterator?

2015-06-01 Thread Rob Gaddi
to enumerate the (hopefully finite) elements of someotheriterable. This is common enough that the built-in enumerate function does exactly that. Make sense yet? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix

Re: Python Developer- [LOCATION DELETED]

2015-08-21 Thread Rob Gaddi
email id s...@theappliedthought.com or you can reach me on 407-574-7610. Please feel free to send unsolicited offers for genital enlargement and 30% APR credit cards to the above addresses. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out

Re: Python Questions - July 25, 2015

2015-07-28 Thread Rob Gaddi
implementation, which is neither here nor there. If I remember right, numpy does dynamic loading of one of a couple different (FORTRAN?) algebra libraries depending on which ones it can find installed. That would be a pretty clear use case for libffi. -- Rob Gaddi, Highland Technology

Re: Python Questions - July 25, 2015

2015-07-27 Thread Rob Gaddi
steps, but at that point I wouldn't be able to vouch for the process. -- 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: register cleanup handler

2015-07-24 Thread Rob Gaddi
code_executed_unconditionally finally: if need_cleanup: do_cleanup if condition: try: do_something_needing_cleanup() code_executed_unconditionally() finally: do_cleanup() else: do_something_else() code_executed_unconditionally() -- Rob Gaddi, Highland Technology

Re: Need assistance

2015-07-17 Thread Rob Gaddi
with a powered nailgun at your feet. Search is an inefficient way to try to split a string into parts based on a delimiter. -- 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

Re: Help on savefig parameters

2015-11-17 Thread Rob Gaddi
to the inline docs for that entire set of libraries; it'll make your life easier. -- 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: Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-06 Thread Rob Gaddi
level by the same entry point. Anything in the genre is hosed until they get it back under control. Personally, I'm so upset that I'm going to call Linux and demand my money back. But until then I'm regressed to -63. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email addres

Re: How can I export data from a website and write the contents to a text file?

2015-11-18 Thread Rob Gaddi
ndows machine I long ago switched the default editor to Notepad++ for everything and was far happier for it. -- 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

isinstance() and multiple inheritance/ctypes

2015-08-26 Thread Rob Gaddi
can get really wonky on this stuff. More generally, is there any good way to introspect ctypes derived classes? I have to figure out whether things are derived from Structure, Union, Array etc. through some ugly indirect methods, and have no idea why. -- Rob Gaddi, Highland Technology

Re: isinstance() and multiple inheritance/ctypes

2015-08-26 Thread Rob Gaddi
and not enough cups of coffee to compensate. Thanks for the help, my stupid mistake. -- 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: Check if a given value is out of certain range

2015-09-29 Thread Rob Gaddi
check if a value is out of certain > range? > Example - To check if x is either less than zero or greater than ten? > Right now I am using x < 0 or x > 10. > > Regards, > Laxmikant not (0 <= x <= 10) -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Emai

Re: Question about regular expression

2015-10-01 Thread Rob Gaddi
.' That one's not always true, but any time you're debating a regex solution it should at least come to mind. Lots of people have posted lots of pure Python solutions. I will simply comment that using any of them will make you fundamentally happier as time goes on than trying to shoehorn a r

Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-02 Thread Rob Gaddi
try to report this one to? Thanks, Rob -- 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: Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-05 Thread Rob Gaddi
On Sat, 03 Oct 2015 11:12:28 +0200, Laura Creighton wrote: > In a message of Sat, 03 Oct 2015 11:07:04 +0200, Laura Creighton writes: >>In a message of Fri, 02 Oct 2015 22:36:23 -0000, Rob Gaddi writes: >>>So, this is odd. I'm running Ubuntu 14.04, and my system did a kern

Re: Accessing container's methods

2015-12-07 Thread Rob Gaddi
can make it work. Sometimes, in non-contrived examples, you get a situation where you can't avoid blending information around in both directions. In that case, your Monty instance is already acting as a factory for Actors. Keep going with that; have the Actor be init'ed with a .monty that refers back

Python Data Analysis Recommendations

2015-12-31 Thread Rob Gaddi
than "why you write the code". Paying money for books is acceptable; this is all on the company's time/dime. Thanks, Rob -- 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: error help import random

2015-11-20 Thread Rob Gaddi
(len(fortunes)) print(i, fortunes[i]) Or to be lazier still, just use random.choice fortunes = ('happy', 'horny', 'messy', 'sad', 'lool', 'buggy') print(random.choice(fortunes)) None of which actually addresses the OP's issue with input(), but it's nice to get the back half clean as well. -- 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: for / while else doesn't make sense

2016-06-02 Thread Rob Gaddi
the _canonical_ use case for for loopvar in range(initial_value, limit+1): processing if found_what_im_looking_for: break else: do_whatever_it_is_you_do_when_its_not_found The limited variable scoping is the only thing missing, and you can get around that by telling yourself

Re: Recommendation for GUI lib?

2016-06-02 Thread Rob Gaddi
/www.eurion.net/python-snippets/snippet/Calendar_Date%20picker.html > > - Nick. I use PySide rather than PyQt, but definitely count me as another vote for Qt as the toolkit of choice. I started out on wx, but when I needed to move to Python3 it wasn't able to come with me. -- Rob Gaddi, Hig

Re: for / while else doesn't make sense

2016-06-03 Thread Rob Gaddi
Lawrence D’Oliveiro wrote: > On Friday, June 3, 2016 at 8:09:21 AM UTC+12, Rob Gaddi wrote: >> Although your loop is really the _canonical_ use case for >> >> for loopvar in range(initial_value, limit+1): >> processing >> if found_what_im_look

Re: Possible PEP - two dimensional arrays?

2016-06-07 Thread Rob Gaddi
eged > information or confidential information or both. If you are not the intended > recipient please delete it and notify the sender. You're looking for numpy. -- 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

Bulk Adding Methods Pythonically

2016-06-15 Thread Rob Gaddi
( reg = region, meas = p, chan = self.name ))) inner.__name__ = fnname inner.__doc__ = "Channel {} measurement".format(fnname) return inner setattr(Channel, fnname, measmaker(measparam)) -- Rob Gaddi, Highland Technology -- www.highlandtech

Re: Efficient handling of fast, real-time hex data

2016-05-31 Thread Rob Gaddi
sample. Are you going to be trying to use this data realtime, or are you just trying to datalog it and deal with it offline? Because at some point you'll need to decide, all in, how much data you're willing to try to hold in memory and what you intend to do with the rest of it. -- Rob Gaddi, Highlan

Re: Bulk Adding Methods Pythonically

2016-06-15 Thread Rob Gaddi
Random832 wrote: > On Wed, Jun 15, 2016, at 13:37, Rob Gaddi wrote: >> I've got a whole lot of methods I want to add to my Channel class, all >> of which following nearly the same form. The below code works, but >> having to do the for loop outside of the main class defini

Re: Bulk Adding Methods Pythonically

2016-06-21 Thread Rob Gaddi
Steven D'Aprano wrote: > On Thu, 16 Jun 2016 04:39 am, Rob Gaddi wrote: > >>> class Channel: >>> frequency = mkmeasure('frequency', 'FREQ') >>> falltime = mkmeasure('falltime', 'FTIM') >> >> Thought about it, but whenever I'm dropping 20-someodd of t

Re: Storing a big amount of path names

2016-02-12 Thread Rob Gaddi
Chris Angelico wrote: > Start by coding things in the > simple and obvious way, and then fix problems only when you see them. Is that statement available in 10 foot letters etched into stone? -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is current

Re: Storing a big amount of path names

2016-02-11 Thread Rob Gaddi
t's not worth doing. Now, if you do really have a million entries, one thing that would help with memory is setting __slots__ for MyFile rather than letting it create an instance dictionary for each one. -- 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: how to get python version ?

2016-01-28 Thread Rob Gaddi
ut if you're actually making that check it's because you've got a bunch of 2/3 compatibility crap you're having to work out; six will help will all of that too. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- htt

Re: common mistakes in this simple program

2016-02-29 Thread Rob Gaddi
nt wrong" or > the > equivalent without any accompanying context information. > > Cheers, > Cameron Simpson <c...@zip.com.au> Or, for that matter: logging.exception('something went wrong') Which gives you the whole traceback as well and doesn't require you to explictly grab the exception. -- 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: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-17 Thread Rob Gaddi
two dozen languages. None of them turn out correct code more quickly than Python; few even come close. -- 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: Reg: Data frame conversion

2016-02-17 Thread Rob Gaddi
Sushanth wrote: > ​i need to convert r data fr​ame to pandas dataframe and vise versa > Now, now, let's at least _try_ to help. http://lmgtfy.com/?q=convert+r+data+frame+to+pandas -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of

Re: error installing scipy on python 3.5, win 10 64 bit

2016-03-29 Thread Rob Gaddi
nversation. Think long and hard on it. -- 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: recursive methods require implementing a stack?

2016-04-06 Thread Rob Gaddi
ou have been badly misled. Python local variables are frame local, and recursion just works. -- 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: Python programs and relative imports

2016-04-08 Thread Rob Gaddi
Rob Gaddi wrote: > Does anyone know the history of why relative imports are only available > for packages and not for "programs"? It certainly complicates life. > Really, no one? It seems like a fairly obvious thing to have included; all of the reasons that you want to be

Re: Python programs and relative imports

2016-04-08 Thread Rob Gaddi
Chris Angelico wrote: > On Sat, Apr 9, 2016 at 2:59 AM, Rob Gaddi > <rgaddi@highlandtechnology.invalid> wrote: >> Rob Gaddi wrote: >> >>> Does anyone know the history of why relative imports are only available >>> for packages and not for

Re: empty clause of for loops

2016-03-21 Thread Rob Gaddi
e got a sequence in which you only care about the first hit, either because you only want one or because you know from everything else going on in the program there can only be one. for fn in self._containedfunctions: if fn.__doc__ is not None: self.__doc__ = fn.__doc__ break else:

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread Rob Gaddi
about half of the classes I write. I think I've needed __new__ all of twice in the years I've been writing Python. -- 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: A mistake which almost went me mad

2016-03-03 Thread Rob Gaddi
of modules there's a clear distinction of: import thingfromstdlib from . import thingfromlocal A bit of a nuisance at first, but once you get used to it everything just makes unambiguous sense. The problem is that this same distinction doesn't get made for "programs", only for "mod

Re: Continuing indentation

2016-03-03 Thread Rob Gaddi
on_action(); else { alternate action(); } But the principle remains. Syntactic whitespace has its ups and downs on the leading edge of the line, but at least it's visible there. On the trailing end of the line it's actively inviting trouble in for coffee and eggs. -- 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: Pythonic love

2016-03-07 Thread Rob Gaddi
start=1): will save you maintaining your own counter. But other than that, nah, that's pretty much the approach you're looking for. -- 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: breaking out of outer loops

2016-03-07 Thread Rob Gaddi
formedLineError(Exception): pass for line in file: try: for part in line.split('\t'): if thispartisbadforsomereason: raise MalformedLineError() otherwisewedothestuff except MalformedLineError: pass -- Rob Gaddi, Highland Technology -- www.h

Re: Drowning in a teacup?

2016-04-01 Thread Rob Gaddi
ing at a moving target. How about: newlist = ( [x for x in mylist if x.startswith(key)] + [x for x in mylist if not x.startswith(key)] ) return newlist Or if you really insist on mutating the original list (which seems less clean to me, but you do you), then: newlist = blahblahblah

Re: Strange range

2016-04-01 Thread Rob Gaddi
y point. All (well-behaved) iterators are iterables, with their __iter__ method returning themselves. for x in y: ... implies: try: _it = iter(y) while True: x = next(_it) ... except StopIteration: pass That's true for any iterable y, including a y which is itself an iterator.

Re: Help with python code

2016-03-29 Thread Rob Gaddi
> Howeve, it doesnt seem to be working. It doesnt calculate the bill. I dont > know what to do, as I'm less than average at this. > it comes up as IndexError: list index out of range at line42 > > Please help Don't know which one is line 42; but I'd bet your problem is there. As a rough guess, it might be the line that says: pizza_cost = pizzatype[menu] You're bounding that to the range 1-5. A Python list of length 5 has indices 0-4. But the error message is telling you everything you need to know; you're trying to get a list index that's out of range in line 42. Find line 42, figure out what index you're asking it for, and you'll have your answer. If you don't have an editor that shows you line numbers then your editor is fundamentally terrible and you should not use it (I personally like Notepad++ for Windows or Geany for Linux). -- 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: Help with python code

2016-03-29 Thread Rob Gaddi
actual values of variables that you're creating. Also, as a mailing list/Usenet etiquette note: You get to have one name you go by. Going around changing the name you're posting under in the middle of the thread is a guaranteed way to piss folks off. You didn't know. You now do. -- Rob Gaddi, Hi

Re: Threading is foobared?

2016-03-29 Thread Rob Gaddi
5.1459024715818.javamail.ya...@mail.yahoo.com> > Just read on Usenet instead of through the mailing list. That way you can accept broken threading as a given rather than wonder why it's happening in a particular case. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address dom

Re: Convert set to list

2016-03-31 Thread Rob Gaddi
list source code. print list(block['relative_chart1']['vessel_names']) should work. -- 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

Python programs and relative imports

2016-04-04 Thread Rob Gaddi
Does anyone know the history of why relative imports are only available for packages and not for "programs"? It certainly complicates life. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.

  1   2   3   >