Re: Most gratuitous comments

2014-12-04 Thread Rob Gaddi
r&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst > In my code, I habitually use big old bar comments to break the imports into three sections, standard library, third-party libraries, and local imports. I find it radically 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

Re: Comparisons and sorting of a numeric class....

2015-01-15 Thread Rob Gaddi
ef __and__(self, other): return self.__class__( min(self.value, other.value), self.threshold) def __or__(self, other): return self.__class__( max(self.value, other.value),

Re: Is there a more elegant way to spell this?

2015-01-27 Thread Rob Gaddi
if some_predicate: > 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.highlandtechno

Re: pymongo and attribute dictionaries

2015-02-04 Thread Rob Gaddi
u like, a utility function wrapping the same. > > 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

Re: Monte Carlo probability calculation in Python

2015-02-05 Thread Rob Gaddi
e your problem; you don't do a thing a thousand times; you do it on a thousand-length array. For example: def dice(throws, per, sides=6): """Return an array throws long of rolls of (per)d(sides).""" all_dice = np.random.randint(1, sides+1, size=(throws, per)) return all_dice.sum(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: 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;

Setuptools, __init__ and __main__

2015-02-06 Thread Rob Gaddi
ld go stumbling around until I come 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 writes: >> >>> So I'm trying to wrap my head around packaging issues >> >> Congratulations on tackling this. You will likely find

Re: __next__ and StopIteration

2015-02-09 Thread Rob Gaddi
xtremely equivalent and a matter of personal taste (I'd probably opt for the yield one myself). -- 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 & Peewee Query Example Needed

2015-02-17 Thread Rob Gaddi
atetime.timedelta(days=int(day_count)) return cls.select().where(cls.created >= 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: Best practice: Sharing object between different objects

2015-02-23 Thread Rob Gaddi
#x27;d bother. If you did, you could make the getSMBus code a classmethod just to make clear the lack of dependency on individual instances, but that starts 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: Running a command line program and reading the result as it runs

2013-08-22 Thread Rob Wolfe
can read more details here (description of method ``next``): http://docs.python.org/lib/bltin-file-objects.html So basically non-blocking loop might look like this: while True: line = p.stdout.readline() if not line: break print line HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Rob Day
On 08/10/13 07:17, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) print("imploring epsilon decamp graveyard's") # Chose

Re: OT: looking for best solutions for tracking projects and skills

2013-10-12 Thread Rob Clewley
u might be able to track static info like skills. -Rob On Fri, Oct 11, 2013 at 11:09 PM, Jason Hsu wrote: > I realize this is off-topic, but I'm not sure what forum is best for asking > about this. I figure that at least a few of you are involved in civic > hacking groups. >

Matplotlib and cx_Freeze

2015-03-09 Thread Rob Gaddi
exe.linux-x86_64-3.4/mpl-data Matplotlib data folder: /usr/share/matplotlib/mpl-data It recognizes that I've set the datapath, but it still will only use the global system directory, thus defeating the point 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: Regex Python Help

2015-03-24 Thread Rob Gaddi
Python, but want to use 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

Re: Regex Python Help

2015-03-24 Thread Rob Gaddi
ch for. You can do 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: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Rob Gaddi
our function was called incorrectly, and you're kicking the responsibility for dealing with it back to the guy who got it wrong. def my_fun(): if invalid_argument_combination: raise ValueError('Hey jerk, read the documentation.') # otherwise you do your thing in

Setuptools Confusion

2015-03-30 Thread Rob Gaddi
ptools to do additional tasks at appropriate times? 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: 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, Hi

Re: New to Python - block grouping (spaces)

2015-04-16 Thread Rob Gaddi
ind the answer to my >> question. > > Kudos 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

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-21 Thread Rob Gaddi
hing or not) just each be responsible for writing out their own figures 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.

Is there existing code to log-with-bells-on for runtime algorithm diagnostics?

2015-04-21 Thread Rob Clewley
the logger's. It's not super hard for me to write my own thing here, but I'm wondering if anyone has come across any existing solutions in this vein, or has any advice before I go further in designing a solution? I can't really believe that no-one has attempted this before, but i

Re: [SciPy-User] Is there existing code to log-with-bells-on for runtime algorithm diagnostics?

2015-04-21 Thread Rob Clewley
All of these ideas and links are very helpful, thank you! -Rob -- https://mail.python.org/mailman/listinfo/python-list

Re: l = range(int(1E9))

2015-04-30 Thread Rob Gaddi
Given that you really are just starting to get your Python feet under you, why are you using Python2? Python3 is the standard now, Python2 is really just given legacy support. I'd understand if you were trying to maintain an old codebase with lots of legacy code that was having "prob

Re: [SciPy-User] Is there existing code to log-with-bells-on for runtime algorithm diagnostics?

2015-05-06 Thread Rob Clewley
Just to follow up on this thread, for interested readers' future reference... On Tue, Apr 21, 2015 at 4:22 PM, Robert Kern wrote: > On Tue, Apr 21, 2015 at 8:02 PM, Rob Clewley wrote: >> In fact, I'm trying to build a general purpose tool for exploring the >> in

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
t O(n) pace through a linked list of collision candidates. A firm grasp of C will make you a better programmer in any language, even if you 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 b

Updating a package on PyPi, testing and etiquette

2015-05-12 Thread Rob Gaddi
th older versions of Python. I've 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.

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 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

Re: How to use an iterator?

2015-06-01 Thread Rob Gaddi
of course turn this on its head and ask for for n, xc in zip(count(0), someotheriterable): print(n, xc) And use your count infinite iterator to enumerate the (hopefully finite) elements of someotheriterable. This is common enough that the built-in enumerate function does exactly that. Make sens

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 G

Re: Need assistance

2015-07-17 Thread Rob Gaddi
ut 5 minutes. 2) https://docs.python.org/3/library/stdtypes.html#string-methods You can do what you're trying to do, but you're swinging a hammer with a powered nailgun at your feet. Search is an inefficient way to try to split a string into parts based on a delimiter. --

Re: register cleanup handler

2015-07-24 Thread Rob Gaddi
do_something_else >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()

Re: Python Questions - July 25, 2015

2015-07-27 Thread Rob Gaddi
could try skipping the earlier 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: Python Questions - July 25, 2015

2015-07-28 Thread Rob Gaddi
iven that it's mostly a bunch of C code. > > Perhaps they were just padding the list to make it look more impressive. It underpins the ctypes implementation, which is neither here nor there. If I remember right, numpy does dynamic loading of one of a couple different (FORTRAN?) alg

Re: Python Developer- [LOCATION DELETED]

2015-08-21 Thread Rob Gaddi
expected hourly rate to my email id [email protected] 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 addr

isinstance() and multiple inheritance/ctypes

2015-08-26 Thread Rob Gaddi
that ctypes classes 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,

Re: isinstance() and multiple inheritance/ctypes

2015-08-26 Thread Rob Gaddi
bclass of bitfield. > >>>> isinstance(bf,type) > True >>>> isinstance(bf(),bitfield.Bitfield) > True >>>> issubclass(bf,bitfield.Bitfield) > True > Yep, you're quite right. bf is a subclass, not an instance, hence issubclass

Reading \n unescaped from a file

2015-09-02 Thread Rob Hills
y '\r' character is "escaped" to '\\r' and the '\\n' to 'n' when they are read in from the file. I've been googling hard and reading the Python docs, trying to get my head around character encoding, but I just can't figure out how to get these bits of code to do what I want. It seems to me that I need to either: * change the way I represent '\r' and '\\n' in my mapping file; or * transform them somehow when I read them in However, I haven't figured out how to do either of these. TIA, -- Rob Hills Waikiki, Western Australia -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading \n unescaped from a file

2015-09-03 Thread Rob Hills
Hi Friedrich, On 03/09/15 16:40, Friedrich Rentsch wrote: > > On 09/02/2015 04:03 AM, Rob Hills wrote: >> Hi, >> >> I am developing code (Python 3.4) that transforms text data from one >> format to another. >> >> As part of the process, I had a set of har

Re: Reading \n unescaped from a file

2015-09-03 Thread Rob Hills
Hi Chris, On 03/09/15 06:10, Chris Angelico wrote: > On Wed, Sep 2, 2015 at 12:03 PM, Rob Hills > wrote: >> My mapping file contents look like this: >> >> \r = \\n >> “ = " > Oh, lovely. Code page 1252 when you're expecting UTF-8. Sadly, you'

Re: Reading \n unescaped from a file

2015-09-03 Thread Rob Hills
Hi, On 03/09/15 06:31, MRAB wrote: > On 2015-09-02 03:03, Rob Hills wrote: >> I am developing code (Python 3.4) that transforms text data from one >> format to another. >> >> As part of the process, I had a set of hard-coded str.replace(...) >> functions that I u

Re: Need Help w. PIP!

2015-09-04 Thread Rob Hills
of your problem (ie the "C:\Python34\Scripts;" part won't be accessible. Perhaps try deleting the "C:\Python34\python.exe;" entry from your PATH environment variable and see what happens. HTH, -- Rob Hills Waikiki, Western Australia -- https://mail.python.org/mailman/listinfo/python-list

Re: Need Help w. PIP!

2015-09-04 Thread Rob Hills
On 05/09/15 08:55, MRAB wrote: > On 2015-09-05 01:35, Rob Hills wrote: >> On 05/09/15 01:47, Cody Piersall wrote: >>> > On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus >>> mailto:[email protected]>> wrote: >>> >> <..> >>>

Re: Check if a given value is out of certain range

2015-09-29 Thread Rob Gaddi
eck 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
” Now they have two problems.' 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 happie

Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-02 Thread Rob Gaddi
, who do I 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 -, Rob Gaddi writes: >>>So, this is odd. I'm running Ubuntu 14.04, and my system did a ker

Re: Pyserial and Ubuntu Linux kernel 3.13.0-65-generic

2015-10-06 Thread Rob Gaddi
driver 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.highlandtechno

Re: What meaning is of '#!python'?

2015-11-14 Thread Rob Hills
the script from the command line without having to preface it with a reference to your Python executable. Eg: my-script.py versus python my-script.py HTH, -- Rob Hills Waikiki, Western Australia -- https://mail.python.org/mailman/listinfo/python-list

Re: Help on savefig parameters

2015-11-17 Thread Rob Gaddi
umentation is the one that actually matters. Prefer the web documentation 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: How can I export data from a website and write the contents to a text file?

2015-11-18 Thread Rob Gaddi
e "open it as a regular text file". On my Windows 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

Re: error help import random

2015-11-20 Thread Rob Gaddi
x27;, 'horny', 'messy', 'sad', 'lool', 'buggy') i = random.randrange(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: initializing "parameters" class in Python only once?

2014-07-14 Thread Rob Gaddi
here. You can just create params.py, fill it with statements that are either hard-coded or calculated as necessary, 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 rath

Re: Exploring Python for next desktop GUI Project

2014-07-24 Thread Rob Gaddi
re and more 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 -- w

Re: Making every no-arg method a property?

2014-08-05 Thread Rob Gaddi
Also, you'd eliminate the ability 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. -- R

Re: Making every no-arg method a property?

2014-08-06 Thread Rob Gaddi
to buy some options... > > -- > Grant > 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 G

Re: Begginer in python trying to load a .dll

2014-08-12 Thread Rob Gaddi
rams = (1, "p1", 0), (1, "p2", 0), (1, "p3",0), (1, "p4",0), > > > hllApi = hllApiProto (("HLLAPI", hllDll), hllApiParams) > > p1 = ctypes.c_int (1) > p2 = ctypes.c_char_p (sessionVar) > p3 = ctypes.c_int

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

2014-08-12 Thread Rob Gaddi
>>>htmlfile = urllib.urlopen("http://www.racingpost.com/horses2/cards/card.sd? > > >>>race_id=600048r_date=2014-05-08#raceTabs=sc_") > >>>htmltext = htmlfile.read() > >>>regex = '' > >>>pattern = re.compile(regex) > >>>odds=re.findall(pattern,htmltext) > >>&

Re: Captcha identify

2014-08-13 Thread Rob Gaddi
g 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.highland

Logging multiple formats to the same file

2014-08-15 Thread Rob Gaddi
f.normal.format(record) ... logging.getLogger('BANNER').critical('Starting program.') -- 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
time. And yet 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
ible with Windows so 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 G

Re: Raspberry pi, python and robotics

2014-09-02 Thread Rob Gaddi
the circuits. Plan on it taking a solid year before you become "good" at it; you're young and have 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, Highlan

Re: Python is going to be hard

2014-09-03 Thread Rob Gaddi
steve' sweeps x over the sequential _values_ 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
/ time through the loop 'x' is the first item in the list. > > The /second/ time through the loop 'x' is the second item in the list. > > The /third/ time through the loop 'x' is the third item in the list. > > . . . > > Keep persisting! >

Re: "Fuzzy" Counter?

2014-09-23 Thread Rob Gaddi
into the same bin. If however you put 1.9 into that bin first, then 2.0 would 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 Techno

Re: "Fuzzy" Counter?

2014-09-26 Thread Rob Gaddi
On Tue, 23 Sep 2014 22:01:51 -0700 (PDT) Miki Tebeka 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 his

Re: "Fuzzy" Counter?

2014-09-26 Thread Rob Gaddi
On Fri, 26 Sep 2014 15:10:43 -0400 [email protected] 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 > >

Re: while loop - multiple condition

2014-10-13 Thread Rob Gaddi
positive logic flavor 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 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

What replaces log4py under Python 3.2?

2011-11-22 Thread Rob Richardson
Greetings! My company has been using the log4py library for a long time. A co-worker recently installed Python 3.2, and log4py will no longer compile. (OK, I know that's the wrong word, but you know what I mean.) What logging package should be used now? Thank you. RobR -- http://mail.pyth

RE: What replaces log4py under Python 3.2?

2011-11-23 Thread Rob Richardson
n.org [mailto:[email protected]] On Behalf Of Irmen de Jong Sent: Tuesday, November 22, 2011 2:41 PM To: [email protected] Subject: Re: What replaces log4py under Python 3.2? On 22-11-11 19:32, Rob Richardson wrote: > Greetings! > > My company has

Re: Checking for valid date input and convert appropriately

2013-02-21 Thread rob . marshall17
The datetime function: strptime() DOES check the date for validity. So try something like: from datetime import datetime def get_date(): while True: try: date_in = raw_input("Enter date (dd mm ): ") date_out = datetime.strptime(date_in,"%d %m %Y").strftime("%Y-%m-%d")

Re: Can I Import table from txt file into form letter using Python?

2013-02-21 Thread rob . marshall17
o/Cities.txt'). The city names need to be <= 25 characters in length and the numbers <= 15 characters in length including commas but that would give you a number that is bigger than any city I know of :-) You can adjust the column sizes as you wish and print the rest of the letter formatted around the cities. Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: need for help

2013-03-01 Thread Rob Day
It looks like you're using single underscores, not double: the methods should be __init__ and __str__. On 1 March 2013 18:35, leonardo selmi wrote: > hi guys > > i typed the following program: > > class ball: > def _init_(self, color, size, direction): > self.color = color > s

Re: Required arguments in argparse: at least one of a group

2013-03-23 Thread Rob Day
I don't know about argparse, but if you use docopt (http://docopt.org/) then this is easy to do with something like: """Usage: finder.py --file --dir finder.py --pattern --dir finder.py --file --pattern --dir """ On 23 March 2013 16:04, Marco wrote: > Is there the possibility using the a

Re: Strange files??

2013-04-10 Thread Rob Day
On Wednesday 10 Apr 2013 14:16:23 Joe Hill wrote: > Recently I installed Python 3.3 successfully. > > Yesterday - I have a bunch of PY files such as thesaurus.py, some *.p7s > files, some signature files and an index.fpickle. A total of 23 files. > > Where do they come from and how do they end u

shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
Using Python 2.7.2 on OSX, I have created a file in temp space, then use the function "shutil.copyfile(fn,loc+fname)" from "fn" to "loc+fname". At the destination location, the file is truncated. About 10% of the file is lost. Original file is unchanged. I added calls to "statinfo" immediately

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
Thanks. Yes, there is a close function call before the copy is launched. No other writes. Does Python wait for file close command to complete before proceeding? -- http://mail.python.org/mailman/listinfo/python-list

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
> The close method is defined and flushing and closing a file, so > > it should not return until that's done. > > > > What command are you using to create the temp file? > > re command to write the file: f=open(fn,'w') ... then create HTML text in a string f.write(html) f.close -- http:/

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
> I would consider the chance that the disk may be faulty, or the file > > system is corrupt. Does the problem go away if you write to a different > > file system or a different disk? > It's a relatively new MacBook Pro with a solid state disk. I've not noticed any other disk problems. I di

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
> > > Or that the filesystem may be full? Of course, that's usually obvious > > > more widely when it happens... > > > > > > Question: is the size of the incomplete file a round number? (Like > > > a multiple of a decent sized power of 2>) > > > > Also on what OS X file system type does t

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
> The file system is Mac OS Extended Journaled (default as out of the box). I ran a repair disk .. .while it found and fixed what it called "minor" problems, it did something. However, the repair did not fix the problem. I just ran the program again and the source is 47,970 bytes and target af

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 09:26:21 UTC+1, Cameron Simpson wrote: > > | > > Question: is the size of the incomplete file a round number? (Like > > | > > a multiple of a decent sized power of 2>) > > [...] > > | Source (correct one) is 47,970 bytes. Target after copy of 45,056 > > | bytes. I've

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 10:22:21 UTC+1, Chris Angelico wrote: > On Fri, Apr 12, 2013 at 7:18 PM, Rob Schneider wrote: > > > f.close > > > > Yep, there's the problem! See my previous post for details. Change this to: > > > > f.cl

Invoking Unix commands from a Python app

2005-12-16 Thread Rob Cowie
#x27;t yet invesitgated it. My question is, can a command line application be invoked by a python program? If so, how does one pass parameters to it and retrieve its response? Cheers and Merry Christmas, Rob Cowie -- http://mail.python.org/mailman/listinfo/python-list

Re: Invoking Unix commands from a Python app

2005-12-16 Thread Rob Cowie
Ok, I know see that os.spawnl() will suffice. However, how do I retrieve the output of the command. For example, import os os.spawnl(os.P_WAIT, '/bin/date') Successfully executes the 'date' app, but I am unaware of how to get its output -- http://mail.python.org/mailman/listinfo/python-lis

Re: Invoking Unix commands from a Python app

2005-12-16 Thread Rob Cowie
Excellent... just the thing I was looking for. Thanks. Does anyone know of a unix app that could be used to monitor the duration of processes etc.? Would 'top' do the trick? Rob C -- http://mail.python.org/mailman/listinfo/python-list

Using CGI to interface with an XML-RPC server

2006-01-17 Thread Rob Cowie
Hi all, Assume I have a working XML-RPC server that runs persistently and correctly accepts remote calls, executes the relevant code and outputs the XML-RPC result. This is fine when using an XML-RPC client. However, I wish to provide a web user interface. I gather it is possible to use PHP as an

Re: chi-squared tests in python?

2006-01-17 Thread Rob Cowie
>> Matthew >> ps: given the "batteries included" philosphy, there's a remarkable dearth >> of stats in python... >I think Chi^2 tests fall distinctly in the "third-party library" category, >>myself. I don't know... I've often thought the Standard Library should include a stats package. -- http

Re: Using CGI to interface with an XML-RPC server

2006-01-18 Thread Rob Cowie
Please? I really could do with some help! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using CGI to interface with an XML-RPC server

2006-01-18 Thread Rob Cowie
>Python ships with cgi and xmlrpc support (cgi and xmlrpclib, respectively), >so I'm not sure why you even think you have to ask... >1. use cgi to parse form data >2. use xmlrpclib to issue request >3. use print or your favourite html templating library to generate >output > >(it mi

Re: Tix Tree open/close issue

2006-07-13 Thread Rob Williscroft
) > > > will show the whole tree, but will set correctly the > (+) and (-) boxes. (The commented out statements where > in place before direct calls to Tk - same result). > > I was hoping to have some branches hidden (the leaves, > in this case). My solution above make an

Re: What is a type error?

2006-07-13 Thread Rob Warnock
into toy values ('fall','book','Glory Road'); INSERT 32785 1 rpw3=# select oid, * from toy where oid = 32785; oid | c1 | c2 | c3 | upd ---+--+--++- 32785 | fall | book | Glory Road |

Re: What is a type error?

2006-07-17 Thread Rob Warnock
/* Common Lisp's CONS */ and DELETE is just: ROW *p = find_if(predicate_function, database); /* CL's FIND-IF */ database = delete(p, database); /* CL's DELETE */ free(p); [There are single-pass methods, of course, but...] -Rob

Re: using names before they're defined

2006-07-19 Thread Rob Williscroft
ome other objects constructor. IOW the second line of the OP's code would effectively be: compressor = Compressor(downstream=None, upstream=supply) Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Rob Williscroft
rk like that. The partial classes are used by GUI designer tools (Visual Studio[1] and SharpDevelop[2] for example) to seperate code that the tool generates from code (event handlers etc) that the programmer writes. IOW hopefully both parts of the class have GUI code in them. [1] http://m

Re: building lists of dictionaries

2006-07-23 Thread Rob Williscroft
d be 1 and 50. respectively > > This is not so! > I end up with all dictionaries being identical and having their > 'fixed' key set to 1, and limited[0]==1 and limits[0]==50. > > I do not understand this behaviour... This should help: http://www.python.org/doc/

PySNMP Thread unsafe?

2006-07-24 Thread rob . audenaerde
I'm trying to monitor about 250 devices with SNMP, using PySNMP version 4. I use the threading.Thread to create a threadpool of 10 threads, so devices not responding won't slow down the monitoring process too much. Here comes my problem. When using PySNMP single threaded, every this goes well; bu

<    1   2   3   4   5   6   7   8   9   10   >