My Python programming book for kids is free for 48 hours

2020-02-02 Thread Kent Tong
Hi, If you're interested, please get it for free at: https://www.amazon.com/Yes-Kids-can-learn-Python-ebook/dp/B084CY2L43/ref=sr_1_3 This is a set of training materials I used to successfully teach Python to kids as little as 10 years old. The online learning environment are freely available at

Interactively online Python learning environment freely available

2020-01-28 Thread Kent Tong
Hi, I've made an online python learning environment available at https://p4kweb.appspot.com Please take a look and let me know what you think :-) -- https://mail.python.org/mailman/listinfo/python-list

training materials and learning environment for teaching kids python available

2018-08-31 Thread Kent Tong
Hi all, This is a set of training materials I used to successfully teach Python to kids as little as 10 years old. It was a success because the kids didn't just finish the course, they independently completed most of the coding challenges by applying the knowledge they had learned. The first f

free python course materials for high school students available

2016-08-09 Thread Kent Tong
Hi, I've taught a python course with some positive results to high school students with zero experience in programming. Now I am making these course materials (slides in English and lecture videos in Cantonese) freely available as a contribution back to the community (http://www.istudycenter.o

Re: Why not allow empty code blocks?

2016-07-22 Thread Kent Tong
On Saturday, July 23, 2016 at 9:49:51 AM UTC+8, Steven D'Aprano wrote: > Because it cannot tell the difference between an empty code block and > failing to indent the code block: > > for x in sequence: > print('loop') Thanks for the excellent answer! -- https://mail.python.org/mailman/listinfo/

Why not allow empty code blocks?

2016-07-22 Thread Kent Tong
Hi I'm aware that we can use 'pass' as an empty code block. But why doesn't python allow a code block to be empty and thus eliminate the need for this null statement? thanks in advance -- https://mail.python.org/mailman/listinfo/python-list

Re: can't add variables to instances of built-in classes

2016-07-17 Thread Kent Tong
Hi Peter, Thanks a lot for your excellent explanation! -- https://mail.python.org/mailman/listinfo/python-list

can't add variables to instances of built-in classes

2016-07-17 Thread Kent Tong
Hi, I can add new variables to user-defined classes like: >>> class Test: ... pass ... >>> a=Test() >>> a.x=100 but it doesn't work if the instances belong to a built-in class such as str or list: >>> a='abc' >>> a.x=100 Traceback (most recent call last): File "", line 1, in Attribu

Re: pygtk beginner script not working

2015-11-15 Thread kent nyberg
On Sat, Nov 14, 2015 at 05:00:59PM -0800, ja...@imagewebdesign.co.uk wrote: > Hi guys > > I'm new to Python so please bare with me :) > > I'm using python 2.7.10 as advised (more tools apparently over 3.x) > > Trying to use this script > > [CODE] > #!/usr/bin/env python > > # example base.py

Re: Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
The main problem was that I forgot to do seek(0). Thanks alot people. Though, as many times before, the problem was due to misunderstanding of how python works. I assumed file.read()[xx:yy] was to be understood as, in the file, read from index xx to place yy. That is, [10:20] was the same a

Re: Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
On Fri, Nov 13, 2015 at 12:36:22PM -0700, Ian Kelly wrote: > On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote: > > def LoadCommandAndReact(place_to_read): > > global RegisterAX > > > > tmp = place_to_read.read()[RegisterAX:calcsize('HH')] > >

Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
27; to read. But surely .read()[RegisterAX:calcsize('HH')] should assure that its fed with correct data? I have filled the file with data of size '>HH' and first command reads that. So next read should read the next duplicate of that data that has been written to the fil

Re: bitwise operator, bits dont go into bitbucket..?

2015-11-10 Thread kent nyberg
On Wed, Nov 11, 2015 at 09:33:38AM +1100, Chris Angelico wrote: > On Wed, Nov 11, 2015 at 9:27 AM, kent nyberg wrote: > > If you want to check specific bits (in C or Python, either way), it's > much more common to use bitwise AND than bit shifts: > > >>> 0b100

bitwise operator, bits dont go into bitbucket..?

2015-11-10 Thread kent nyberg
Im reading about bitwise operators and is it true to say they dont work 100% as in C? bitwise operators in C seem to result in bits going to the so called bitbucket. For example, 0b0001. Shifting it >> 1 in C it seems to add on zero to the left and the 1 to the right gets throwned away. Bu

Re: using binary in python

2015-11-10 Thread kent nyberg
On Mon, Nov 09, 2015 at 10:20:25PM -0800, Larry Hudson via Python-list wrote: > Your questions are somewhat difficult to answer because you misunderstand > binary. The key is that EVERYTHING in a computer is binary. There are NO > EXCEPTIONS, it's all binary ALL the time. The difference comes ab

using binary in python

2015-11-09 Thread kent nyberg
a binary file? Thanks alot, and forgive me for my stupid questions. :) /Kent Nyberg -- https://mail.python.org/mailman/listinfo/python-list

AssertionError (3.X only) when calling Py_Finalize with threads

2015-01-08 Thread Tom Kent
arting Basic-- --Basic Complete-- --Starting With Thread-- Exception ignored in: Traceback (most recent call last): File "C:\Python34-32\Lib\threading.py", line 1289, in _shutdown assert tlock.locked() AssertionError: --With Thread Complete-- --output-- The order of the

Re: script uses up all memory

2014-03-14 Thread Kent Engström
//docs.djangoproject.com/en/dev/faq/models/#why-is-django-leaking-memory Regards, / Kent Engström, Lysator -- https://mail.python.org/mailman/listinfo/python-list

Re: Obtaining a full path name from file

2011-05-24 Thread Michael Kent
If a filename does not contain a path component, os.path.abspath will prepend the current directory path onto it. -- http://mail.python.org/mailman/listinfo/python-list

Re: portable multiprocessing code

2011-05-17 Thread Michael Kent
You could also install Python 2.7 on that RedHat machine. It can be done without interfering with the 2.5 that RedHat depends on. -- http://mail.python.org/mailman/listinfo/python-list

Re: skipping one unittest assertion?

2011-05-01 Thread Michael Kent
I agree that each test should test only one 'thing', but it's also true that testing one 'thing' sometimes/often involves multiple assertions. But in the OP's case, it does sound like the assertion he wants to skip should be broken out into its own test. -- http://mail.python.org/mailman/listi

Re: optparse eats $

2011-04-19 Thread Michael Kent
Try this on your *nix command line: echo ">$100" On a *nix command line, the '$1' part of ">$100" will be seen as 'give me the value of the shell variable "1"', and since it has no value, will result in an empty string. So it's not optparse, or Python, because the literal string you intend to

Re: Generators and propagation of exceptions

2011-04-09 Thread Kent Johnson
le Error object which implements the required methods at each level to just return self. I don't know if this really works when you start nesting but perhaps it is worth a try. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP: possibility of inline using of a symbol instead of "import"

2011-01-06 Thread Mike Kent
On Jan 6, 11:02 am, Duncan Booth wrote: > Your complaint seems to be that: > >    r1 = myFunc1(...) > > is unclear when you don't know where myfunc1 originates, so why don't > you write: > >    r1 = MyModule1.myFunc1(...) > > -- > Duncan Boothhttp://kupuguy.blogspot.com My interpretation of his

Re: Python 2.7.1

2010-11-29 Thread Kent Johnson
On Nov 27, 11:33 pm, Benjamin Peterson wrote: > On behalf of the Python development team, I'm happy as a clam to announce the > immediate availability of Python 2.7.1. Will there be Mac binaries for 2.7.1 and 3.1.3? Currently the web site shows only source and Windows binaries. T

Sqlalchemy access to Firefox's places.sqlite

2010-11-17 Thread Kent Tenney
ified INTEGER)'); INSERT INTO "sqlite_master" VALUES('index','moz_bookmarks_itemindex', 'moz_bookmarks',3,'CREATE INDEX moz_bookmarks_itemindex ON moz_bookmarks (fk, type)'); ... Is there an easy way to go from this sql to Sqlalchemy code? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Mike Kent
You might want to check out the Python 2.7 'pipes' standard library module: http://docs.python.org/library/pipes.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordering tests in a testsuite

2010-10-08 Thread Mike Kent
But sometimes you just wanna do it the way you wanna do it. If you name your tests like 'test_01_yadda' and test_02_whatever', then they will be run in the order you want, as given by the numbers. -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python - parse data into Google Charts

2010-09-03 Thread Mike Kent
On Sep 3, 1:52 pm, alistair wrote: > I'm new to python and my programming years are a ways behind me, so I > was looking for some help in parsing a file into a chart using the > Google Charts API. > Try this: http://pygooglechart.slowchop.com/ -- http://mail.python.org/mailman/listinfo/python-li

Re: Does MySQLdb rollback on control-C? Maybe not.

2010-09-03 Thread Mike Kent
On Sep 3, 12:22 am, John Nagle wrote: >     I would expect MySQLdb to rollback on a control-C, but it doesn't > seem to have done so.   > Something is broken. I wouldn't expect it to, I'd expect to roll back on an exception, or commit if not. Perhaps this will help you. I use it in production

Re: python database

2010-09-03 Thread Mike Kent
On Sep 3, 2:36 am, shai garcia wrote: > can you pls help me to make a database program in python? It's better if you do your homework yourself. You learn more that way. Now, if you have a specific question about some detail of your assignment, and can show us that you've really tried to do the

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Mike Kent
On Aug 8, 8:43 pm, rantingrick wrote: > Hello folks, > > You all know i been forced to use Ruby and i am not happy about that. ***Blablabla cut long rant*** Xah, this is really you, isn't it. Come on, confess. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie problem with str.replace

2010-08-04 Thread Mike Kent
On Aug 4, 9:10 am, BobAalsma wrote: > I'm working on a set of scripts and I can't get a replace to work in > the script - please help. >                         bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN) I'm not sure what you are intending to do here, but string.replace does not do i

question

2010-05-26 Thread Kent Tenney
E.txt': Permission denied Am I missing something? If it works for you, I suppose it's somewhere in my versioning. I have bull in a china shop tendencies when it comes to installing stuff. Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

SEC apparently about to mandate Python for a particular financial use

2010-04-16 Thread Mike Kent
http://jrvarma.wordpress.com/2010/04/16/the-sec-and-the-python/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Reactive programming in Python ?

2010-04-16 Thread Mike Kent
On Apr 16, 11:18 am, pca wrote: > Dear all, > > Could “reactive programming” still increase the productivity and joy > of Python programming?  I’d like to hear your thoughts on the idea > that object-oriented “programming by formula”, as in a spreadsheet, > would simplify our work, because we woul

Re: Relocatable python install

2010-04-14 Thread Mike Kent
On Apr 14, 4:50 pm, Michel wrote: > Hi, > > I would like to create a binary package of python that we will ship > with our product. I need to be able to install the package anywhere in > the file system. > > The interpreter seems to be ok with that, but a few other tools that > are installed in th

Re: Pythonic list reordering

2010-04-10 Thread Kent Engström
Ben Racine writes: > I have a list... > > ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat', > 'dir_330_error.dat'] > > I want to sort it based upon the numerical value only. > > Does someone have an elegant solution to this? I use code like the hack below to sort miscellaneous string

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Mike Kent
On Mar 30, 11:40 am, gentlestone wrote: > Hi, how can I write the popular C/JAVA syntax in Python? > > Java example: >     return (a==b) ? 'Yes' : 'No' > > My first idea is: >     return ('No','Yes')[bool(a==b)] > > Is there a more elegant/common python expression for this? return ('Yes' if a ==

Re: A "scopeguard" for Python

2010-03-05 Thread Mike Kent
On Mar 4, 8:04 pm, Robert Kern wrote: > No, the try: finally: is not implicit. See the source for > contextlib.GeneratorContextManager. When __exit__() gets an exception from the > with: block, it will push it into the generator using its .throw() method. > This > raises the exception inside the

Re: A "scopeguard" for Python

2010-03-04 Thread Mike Kent
On Mar 3, 12:00 pm, Robert Kern wrote: > On 2010-03-03 09:39 AM, Mike Kent wrote: > > > What's the compelling use case for this vs. a simple try/finally? > > >     original_dir = os.getcwd() > >     try: > >         os.chdir(somewhere) > &

Re: A "scopeguard" for Python

2010-03-04 Thread Mike Kent
On Mar 4, 12:30 pm, Robert Kern wrote: > He's ignorant of the use cases of the with: statement, true. Ouch! Ignorant of the use cases of the with statement, am I? Odd, I use it all the time. > Given only your > example of the with: statement, it is hard to fault him for thinking that try: >

Re: A "scopeguard" for Python

2010-03-04 Thread Mike Kent
On Mar 3, 10:56 am, "Alf P. Steinbach" wrote: > * Mike Kent: > > > What's the compelling use case for this vs. a simple try/finally? > > if you thought about it you would mean a simple "try/else". "finally" is > always > executed

Re: A "scopeguard" for Python

2010-03-03 Thread Mike Kent
What's the compelling use case for this vs. a simple try/finally? original_dir = os.getcwd() try: os.chdir(somewhere) # Do other stuff finally: os.chdir(original_dir) # Do other cleanup -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run a sudo command from script

2010-01-03 Thread Kent Tenney
On Fri, Jan 1, 2010 at 5:08 PM, Diez B. Roggisch wrote: > Kent Tenney schrieb: >> >> Howdy, >> >> A script running as a regular user sometimes wants >> to run sudo commands. >> >> It gets the password with getpass. >> pw = getpass.getpass()

Trying to run a sudo command from script

2010-01-01 Thread Kent Tenney
ut=pw) getting assorted errors with all variations I try. Googling says use pexpect, but I'd prefer a stdlib solution. Any help appreciated. Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Problem building Python from source

2009-09-30 Thread Kent Tenney
argument to ./configure or make, or an environment setting which will make cStringIO available without editing Modules/Setup ? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: nested structure with "internal references"

2009-09-25 Thread Kent Turbo
On Sep 25, 9:11 pm, Torsten Mohr wrote: > I'd like to refer to another entry and not copy that entry, i need to > know later that this is a reference to another entry, i need to find > also access that entry then. > > The references only need to refer to entries in this structure. > The lists may

Re: Is there a maximum size to a Python program?

2009-04-27 Thread Mike Kent
On Apr 27, 1:49 am, John Machin wrote: > > I am > > having a look at eval and exec > > WRONG WAY > GO BACK +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: WINXP vs. LINUX in threading.Thread

2009-04-23 Thread Kent
Thanx you guys. Now my program is working. I used the Thread subclass. and at the end of the run method, i call wx.CallAfter(mainFrame.somefunction, para) to show the dialog or change some text. I tested in winxp&linux. both worked. Kent On Apr 23, 6:16 am, Carl Banks wrote: > On Ap

WINXP vs. LINUX in threading.Thread

2009-04-22 Thread Kent
hello all, i want to add a "new update notification" feature to my wxPython appl. The codes below do the job. The logic is simple enough, I don't think it needs to be explained. since sometimes, under windows, proxy setting was a script. and was set in IE. In this case, connecting to the HTML wil

Re: question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

2009-04-21 Thread Kent
#this is the function def onTagMgmt(self,event): tagId = event.GetData() # following codes are omitted. just some business logic stuff. checking the tagId, making decision of showing popup menu items... Kent On Apr 21, 11:24 pm, Mike Driscoll wrote: > On Apr 21, 3:35 pm,

question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

2009-04-21 Thread Kent
uot;empty area" of the lc, nothing happened, no popup menu. I tested under WINXP, the function was not triggered at all when I right-clicked on the "empty area". I tried to bind wx.EVT_RIGHT_DOWN(UP) to the lc, but the function cannot be triggered under Linux. any suggestion? Thanks re

Re: ANN: PyGUI 2.0.4

2009-04-21 Thread Kent Johnson
, in win_message_to_event kind, button = win_message_map[msg] KeyError: 675 Adding this line to win_message_map in GUI/Win32/Events.py seems to fix it: wc.WM_MOUSELEAVE: ('mouse_leave', None), Kent -- http://mail.python.org/mailman/listinfo/python-list

Can I use setup.py to ship and install only .pyc files?

2009-04-16 Thread Mike Kent
I'd like to ship only the .pyc files for a module. I was hoping the standard distutils setup.py could handle this, but so far, I've not figured out how. After a bit of work, I discovered that if I create a MANIFEST.in file, and put 'include mymodule/*.pyc' and 'exclude mymodule/*.py' in it, then

Re: how to arrange classes in .py files?

2009-03-27 Thread Kent
On Mar 27, 3:01 pm, "David L. Jones" wrote: > On Mar 26, 8:51 pm, Kent wrote: > > > ... Is > > there any convention how to manage python classes into .py files? > > > ... > > In above packages, each .py file contains one python class. And > > C

Re: modifying a list element from a function

2009-03-27 Thread Kent
> * to do the same modification on the list "a" within a function > * not to hardcode in this function the position of the string in each >>> a = [ [4, "toto"], [5, "cou"] ] >>> def assign(element,pos,newValue): ... element[pos]=newValue ... >>> assign(a[0],1,'xxx') >>> print a [[4, 'xxx'],

how to arrange classes in .py files?

2009-03-26 Thread Kent
not sure about the right code structure of python oop. Can anyone give some hint on it? would be great with reason. Thanks in advance. regards, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP libs for Python?

2009-02-20 Thread Mike Kent
I use Fabric (http://www.nongnu.org/fab/) as my Python-based deployment tool, but it uses ssh/scp, not sftp. -- http://mail.python.org/mailman/listinfo/python-list

Re: function scope

2009-02-02 Thread Mike Kent
On Feb 2, 6:40 pm, Baris Demir wrote: > def simpleCut(d=dict()): >        temp=d >        for i in temp.keys(): >            if    (temp[i] == ...) : >               temp[i]=new_value > return temp You have been bitten by the shared default parameter noobie trap: http://www.python.org/doc/fa

Problem building Python 2.5.2 curses module on HP/UX 11.11

2009-01-06 Thread Mike Kent
I'm having a problem building the Python 2.5.2 curses module on HP/UX 11.11 using gcc 3.3.6, and was hoping someone had a solution. Compiling Modules/_cursesmodule.c is giving several warnings, but no errors. The relevant compile/link output is below. The key output line is: *** WARNING: renamin

Re: Possible read()/readline() bug?

2008-10-23 Thread Mike Kent
To followup on this: Terry: Yes, I did in fact miss the 'buffer' parameter to open. Setting the buffer parameter to 0 did in fact fix the test code that I gave above, but oddly, did not fix my actual production code; it continues to get the data as first read, rather than what is currently on the

Possible read()/readline() bug?

2008-10-22 Thread Mike Kent
Before I file a bug report against Python 2.5.2, I want to run this by the newsgroup to make sure I'm not being stupid. I have a text file of fixed-length records I want to read in random order. That file is being changed in real-time by another process, and my process want to see the changes to

Re: utf-8 read/write file

2008-10-08 Thread Kent Johnson
> I have done script for that, but im having problem with croatian characters > >> (©,Ð,®,È,Æ). > > UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 0: > unexpected code byte Are you sure you have UTF-8 data? I guess your file is encoded in CP125

Re: tcl/tk version confusion with tkinter in Python 2.6, on OS X

2008-10-06 Thread Kent Johnson
It makes the build pretty much useless > for anyone needing it to run Tkinter apps, including Idle. I'd say > it's > a showstopper issue. I think so. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: How to delete a last character from a string

2008-08-29 Thread Mike Kent
On Aug 29, 2:28 pm, [EMAIL PROTECTED] wrote: > Sorry : Earlier mail had a typo in Subject line which might look > in-appropriate to my friends > > Hi, > > I've a list some of whose elements with character \. > I want to delete this last character from the elements that have this > character set at

Re: Python multimap

2008-08-27 Thread Mike Kent
On Aug 27, 9:35 am, brad <[EMAIL PROTECTED]> wrote: > Recently had a need to us a multimap container in C++. I now need to > write equivalent Python code. How does Python handle this? > > k['1'] = 'Tom' > k['1'] = 'Bob' > k['1'] = 'Joe' > ... > > Same key, but different values. No overwrites either

Re: Suggestion for improved ImportError message

2008-08-13 Thread Kent Tenney
int: you have to modify import_from function from > > Python/ceval.c Am I correct in thinking that PyPy would mean low level stuff like this will be Python instead of C? That would be nice. > > > > My quick attempt: Quick indeed! Very cool. Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime from uuid1 timestamp

2008-08-13 Thread Kent Tenney
creation date solely from the filename. Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Suggestion for improved ImportError message

2008-08-13 Thread Kent Tenney
name annotate from /usr//image.pyc Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime from uuid1 timestamp

2008-08-13 Thread Kent Tenney
> Howdy, > > I have not found a routine to extract usable > date/time information from the 60 bit uuid1 timestamp. > > Is there not a standard solution? I submitted an ASPN recipe to do it. http://code.activestate.com/recipes/576420/ -- http://mail.python.org/mailman/listinfo/python-list

datetime from uuid1 timestamp

2008-08-13 Thread Kent Tenney
Howdy, I have not found a routine to extract usable date/time information from the 60 bit uuid1 timestamp. Is there not a standard solution? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: sending to an xterm

2008-08-08 Thread Kent Tenney
Derek Martin pizzashack.org> writes: > > On Fri, Aug 08, 2008 at 08:25:19PM +0000, Kent Tenney wrote: > > Howdy, > > > > I want to open an xterm, send it a command and have it execute it. > > You can't do that. xterm doesn't execute shell com

Re: sending to an xterm

2008-08-08 Thread Kent Tenney
Derek Martin pizzashack.org> writes: > > On Fri, Aug 08, 2008 at 08:25:19PM +0000, Kent Tenney wrote: > > Howdy, > > > > I want to open an xterm, send it a command and have it execute it. > > You can't do that. xterm doesn't execute shell com

sending to an xterm

2008-08-08 Thread Kent Tenney
Howdy, I want to open an xterm, send it a command and have it execute it. I thought pexpect would do this, but I've been unsuccessful. term = pexpect.spawn('xterm') starts an xterm, but term.sendline('ls') doesn't seem to do anything. Suggestions? Thanks, K

FW: [Jython-users] Jython Licensing Question

2008-07-24 Thread Pinegar, Kent T
All, Can anyone answer my question about the licensing for SocketServer.py? I would appreciate it. Kent -Original Message- From: Tobias Ivarsson [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2008 2:13 AM To: Pinegar, Kent T Subject: Re: [Jython-users] Jython Licensing Question No

Re: Convert string to char array

2008-07-01 Thread Mike Kent
On Jul 1, 2:49 pm, "Brandon" <[EMAIL PROTECTED]> wrote: > How do I convert a string to a char array?  I am doing this so I can edit > the string received from an sql query so I can remove unnecessary > characters. Answering your specific question: Python 2.5.1 (r251:54863, Mar 31 2008, 11:09:52)

Re: Notify of change to list

2008-06-16 Thread Mike Kent
I recently wanted to do the same kind of thing. See this tread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/f27c3b7950424e1c for details on how to do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing list, what special methods do this?

2008-06-14 Thread Mike Kent
On Jun 13, 8:43 pm, Matimus <[EMAIL PROTECTED]> wrote: ...chop... > So, it looks like as long as you want to subclass list, you are stuck > implementing both __*slice__ and __*item__ methods. > > Matt Thanks. That was clear and concise, just what I needed. -- http://mail.python.org/mailman/listi

Subclassing list, what special methods do this?

2008-06-13 Thread Mike Kent
For Python 2.5 and new-style classes, what special method is called for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a list, and seq is some sequence)? I'm trying to subclass list, and I'm having trouble determining what special methods I have to override in my class for the abo

Re: Constructor re-initialization issue

2008-06-03 Thread Mike Kent
On Jun 3, 6:11 pm, [EMAIL PROTECTED] wrote: > Hello all, > > I have come across this issue in Python and I cannot quite understand > what is going on. > > class Param(): > def __init__(self, data={}, condition=False): > if condition: > data['class']="Advanced" > prin

Re: list index out of range

2008-05-13 Thread Mike Kent
On May 13, 2:39 pm, Georgy Panterov <[EMAIL PROTECTED]> wrote: > > def deal_hand(deck): > HAND=[] > for _ in range(2): > i=random.randint(0,len(deck)) #produces a random card from the deck ^ Here i can be from 0 thru (the number of cards in the deck). > HAND.appen

Re: creating a list from a inconsistent text file

2008-05-02 Thread Mike Kent
On May 2, 9:47 am, Jetus <[EMAIL PROTECTED]> wrote: > Hello Marc; > Thanks for the input! I am worried about the comma in the "" data > items, how do I tell Python to look for the "" data first, then use > the comma separator? Marc has already given you the correct answer. You really should read

Re: Pythonically extract data from a list of tuples (getopt)

2008-04-23 Thread Mike Kent
You could use http://docs.python.org/lib/module-optparse.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Finally had to plonk google gorups.

2008-04-16 Thread Mike Kent
On Apr 16, 10:26 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > Yeah, I noticed that Google Groups has really sucked this week. I'm > using the Google Groups Killfile for Greasemonkey now and it helps a > lot. I like Google, but my loyalty only goes to far. This is a > complete lack of customer se

Re: Talking to a usb device (serial terminal)

2008-03-03 Thread Mike Kent
> So my question is this - what is the easiest way to interface to this > "serial" device? > http://pyserial.sourceforge.net/ or perhaps http://pyusb.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list

What should I use under *nix instead of freeze?

2008-02-01 Thread Mike Kent
In a comment Guido made on a recent bug report for the 'freeze' utility, he stated: "I think nobody really cares about freeze any more -- it isn't maintained." That being the case, what is the preferred/best replacement for freeze on a *nix platform? I'm looking for something that, like freeze,

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Mike Kent
On Jan 26, 7:23 am, Dox33 <[EMAIL PROTECTED]> wrote: > I ran into a very strange behaviour of raw_input(). > I hope somebody can tell me how to fix this. ===CUT=== > *** Thirst, redirect stderr to file, STRANGE behaviour.. > From the command prompt I run: > python script.py 2> stderr_catch.txt

Re: Reporting Python bugs (was: Can someone explain this unexpectedraw_input behavior?)

2008-01-24 Thread Mike Kent
On Jan 24, 5:13 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Ben Finney" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | Mike Kent <[EMAIL PROTECTED]> writes: > | > | > A bug issue has been opened in the Python Trac

Re: Can someone explain this unexpected raw_input behavior?

2008-01-24 Thread Mike Kent
> If it weren't for the documentation... > > "If the prompt argument is present, it is written to *standard output* > without a trailing newline." > > -- > mvh Björn I have reported this issue to the python-dev mailing list, and Guido agrees that this is a bug in Python. It turns out that the ke

Re: Can someone explain this unexpected raw_input behavior?

2008-01-23 Thread Mike Kent
Gabriel, thank you for clarifying the source of this behavior. Still, I'm surprised it would be hard-coded into Python. Consider an interactive program, that asks the user several questions, and displays paragraphs of information based on those questions. The paragraphs are output using print, a

Can someone explain this unexpected raw_input behavior?

2008-01-23 Thread Mike Kent
It's often useful for debugging to print something to stderr, and to route the error output to a file using '2>filename' on the command line. However, when I try that with a python script, all prompt output from raw_input goes to stderr. Consider the following test program: === Start test.py ===

Re: How avoid both a newline and a space between 2 print commands?

2008-01-23 Thread Mike Kent
On Jan 23, 9:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > print "foo" > print "bar" > > has a newline in between "foo" and "bar" > > print "foo", > print "bar" > > has a space in between "foo" and "bar" > > How prevent ANYTHING from going in between "foo" and "bar" ?? > > (Without defini

Re: Prioritization function needed (recursive help!)

2008-01-21 Thread Kent Johnson
these. You need a topological sort. http://en.wikipedia.org/wiki/Topological_sort Two Python implementations: http://pypi.python.org/pypi/topsort/0.9 http://www.bitformation.com/art/python_toposort.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Need some help with 'with'

2007-11-27 Thread Mike Kent
I recently found myself needing to do this a lot: lock a record in a file read the record into a buffer alter the buffer write the buffer back to the record unlock the record I'd love to be able to create a context for this to use with the 'with' statement, something like: from __future__ import

Re: python question!!

2007-11-22 Thread Mike Kent
On Nov 22, 8:23 pm, "bruce" <[EMAIL PROTECTED]> wrote: > is there a function/feature/etc.. that i can run on "foo.py" that would walk > through the entire list of files that make up foo.py, so i could see the > list of *.py files that are required to run "foo.py". There's this: http://www.tarind.

ACM SIGAPL / APL2007 Conference / Montreal / one week away

2007-10-15 Thread Mike Kent
Conference page // with links to program details // (updated Friday 10/12) http://www.sigapl.org/apl2007.html Co-located with OOPSLA 2007 http://www.oopsla.org/oopsla2007 On-line registration (through Wednesday 10/17) http://www.regmaster.com/c

APL2007 reminder: early (cheaper) registration ends Thursday 9/13

2007-09-08 Thread Mike Kent
On-line registration is through the OOPSLA registrar http://www.regmaster.com/conf/oopsla2007.html APL 2007 home page http://www.sigapl.org/apl2007.html -- http://mail.python.org/mailman/listinfo/python-list

What's on at APL 2007, Montreal, October 21, (Tutorials) 22, 23 (Program)

2007-08-30 Thread Mike Kent
( Details and abstracts coming to the APL 2007 web page http://www.sigapl.org/apl2007.html shortly. In the meantime ... ) Tutorials and workshops Introduction to APL (Ray Polivka) OO for APLers, APL for OOers (Dan Baronet) ... others in the works Presentations

(Re)announcing APL 2007

2007-08-05 Thread Mike Kent
APL 2007 conference on Array Programming co-located with OOPSLA 2007 Sponsor: ACM SIGAPL Where:Montreal When: October 21 (tutorials) October 22/23 (main conference program) Keynote Guy Steele speaker:

  1   2   3   4   5   6   7   8   >