Re: ANN: Python Job Board - Call for volunteers

2014-03-05 Thread James Mills
I'd like to volunteer! On Mar 5, 2014 7:13 PM, "M.-A. Lemburg" wrote: > [Please help spread the word by forwarding to other relevant mailing lists, > user groups, etc. world-wide; thanks :-)] > > Dear Python Community, > > for many years, the Python Job board ( > http://legacy.python.org/communi

Re: text to html

2011-12-14 Thread James Mills
On Dec 14, 3:30 am, Pedro Henrique Guedes Souto wrote: > On Tue, Dec 13, 2011 at 3:22 PM, prakash jp wrote: > > Want to publish a log file as a web page, is there a parser to retain the > > format of the text as is and then convert to html. Please provide the > > relevant pointers Hey Pedro,

Re: announcing: dmangame: an ai game. maybe.

2011-06-05 Thread James Mills
is really cool. I haven't looked at the source code yet... There was another game very similar to this - much more basic though and when I saw it back then I wanted to do something similar! Nice job! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http:/

Re: Programmer font

2011-06-05 Thread James Mills
On my desktop at home which runs CRUX (http://crux.nu) I use the Terminius (1) fonts which I installed myself. I find this font especially nice for both Terminals and Editing code. cheers James 1. http://terminus-font.sourceforge.net/ -- -- James Mills -- -- "Problems are solv

Re: Overuse of try/except/else?

2011-05-21 Thread James Mills
r calling it a LateFunction seems more "fitting" :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
are not very accessible. Funny you should mention this "now" :) I happen to be blind myself. Yes I agree Flash is not very accessible (never has been). Web Standards web apps and such however are quite accessible! cheers James -- -- James Mills -- -- "Problems are solved by method&

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
his, short of closed-source? As I mentioned before (which I don't think you quite got)... Write your "game" for the "web". Write is as a SaaS (Software as a Service) - even if it's free and open source. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
te all parts you want to hide in C/C++/Cython and > distribute them as .so/.dll Or you could do what everyone else is doing and provide your "application" as a service in some manner. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread James Mills
onyms. > 5. is there a way to find out if the thread is still active or dead? See: pydoc threading.Thread or help(threading.Thread) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Overuse of try/except/else?

2011-05-10 Thread James Mills
al stack trace Valid point :) However I was referring to real experience where I've seen code that "catches all any any exception" and simply logs it. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python backup programs?

2011-05-10 Thread James Mills
> or not? Recently I wrote a simple backup system for a client using a mixture of Python and Bash using rsync, ssh and pptp. (Not packaged well enough to show source though) It works very well and does the job. cheers James -- -- James Mills -- -- "Problems are solved by method"

Re: Overuse of try/except/else?

2011-05-09 Thread James Mills
is a dynamic programming language) but errors should be handled and caught by the caller - not the callee. My 2c, others may have other points of view... cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if a list is empty

2011-05-08 Thread James Mills
h the suggestion (even if it is "right"), perhaps keep that to yourself. if not my_list: is a perfectly valid and fine idiom to use in Python. If you prefer some other way, that's fine. Quite frankly I'm sick of seeing posts that argue for the sake of arguing. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access elemenst in a list of lists?

2011-05-08 Thread James Mills
ot; " for x in range(5)] for y in range(5)] >>> from pprint import pprint >>> pprint(grid) [[' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [&

Re: if statement multiple or

2011-05-06 Thread James Mills
problem You will need to (naively) do this: if "a" not in line or "b" not in line or "c" not in line: print line cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if a list is empty

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 4:36 PM, Jabba Laci wrote: > If I want to check if a list is empty, which is the more pythonic way? [...] > (2) if not li: This is fine. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: 回复: Re: BeautifulSoup import error

2011-05-05 Thread James Mills
On Fri, May 6, 2011 at 3:57 PM, Stefan Behnel wrote: > No. While this has been suggested, it will not become part of the stdlib in > the foreseeable future. It's readily available as a separate package on > PyPI, though. Opps I meant xml.etree :/ My bad! cheers James --

Re: BeautifulSoup import error

2011-05-05 Thread James Mills
n Python 2.x and Python 3.x - notably: except Exception, e: # Python 2.x except Exception as e: # Python 3.x I might suggest you take a look at using lxml instead which ships with the standard library. [ ... ] cheers James -- -- James Mills -- -- "Problems are solved by method" -

Re: [OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
I find the API provided to be quite simple robust and potentially very powerful - depending on your application. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

[OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
: a, b, = 1, 1 while n > 1: a, b = b, a + b n -= 1 return b #cloud.start_simulator() jobs = cloud.map(fib, range(100)) print [cloud.result(job) for job in jobs] Enjoy! :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://

Re: Running and killing a process in python

2011-05-03 Thread James Mills
which module is best suited to > do this? subprocess? Yes start with the subprocess module: http://docs.python.org/library/subprocess.html cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: importing class objects from a pickled file

2011-05-03 Thread James Mills
See: http://docs.python.org/library/pickle.html#the-pickle-protocol Any time you want to unpickle a user class, that class must be available. I suggest serializing to a more common format (say JSON) and re-create your class with the data. cheers James -- -- James Mills -- -- "Problem

Re: Composition instead of inheritance

2011-04-28 Thread James Mills
is typical of MixIns cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: meteclasses 2.x/3.x compatibility

2011-04-20 Thread James Mills
ttp://code.google.com/p/lepl/source/browse/src/lepl/matchers/matcher.py#40 I > have > >  _Matcher = ABCMeta('_Matcher', (object, ), {}) > > and then > >  class Matcher(_Matcher): >      ... Thank Andrew. I like this approach Elegance wins for me :) cheers James --

meteclasses 2.x/3.x compatibility

2011-04-19 Thread James Mills
Hi all, Is there a compatible way to use meteclasses in both Python 2.x (2.6 to 2.7) and Python 3.x (3.0 to 3.2). Python 2.x: class Foo(object): __meteclass__ = MyMetaClass Python 3.x: class Foo(metaclass=MyMetaClass): pass Thanks, cheers James -- -- James Mills -- -- "Problem

Re: IDLE bug

2011-04-18 Thread James Mills
On Tue, Apr 19, 2011 at 2:05 PM, harrismh777 wrote: > Are bug reports wanted here, or just in issue tracker? Pretty sure they're wanted in the Issue Tracker. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] working with strings in python3

2011-04-18 Thread James Mills
ngs. Use a a format specifier like this: > message = "Bah." > > if test: >   message = "%s %s" (message, " Humbug!") > > print(message) Python3 (afaik) also introduced the .format(...) method on strings. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-17 Thread James Mills
7;ve been over this! :) And you're a bit late... You said it yourself "If there is code after that snippet" cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
different groups in the first place (python-dev, python-core-mentoring, python-ideas, etc) so that there is a clear separation of "what's what". Can we stop arguing about this now ? cheers James > http://mail.python.org/mailman/listinfo/python-list > -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
week or month at least. Because he has better things to do ? LIke his job at Google ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
ady exists that fits your tastes. I doubt such a tool could be written either. The vim plugin I referenced earlier works nicely enough. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
d - I'm more interested in readability more than anything. I often use pyflakes in conjunction with pep8 to keep my own code clean, readable and consistent. Thanks for the suggestion! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, Ethan Furman wrote: > *Please* don't re-post his crap. Opps sorry :) I have never really known what to do with big-huge-long posts ? :) Won't happen again! cheers James -- -- James Mills -- -- "Problems are solved by method" --

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, James Mills wrote: > Does anyone know of a tool that will help with > reformatting badly written code to be pep8 compliant ? > > a 2to3 for pep8 ? In case there is no such tool (And I don't have the time to write one) I've found this to be

automated pep8 reformatter ?

2011-04-13 Thread James Mills
Does anyone know of a tool that will help with reformatting badly written code to be pep8 compliant ? a 2to3 for pep8 ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
2) Formalize a new design for xyz 3) File a bug report for xyz Complaining doesn't really get you very far, nor does berating others (even if indirectly). Whilst I agree that there are some folk who "might" be guilty of egotist / arrogant attitudes there isn't much anyone can do abou that - that's just part of life and part of social interaction(s). Get over it. For the most part - the Python Community as a whole is very helpful, positive and has a lot of nice thinigs about it (not just the language). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread James Mills
tter to make use of modules here as opposed to nesting classes. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
nt) but hey it's all in good fun until someone looses an eyeball! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [Bug / Feature Request] IDLE Shell

2011-04-12 Thread James Mills
get the latest IDLE source code, patch it, test it, see how you like it and if you feel it useful, share the patch and/or file a bug with the patch. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
preciate your comments. Thank you! Yes I do understand there is probably more code that follows the return? - but I made an assumption and I'm not going back on it :) Thanks for making the two sides obviously clear! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-12 Thread James Mills
the same today! Regardless of anyone's subjective opinions as to what was clear - I still stand by what I said. Nice comments btw Chris :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
heers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
reply. Have a nice day, cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
making assumptions about what the OP intended. Perhaps OPs should be more clear ? :) kid! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
deology. > be expanded to > >_temp = expr >if _temp: return _temp This could be simplified to just: return expr or None """ Please read carefully before putting words in my mouth. I stated very clear y that return? expr didn't seem fitting in the python

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
On Tue, Apr 12, 2011 at 12:18 PM, Jason Swails wrote: > This is only true if n < 5.  Otherwise, the first returns None and the > second returns False. Which is why I said: return expr or None But hey let's argue the point to death! cheers James -- -- James Mills -- -- "

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
ot;didn't find an answer") >  raise ValueError                     raise ValueError > > Are you saying the two snippets above are equivalent? def foo(n): x = n < 5 if x: return x is functionally equivalent to: def foo(n): return n < 5 -- -

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
ython ideology. > be expanded to > >    _temp = expr >    if _temp: return _temp This could be simplified to just: return expr or None And more to the point... If your calee is relying on the result of this function, just returning the evaluation of "expr" is enoug

Re: cx_Freeze 4.2.3

2011-03-31 Thread James Mills
ecognized cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing.Process Daemonic Behavior

2011-03-15 Thread James Mills
t process with the KILL signal then any child procesases that were created become zombies. You also can't handle the KILL signal in your application (nor can the multiprocessing library) and so it therefore cannot cleanup and terminate any child processes in the normal way. cheers James --

Re: attach to process by pid?

2011-03-10 Thread James Mills
On Fri, Mar 11, 2011 at 9:30 AM, Grant Edwards wrote: > No it doesn't.  Try writing something other than "foobar". You've demonstrated a case where this doesn't work :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-10 Thread James Mills
x27;s stdin (file descriptor of 0) Probably not a portable solution. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Defining class attributes + inheritance

2011-03-08 Thread James Mills
. def __init__(self, x, y): ... super().__init__(x) ... print("Hello %s" % y) ... >>> x = ExtendedBase("foo", "bar") Hello foo Hello bar >>> cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: attach to process by pid?

2011-03-08 Thread James Mills
'm missing something here I don't see how you could achieve communication with another process unless that process has some kind of communication(s) interface; eg: * some kind of listening socket * some kind of I/O (pipe, stdin/stdout) cheers James -- -- James Mills -- -- "Prob

Re: interrupted system call w/ Queue.get

2011-02-17 Thread James Mills
What causes the exception?  Is it necessary to catch this exception > and manually retry the Queue operation?  Thanks. Are you getting this when your application is shutdown ? I'm pretty sure you can safely ignore this exception and continue. cheers James -- -- James Mills -- -- "

Re: Extending classes __init__behavior for newbies

2011-02-15 Thread James Mills
ot;. Agreed, test-driven development tends to lend itself to higher quality code. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-14 Thread James Mills
he vast amount of time involved in a coding project should be > spent in the design and testing phases and NOT actually writing code. > If you spend more time writing code you are not being professional, > you are being sloppy -- and it WILL catch up to you. I actually agree with this. :) -

Re: Extending classes __init__behavior for newbies

2011-02-14 Thread James Mills
"understands" how to "correctly" use the API(s). If the programmer doesn't use the API(s) "correctly" f(...) will blow up in his/her face. g(...) will blow up as well but tries to guard against the expected TypeError you would expect if you called f(...) incorrectly. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
eed" was not a member of the OP's class ship. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
s's constructor directly and using the super type ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
constructor of the base class (Ship) gets called and the object initialized with the attributes you've defined. Note for convention reasons I've also included proper class names in the example. Classes normally start with an Upper case letter. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatic Parsing of ps

2011-02-10 Thread James Mills
out psutil (1) to see if it meets your needs ? cheers James 1. http://pypi.python.org/pypi/psutil/0.2.0 -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get and search a html file from a website

2011-02-01 Thread James Mills
tion with lxml to parse the html in a sensible way (instead of just doing: if "foo" in s) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine from a HTTP request if the user is on a Smart Phone, IE, Firefox

2011-01-31 Thread James Mills
nique User-Agent strings. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python metaclass and UML

2011-01-31 Thread James Mills
ts metaclass? Is there a standard for this? IHMO (but others may have other opinions) the same way you'd represent a decorated function. Metaclasses IHMO have the same effect as a decorated function - modifying another classes's behavior. cheers Jaes -- -- James Mills -- -- "Pr

Re: How can I define class methods outside of the class?

2010-12-01 Thread James Mills
smethod on %r" % cls class Foo(object): pass Foo.foo = foo cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: odd runtime error

2010-12-01 Thread James Mills
started" % os.getpid() if os.fork() == 0: print "doing stuff" sleep(5) print "done" raise SystemExit, 0 print "child %d exited with %d" % os.wait() if __name__ == "__main__": main() cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: To Thread or not to Thread....?

2010-12-01 Thread James Mills
erable latency for I2C operation, you can try > to run it as an OS thread, or a separate process (if running as a > separate process, make sure it cannot block while sending IO to the > master process). > > Regards > > Antoine. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to initialize each multithreading Pool worker with an individual value?

2010-11-30 Thread James Mills
the Pool object works and what it does with the initializer argument. I'm not entirely sure it does what you expect and yes documentation on this is lacking... cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching user switching and getting current active user from root on linux

2010-11-30 Thread James Mills
is a good idea and you could also make use of the following library: http://pypi.python.org/pypi?:action=search&term=utmp&submit=search cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: strange subprocess behavior when calling ps

2010-11-16 Thread James Mills
rrupt: >                print "Keyboard interrupt received -- terminating." >                sys.stdout.flush() >                sys.exit(-1) >        except: >                print "%s: unexpected error in generation of system process > list" % > pro

Re: Questions: While And List Comprehension

2010-11-11 Thread James Mills
bose ... But I like your simplification :) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
tter (using islice). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
stdin), 0, 5)] ? -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 1:02 PM, Steve Holden wrote: > This suggests that you are mistaken about not exhausting the source. Yeah I was mistaken. Oh well :) I was thinking of a generator-based solution and got lost in the implementation! -- -- James Mills -- -- "Problems are solved b

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 11:38 AM, MRAB wrote: > 'list' will exhaust the input, then the slicing will return at most 5 > lines. Hmm you're right :) -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
usr/bin/env python import sys print [v for v in list(line for line in sys.stdin)[:5]] This uses a generator expression to read from stdin, converts this to a list (only getting the first 5 items). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://ma

Re: Looping through files in a directory

2010-11-10 Thread James Mills
ousand times from a bash script. Any input or pointers to functions that'd > help would be very much appreciated. Thanks! os.walk or os.listdir cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
in.readlines()[:5]] cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Curses Programming

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 12:42 AM, alexander wrote: > Could any give a hand? Assignment ? Homework ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation too difficult for beginners

2010-11-02 Thread James Mills
cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: extracting variables accessed and written from function / rule-based function calls

2010-11-01 Thread James Mills
cheers James 1. http://pypi.python.org/pypi/Traits/3.5.0 -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: with block for multiple files

2010-10-31 Thread James Mills
On Mon, Nov 1, 2010 at 3:03 PM, Yingjie Lan wrote: > with open('scores.csv'), open('grades.csv', wt) as f,g: >     g.write(f.read()) One could write their own ContextManager here... cheers James -- -- James Mills -- -- "Problems are solved by method"

Re: [Beginer Question] I heard about python needing some sort of_VariableName_ boiler plate?

2010-10-31 Thread James Mills
To define variables, just assign a value to a name: >>> x = 1 >>> x 1 cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:39 AM, James Mills wrote: > Function/Method Chaining is probably used a lot in Python itself: > >>>> x = 4 >>>> x.__add__(1).__sub__(3) > 2 > > The implementation of many common operators return self (the object > you're wo

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 12:49 PM, Steven D'Aprano wrote: > ...if you're writing x.__add__(1).__sub__(3) instead of x + 1 - 3 then > you're almost certainly doing it wrong. It was just an example :) ... And this isn't python-tutor --James -- -- James Mills -- -- &quo

Re: How do I chain methods?

2010-10-24 Thread James Mills
d__(1).__sub__(3) 2 The implementation of many common operators return self (the object you're working with). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:02 AM, Chris Rebert wrote: > Method chaining is usually* not idiomatic in Python. I don't agree but anyway... I've just not seen it commonly used amongst python programmers. cheers James -- -- James Mills -- -- "Problems are solved b

Re: How do I chain methods?

2010-10-24 Thread James Mills
>> x = Foo() >>> y = x.first() Chad >>> y.last() A <__main__.Foo object at 0x1011d7ad0> >>> NB: You must return "self" in this case so you can do chained calls. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: how to scrutch a dict()

2010-10-20 Thread James Mills
t if the Value is None". > > Are there any tighter or smarmier ways to do that? Python does so > often manage maps better than that... Rather than creating a new dict why don't you just do: def _scrunch(d): for k, v in d.items(): if v is None: del d[k] cheer

Re: Filename for stdout

2010-10-20 Thread James Mills
When you do: $ ./foo > /tmp/foobar You're telling your shell to write the stdout output of foo to the file /tmp/foobar sys.stdout won't actually tell you anything useful. It's normally just a file descriptor. cheers James -- -- James Mills -- -- "Problems are solved by

Re: merge list of tuples with list

2010-10-19 Thread James Mills
nt. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: merge list of tuples with list

2010-10-19 Thread James Mills
gt; a = [(1,2,3,7), (4,5,6)] What happens with the 8 in the 2nd tuple b ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread James Mills
On Tue, Oct 19, 2010 at 1:37 PM, alex23 wrote: > Given that there's little if anything gained from nesting classes > (other than possible scoping confusion) is there ever a need? 15+ years of programming and I've never used nested classes in any language :) cheers James --

Re: Is there any module for automated testing in python?

2010-10-15 Thread James Mills
On Fri, Oct 15, 2010 at 8:19 PM, gopi krishna wrote: > Hi, > Is there any module for automated testing in python? > Pls help me frns.. py.test is quite nice and I use it for my own project(s). The company I work for also uses it to test their software. cheers James -- -- Ja

Re: help!!!

2010-10-05 Thread James Mills
ch you valuable lessons. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into a list

2010-10-04 Thread James Mills
7;,..,'n']" (values are not sequential) > > What would be the best way to do this? I don't want to use eval, as the > string is coming from an untrusted source. If you trust the source of the data the following is probably the simplest: >>> s = "[

Re: equivalent of bash "set -x" in Python

2010-09-26 Thread James Mills
mean by "command" ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Error installing cx_Oracle

2010-09-22 Thread James Mills
t; lib/python2.6/pycc' failed with exit status 1 > r...@access1:/$ > > I have searched for a solution everywhere and tried many things but > didn't work. Can somebody help me in this? Install the python development libraries. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: The trouble with "dynamic attributes".

2010-09-16 Thread James Mills
ailing list. Check your subscription status with the link below. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   >