[ANN]: circuits 3.2 (Bug Fix Release)

2016-06-02 Thread James Mills
Github org: https://github.com/circuits cheers James James Mills / prologic E: prolo...@shortcircuit.net.au W: prologic.shortcircuit.net.au -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

[ANN]: hipachectl 0.0.1 - CLI tool to manage hipache

2014-11-01 Thread James Mills
! cheers James James Mills / prologic E: prolo...@shortcircuit.net.au W: prologic.shortcircuit.net.au -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

[ANN]: circuits 3.0 (Lightweight Event driven Asynchronous Application Framework)

2014-08-31 Thread James Mills
://circuits.readthedocs.org/en/latest/changes.html [2]: http://circuits.readthedocs.org James Mills / prologic E: prolo...@shortcircuit.net.au W: prologic.shortcircuit.net.au -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation

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 m...@python.org 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 (

[ANN]: circuits 2.1.0 [] (Lightweight Event driven Asynchronous Application Framework)

2013-02-27 Thread James Mills
examples. - Component Interface querying. For more information see the PyPi page: pypi.python.org/pypi/circuits/ cheers James James Mills / prologic E: prolo...@shortcircuit.net.au W: prologic.shortcircuit.net.au -- http://mail.python.org/mailman/listinfo/python-announce-list Support

[ANN]: circuits 2.0.0 [cheetah] (Lightweight Event driven Asynchronous Application Framework)

2012-11-24 Thread James Mills
/wait synchronous primitives. * Simplified API for Eventing and Channel targeting. * Many more bug fixes and test coverage. For more information see the PyPi page: pypi.python.org/pypi/circuits/ cheers James James Mills / prologic E: prolo...@shortcircuit.net.au W: prologic.shortcircuit.net.au

Re: text to html

2011-12-14 Thread James Mills
On Dec 14, 3:30 am, Pedro Henrique Guedes Souto pedro.h.so...@gmail.com wrote: On Tue, Dec 13, 2011 at 3:22 PM, prakash jp prakash.st...@gmail.com 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

[ANN]: circuits 1.6 [oceans] (Lightweight Event driven Asynchronous Application Framework)

2011-06-27 Thread James Mills
easy-to-use core functionality with a synchronous-like API on top of circuits. This release also includes a number of minor bug fixes and greater test coverage. For more information see the PyPi page: pypi.python.org/pypi/circuits/ cheers James James Mills / prologic Developer | circuits

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

2011-06-06 Thread James Mills
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://mail.python.org/mailman

Re: Programmer font

2011-06-05 Thread James Mills
gap. 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 solved by method

Re: Overuse of try/except/else?

2011-05-21 Thread James Mills
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-16 Thread James Mills
-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

Re: obviscating python code for distribution

2011-05-16 Thread James Mills
. 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 -- http://mail.python.org/mailman/listinfo

Re: obviscating python code for distribution

2011-05-15 Thread James Mills
write 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

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread James Mills
. They are synonyms. 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: 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 -- http://mail.python.org

Re: Overuse of try/except/else?

2011-05-10 Thread James Mills
:) 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: 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: How to access elemenst in a list of lists?

2011-05-08 Thread James Mills
) [[' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ']] grid[2][2] = X pprint(grid) [[' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', 'X', ' ', ' '], [' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ']] cheers James -- -- James Mills -- -- Problems

Re: checking if a list is empty

2011-05-08 Thread James Mills
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: 回复: Re: BeautifulSoup import error

2011-05-06 Thread James Mills
-- -- 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 jabba.l...@gmail.com 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

Re: if statement multiple or

2011-05-06 Thread James Mills
) 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: BeautifulSoup import error

2011-05-05 Thread James Mills
- 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 -- http://mail.python.org/mailman/listinfo

[OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
, = 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://mail.python.org/mailman

Re: [OT]: PiCloud - really cool!

2011-05-04 Thread James Mills
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

Re: importing class objects from a pickled file

2011-05-03 Thread James Mills
/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 -- -- Problems are solved by method -- http

Re: Running and killing a process in python

2011-05-03 Thread James Mills
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: Composition instead of inheritance

2011-04-28 Thread James Mills
that this 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
/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 -- -- James Mills -- -- Problems are solved by method -- http

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

Re: [Tutor] working with strings in python3

2011-04-18 Thread James Mills
. 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: IDLE bug

2011-04-18 Thread James Mills
On Tue, Apr 19, 2011 at 2:05 PM, harrismh777 harrismh...@charter.net 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

Re: Feature suggestion -- return if true

2011-04-17 Thread James Mills
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: Nested inner classes and inheritance - namespace problem

2011-04-13 Thread James Mills
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: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
the language). cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list

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: automated pep8 reformatter ?

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, James Mills prolo...@shortcircuit.net.au 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

Re: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
On Thu, Apr 14, 2011 at 11:47 AM, Ethan Furman et...@stoneleaf.us 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 -- http

Re: automated pep8 reformatter ?

2011-04-13 Thread James Mills
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: automated pep8 reformatter ?

2011-04-13 Thread James Mills
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: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
a 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: Egos, heartlessness, and limitations

2011-04-13 Thread James Mills
-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: Feature suggestion -- return if true

2011-04-12 Thread James Mills
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
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-12 Thread James Mills
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: [Bug / Feature Request] IDLE Shell

2011-04-12 Thread James Mills
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
fun until someone looses an eyeball! 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
python 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 enough. cheers James -- -- James Mills

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
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 -- -- James Mills -- -- Problems are solved by method -- http

Re: Feature suggestion -- return if true

2011-04-11 Thread James Mills
On Tue, Apr 12, 2011 at 12:18 PM, Jason Swails jason.swa...@gmail.com 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
-- -- 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
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
James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list

Re: cx_Freeze 4.2.3

2011-03-31 Thread James Mills
-managed not recognized 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
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
solution. 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
On Fri, Mar 11, 2011 at 9:30 AM, Grant Edwards invalid@invalid.invalid 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

Re: attach to process by pid?

2011-03-08 Thread James Mills
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 -- -- Problems are solved by method

Re: Defining class attributes + inheritance

2011-03-08 Thread James Mills
) ... 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

[ANN]: circuits-1.5 (Lightweight Event driven Asynchronous Application Framework)

2011-02-27 Thread James Mills
and greater test coverage. For more information see the PyPi page: http://pypi.python.org/pypi/circuits/1.5 cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation

Re: interrupted system call w/ Queue.get

2011-02-17 Thread James Mills
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 -- -- Problems are solved by method

Re: Extending classes __init__behavior for newbies

2011-02-15 Thread James Mills
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
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-14 Thread James Mills
-- -- 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
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: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
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
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: Programmatic Parsing of ps

2011-02-10 Thread James Mills
) 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

ANN: circuits-1.3.3 (Asynchronous Component-based Application Framework)

2011-02-05 Thread James Mills
groups http://groups.google.com/group/circuits-users or on the #circuits IRC Channel on the FreeNode IRC Network. cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation

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

2011-02-01 Thread James Mills
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

[ANN]: circuits-1.3.1

2011-01-31 Thread James Mills
the examples: https://bitbucket.org/prologic/circuits/src/1.3.1/examples/ Please give us feedback on the circuits-users groups http://groups.google.com/group/circuits-users or on the #circuits IRC Channel on the FreeNode IRC Network. cheers James -- -- James Mills -- -- Problems are solved by method

[ANN]: sahriswiki 0.8

2011-01-31 Thread James Mills
it from PyPi: http://pypi.python.org/pypi/sahriswiki/0.8 Following it's development at: https://bitbucket.org/prologic/sahriswiki/overview cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python

Re: Python metaclass and UML

2011-01-31 Thread James Mills
and its 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 -- -- Problems

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

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

[ANN]: circuits 1.3

2011-01-25 Thread James Mills
release) the transition isn't very steep as most things are the same just better :) Please see http://pypi.python.org/pypi/circuits/ for more details and the bitbucket home page http://bitbucket.org/prologic/circuits/ I plan to release more often so see you again! cheers James -- -- James Mills

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

2010-12-01 Thread James Mills
-- -- 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
-- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list

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

2010-12-01 Thread James Mills
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: Catching user switching and getting current active user from root on linux

2010-11-30 Thread James Mills
. This is a good idea and you could also make use of the following library: http://pypi.python.org/pypi?:action=searchterm=utmpsubmit=search cheers James -- -- 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
on this is lacking... 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
) main() Roger, why not use the nicely written and documented psutil module ? http://pypi.python.org/pypi/psutil/0.2.0 http://code.google.com/p/psutil/ 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-11 Thread James Mills
-- -- 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 bookre...@gmail.com 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: Questions: While And List Comprehension

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

Re: Looping through files in a directory

2010-11-10 Thread James Mills
thousand 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
): #!/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://mail.python.org

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 11:38 AM, MRAB pyt...@mrabarnett.plus.com 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
On Thu, Nov 11, 2010 at 1:02 PM, Steve Holden st...@holdenweb.com 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

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
in sys.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
islice). 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: [Beginer Question] I heard about python needing some sort of_VariableName_ boiler plate?

2010-10-31 Thread James Mills
boilerplate ? 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: with block for multiple files

2010-10-31 Thread James Mills
On Mon, Nov 1, 2010 at 3:03 PM, Yingjie Lan lany...@yahoo.com 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 -- http://mail.python.org

Re: How do I chain methods?

2010-10-24 Thread James Mills
Chad ... return self ... def last(self): ... print A ... return self ... 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

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:02 AM, Chris Rebert c...@rebertia.com 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 by method -- http

Re: How do I chain methods?

2010-10-24 Thread James Mills
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 12:49 PM, Steven D'Aprano steve-remove-t...@cybersource.com.au 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

Re: How do I chain methods?

2010-10-24 Thread James Mills
On Mon, Oct 25, 2010 at 9:39 AM, James Mills prolo...@shortcircuit.net.au 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 working with). My apologies

  1   2   3   4   5   6   >