Re: awk like usage in python

2012-11-09 Thread Tim Roberts
Rudra Banerjee wrote: > >Friends, >I am in process learning python. >I basically use shell scripts for text formatting and trying my hand on >python. >where I am fighting is awk's functionality in python. >Say, one of my real tiny code looks like: >#!/bin/bash >TMP=store >for i in $1/MnBi_EOS_* >

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 12:34:27 +0100, Hans Mulder wrote: > On 7/11/12 01:13:47, Steven D'Aprano wrote: >> Hit the J key, and the event includes character "j". Hit Shift-J, and >> character "J" is sent. Hit Ctrl-J, and the character sent is the ASCII >> control character ^J, or newline. (Technically

Re: skip Trackback error for ftp checking

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 20:51:47 -0800, moonhkt wrote: > HI All > > How to skip Trackback warning/error when input ftp address is not > correct or reject ? The same way you would skip any other error when you do something wrong: catch the exception. -- Steven -- http://mail.python.org/mailman/l

skip Trackback error for ftp checking

2012-11-09 Thread moonhkt
HI All How to skip Trackback warning/error when input ftp address is not correct or reject ? AIX 5.3 from ftplib import FTP import ftplib import sys from optparse import OptionParser parser = OptionParser() parser.add_option("-a","--remote_host_address", dest="remote_host_address", help="R

Re: Numpy combine channels

2012-11-09 Thread Aahz
In article , MRAB wrote: >On 10/09/2012 20:39, Wanderer wrote: >> >> I have an array generated by audiolab of left and right stereo >> channels. It looks like [[1,1],[1,2],[2,3]]. I would like to combine >> the left and right channels to get an array [2,3,5]. Is there a numpy >> command to do tha

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Miki Tebeka
> Is there a simpler way to modify all arguments in a function before using the > arguments? You can use a decorator: from functools import wraps def fix_args(fn): @wraps(fn) def wrapper(*args): args = (arg.replace('_', '') for arg in args) return fn(*args) return wr

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
Chris Angelico writes: > Contrived example: > def send_email(from, to, subj, body, whatever, other, headers, you, like): That should be a dictionary with the header names as indexes. In fact there are already some email handling modules in the stdlib that represent headers that way. -- http://m

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 1:52 PM, Paul Rubin wrote: > bruceg113...@gmail.com writes: >> Is there a simpler way to modify all arguments in a function before >> using the arguments? > > Why do you want to do that? > Contrived example: def send_email(from, to, subj, body, whatever, other, headers, y

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
bruceg113...@gmail.com writes: > Is there a simpler way to modify all arguments in a function before > using the arguments? Why do you want to do that? > For example, can the below code, in the modify arguments section be > made into a few statements? Whenever someone uses that many variables on

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 20:05:26 -0500, Roy Smith wrote: > In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>, > bruceg113...@gmail.com wrote: > >> Is there a simpler way to modify all arguments in a function before >> using the arguments? >> >> For example, can the below code, in t

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Roy Smith
In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>, bruceg113...@gmail.com wrote: > Is there a simpler way to modify all arguments in a function before using the > arguments? > > For example, can the below code, in the modify arguments section be made into > a few statements?

Re: Want to add dictionary keys to namespace?

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 11:00 AM, Jeff Jeffries wrote: > Smart people, Is there a way I can add a dictionaries keys to the python > namespace? It would just be temporary as I am working with a large > dictionary, and it would speed up work using an IDE. I look and find > nothing... none of the ke

Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread bruceg113355
Is there a simpler way to modify all arguments in a function before using the arguments? For example, can the below code, in the modify arguments section be made into a few statements? def someComputation (aa, bb, cc, dd, ee, ff, gg, hh): # modify arguments # ---

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-11-09 Thread Aahz
In article , Thomas Rachel wrote: >Am 11.09.2012 05:46 schrieb Steven D'Aprano: >> >> Good for you. (Sorry, that comes across as more condescending than it is >> intended as.) Monkey-patching often gets used for quick scripts and tiny >> pieces of code because it works. >> >> Just beware that if

Re: Python3.3 str() bug?

2012-11-09 Thread Terry Reedy
On 11/9/2012 8:13 AM, Helmut Jarausch wrote: Just for the record. I first discovered a real bug with Python3 when using os.walk on a file system containing non-ascii characters in file names. I encountered a very strange behavior (I still would call it a bug) when trying to put non-ascii charac

Re: fabric question

2012-11-09 Thread Miki Tebeka
> local$ fab remote_info > [remote] Executing task 'remote_info' > [remote] run: uname -a > [remote] out: remote@path$ What happens when you ssh to the machine and run 'uname -a'? (The out: ... is the output) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to print python commands automatically?

2012-11-09 Thread Peng Yu
> Try with just --trace? > > > C:\ramit>python.exe -m trace test.py > C:\ramit\Python27\lib\trace.py: must specify one of --trace, --count, > --report, --listfuncs, or --trackcalls > > C:\ramit>python -m trace --trace test.py > --- modulename: test, funcname: > test.py(2): def f(): > test.py(5):

fabric question

2012-11-09 Thread Jabba Laci
Hi, I'm trying to use fabric to run a command on another Linux machine. When I call "fab remote_info" (using the example from its documentation), this is what I get: local$ fab remote_info [remote] Executing task 'remote_info' [remote] run: uname -a [remote] out: remote@path$ That is, it logs in

Re: problem with module PyVisa

2012-11-09 Thread wrw
On Nov 9, 2012, at 3:43 PM, Jean Dubois wrote: > > The error may be obvious but finding this file and how to install it > is not unfortunately. > It seems I have to install it from the National Instruments site but > Debian Linux doesn't seem to be supported... > and I doubt whether just copying

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 2:46 PM, danielk wrote: > D:\home\python>pytest.py > Traceback (most recent call last): > File "D:\home\python\pytest.py", line 1, in > print(chr(253).decode('latin1')) > AttributeError: 'str' object has no attribute 'decode' > > Do I need to import something? Ramit

Re: Multi-dimensional list initialization

2012-11-09 Thread Ethan Furman
Prasad, Ramit wrote: Dennis Lee Bieber wrote: Of course, if one has a language that, for some reason, evaluates right-to-left (APL, anyone), then x := x - x - x becomes x := x - 0 Is that not the same as x:=-x? No, its the same as 'x = x'. ~Ethan~ -- http://mail.p

Re: Printing characters outside of the ASCII range

2012-11-09 Thread danielk
On Friday, November 9, 2012 4:34:19 PM UTC-5, Prasad, Ramit wrote: > danielk wrote: > > > > > > The database I'm using stores information as a 3-dimensional array. The > > delimiters between elements are > > > chr(252), chr(253) and chr(254). So a record can look like this (example > > only u

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 15:17, danielk wrote: > I guess the question I have is: How do you tell Python to use a specific > encoding for 'print' statements when I know there will be characters outside > of the ASCII range of 0-127? You don't. It's raising that exception because the terminal cannot display t

RE: Printing characters outside of the ASCII range

2012-11-09 Thread Prasad, Ramit
danielk wrote: > > The database I'm using stores information as a 3-dimensional array. The > delimiters between elements are > chr(252), chr(253) and chr(254). So a record can look like this (example only > uses one of the delimiters for > simplicity): > > name + chr(254) + address + chr(254) +

RE: How to print python commands automatically?

2012-11-09 Thread Prasad, Ramit
Peng Yu wrote: > > > Is this what you want? > > http://docs.python.org/2/library/trace.html > > I'm not able to get the mixing of the python command screen output on > stdout. Is there a combination of options for this purpose? > > ~/linux/test/python/man/library/trace$ cat main1.py > #!/usr/bin

Re: Printing characters outside of the ASCII range

2012-11-09 Thread danielk
On Friday, November 9, 2012 12:48:05 PM UTC-5, Dave Angel wrote: > On 11/09/2012 12:17 PM, danielk wrote: > > > I'm converting an application to Python 3. The app works fine on Python 2. > > > > > > Simply put, this simple one-liner: > > > > > > print(chr(254)) > > > > > > errors out with: >

RE: problem with module PyVisa

2012-11-09 Thread Prasad, Ramit
Jean Dubois wrote: > > On 9 nov, 17:40, Rodrick Brown wrote: > > It seems pretty obvious from the error. Try installing the missing lib > > packages. > > > > OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared > > object file: No such file or directory > > > > Sent from my iPho

Re: How to print python commands automatically?

2012-11-09 Thread Peng Yu
> Is this what you want? > http://docs.python.org/2/library/trace.html I'm not able to get the mixing of the python command screen output on stdout. Is there a combination of options for this purpose? ~/linux/test/python/man/library/trace$ cat main1.py #!/usr/bin/env python def f(): print "Hel

Re: problem with module PyVisa

2012-11-09 Thread Jean Dubois
On 9 nov, 17:40, Rodrick Brown wrote: > It seems pretty obvious from the error. Try installing the missing lib > packages. > > OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared > object file: No such file or directory > > Sent from my iPhone > > On Nov 9, 2012, at 11:22 AM, Je

RE: Multi-dimensional list initialization

2012-11-09 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > On Fri, 9 Nov 2012 17:07:09 +1100, Chris Angelico > declaimed the following in gmane.comp.python.general: > > > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence > > wrote: > > > On 07/11/2012 01:55, Steven D'Aprano wrote: > > >> > > >> > > >> Who knows? Who cares? No

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
duck(Foo).match(IFoo, ) duck(Foo).like(IFoo, ) Hm... function name in most cases is read as verb... this may cause confusion: duck => synonyms => immerse, dip Thanks. Andriy Kornatskyy > From: ramit.pra...@jpmorgan.com > To: andriy.kornats...@live.com;

RE: Python3.3 str() bug?

2012-11-09 Thread Prasad, Ramit
Chris Angelico wrote: > > What you really should be doing is not transforming the whole > structure, but explicitly transforming each part inside it. I > recommend you stop fighting the language and start thinking about your > data as either *bytes* or *characters* and using the appropriate data >

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Dave Angel
On 11/09/2012 12:17 PM, danielk wrote: > I'm converting an application to Python 3. The app works fine on Python 2. > > Simply put, this simple one-liner: > > print(chr(254)) > > errors out with: > > Traceback (most recent call last): > File "D:\home\python\tst.py", line 1, in > print(chr(25

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 11:17, danielk wrote: > I'm converting an application to Python 3. The app works fine on Python 2. > > Simply put, this simple one-liner: > > print(chr(254)) > > errors out with: > > Traceback (most recent call last): > File "D:\home\python\tst.py", line 1, in > print(chr(2

RE: duck typing assert

2012-11-09 Thread Prasad, Ramit
Andriy Kornatskyy wrote: > > Thank you for all comments. > > > It makes very good sense to say: > > > > duckmatch(IFoo).compare(Foo) > > Since we do duck match of IFoo... but there is no `duck match`, there is > `duck test`. I believe instead of > `compare` is more readable with `equals`. Than

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 10:17 AM, danielk wrote: > I'm converting an application to Python 3. The app works fine on Python 2. > > Simply put, this simple one-liner: > > print(chr(254)) > > errors out with: > > Traceback (most recent call last): > File "D:\home\python\tst.py", line 1, in > pr

Re: Python3.3 str() bug?

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 2:18 AM, Helmut Jarausch wrote: > Hi, > > probably I'm missing something. > > Using str(Arg) works just fine if Arg is a list. > But > str([],encoding='latin-1') > > gives the error > TypeError: coercing to str: need bytes, bytearray or buffer-like object, >

RE: Writing game-state data...

2012-11-09 Thread Prasad, Ramit
Graham Fielding wrote: > > Hey, folks, me again! > > I've been puzzling over this for a while now: > > I'm trying to write data to a file to save the state of my game using the > following function: > > def save_game(): >     #open a new empty shelve (possibly overwriting an old one) to write

Printing characters outside of the ASCII range

2012-11-09 Thread danielk
I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback (most recent call last): File "D:\home\python\tst.py", line 1, in print(chr(254)) File "C:\Python33\lib\encodings\cp437.py", line 19,

Re: Python3.3 str() bug?

2012-11-09 Thread Stefan Behnel
Helmut Jarausch, 09.11.2012 14:13: > On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote: >> What you really should be doing is not transforming the whole >> structure, but explicitly transforming each part inside it. I >> recommend you stop fighting the language and start thinking about your

Re: duck typing assert‏

2012-11-09 Thread Terry Reedy
On 11/9/2012 1:30 AM, Steven D'Aprano wrote: On Thu, 08 Nov 2012 23:44:54 -0500, Terry Reedy wrote: On 11/8/2012 6:40 PM, Steven D'Aprano wrote: [...] IFoo.bar # returns a computed property Assuming IFoo is a class and bar is a property attribute of the class, IFoo.bar is the property obje

awk like usage in python

2012-11-09 Thread Rudra Banerjee
Friends, I am in process learning python. I basically use shell scripts for text formatting and trying my hand on python. where I am fighting is awk's functionality in python. Say, one of my real tiny code looks like: #!/bin/bash TMP=store for i in $1/MnBi_EOS_* do # echo $i grep -A 15 "T(est)"

Re: [newbie] problem with module PyVisa

2012-11-09 Thread Rodrick Brown
It seems pretty obvious from the error. Try installing the missing lib packages. OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory Sent from my iPhone On Nov 9, 2012, at 11:22 AM, Jean Dubois wrote: > OSError: /usr/local/vxipnp/linux/

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 4:37 AM, Steven D'Aprano wrote: > In Python 3.3: > > py> class X(int): > ... def __init__(self, *args): > ... super().__init__(*args) # does nothing, call it anyway > ... > py> x = X(22) > Traceback (most recent call last): > File "", line 1, in > File "",

[newbie] problem with module PyVisa

2012-11-09 Thread Jean Dubois
I'm trying to control a programmable power supply via USB using python. After doing some googling I thought I should use PyVisa for this purpose, so I installed it as follows: tar xvfz PyVISA-1.4.tar.gz cd PyVISA-1.4 python setup.py install Installation seems to finish without errors. When I star

Re: Multi-dimensional list initialization

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 2:05 AM, rusi wrote: > In x86 assembler > mov ax, 0 > is 4 bytes Three bytes actually, B8 00 00 if my memory hasn't failed me. BA for DX, B9 ought to be BX and BB CX, I think. But yes, the xor or sub is two bytes and one clock. ChrisA -- http://mail.python.org/mailman/li

Re: Multi-dimensional list initialization

2012-11-09 Thread rusi
On Nov 9, 11:37 am, Steven D'Aprano wrote: > On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote: > > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence > > wrote: > >> On 07/11/2012 01:55, Steven D'Aprano wrote: > > >>> Who knows? Who cares? Nobody does: > > >>> n -= n > > >> But I've seen this

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
There is sense for #2. Let me explain. There is basic IFoo implementation and improved Foo. While I switched to Foo, I still want to be as close to IFoo as possible, since there might be sense to switch to Foo2 later, which conform to IFoo. Here is the problem: if I will not assert #2 potentia

Re: duck typing assert

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy wrote: > > 1. In looks-like we check features of Foo (that may be superset) of what IFoo > offers. > > assert looks(Foo).like(IFoo) > > 2. We can check if Foo is limited to IFoo only: > > assert looks(IFoo).like(Foo) > > So it valid to have both

Re: error

2012-11-09 Thread inshu chauhan
Actually this one.. and its the last.. On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan wrote: > Please Ignore the above two files attached,,, See this one > > > On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote: > >> I attached a wrong file...Right file is attached here >> >> >> On Fri, Nov 9,

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
1. In looks-like we check features of Foo (that may be superset) of what IFoo offers. assert looks(Foo).like(IFoo) 2. We can check if Foo is limited to IFoo only: assert looks(IFoo).like(Foo) So it valid to have both asserts. Thanks. Andriy Kornatskyy -

Re: error

2012-11-09 Thread inshu chauhan
Please Ignore the above two files attached,,, See this one On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote: > I attached a wrong file...Right file is attached here > > > On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote: > >> >> >> >> >> http://www.ymlgroup.com/obscurehiddenlocation/down

Re: xml data or other?

2012-11-09 Thread rusi
On Nov 9, 5:54 pm, Artie Ziff wrote: > Hello, > > I want to process XML-like data like this: > Edits were substituting '/' for '\' on the end tags, and adding the > following structure: If thats all you want, you can try the following: # obviously this should come from a file input= """

Re: duck typing assert

2012-11-09 Thread Steven D'Aprano
On Thu, 08 Nov 2012 18:00:58 -0700, Ian Kelly wrote: > On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano > wrote: >> On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote: >> >>> People who come from strongly typed languages that offer interfaces >>> often are confused by lack of one in Pytho

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 09.11.2012 12:37, schrieb Steven D'Aprano: On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote: Or, do you suggest I don't call super().__init__()? That would seem unclean to me. On the contrary: calling super().__init__ when the superclass does something you don't want (i.e. raises a

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote: > On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch > wrote: >> For me it's not funny, at all. > > His description "funny" was in reference to the fact that you > described this as a bug. This is a heavily-used mature language; bugs > as f

xml data or other?

2012-11-09 Thread Artie Ziff
Hello, I want to process XML-like data like this: ACPI (Advanced Control Power & Integration) testscript for 2.5 kernels. <\description> ltp/testcases/kernel/device-drivers/acpi/ltpacpi.sh <\test_location> <\testname> After m

Re: Python3.3 str() bug?

2012-11-09 Thread Chris Angelico
On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch wrote: > For me it's not funny, at all. His description "funny" was in reference to the fact that you described this as a bug. This is a heavily-used mature language; bugs as fundamental as you imply are unlikely to exist (consequences of design de

Re: error

2012-11-09 Thread inshu chauhan
I attached a wrong file...Right file is attached here On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote: > > > > > http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and >> imported it using from notzanzibar import DataType. >> > > No i haven't downloaded it.. and this site is no

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote: > Am 08.11.2012 21:29, schrieb Terry Reedy: >> On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt >> wrote: On 3.3, it gives me a "TypeError: object.__init__() takes no parameters". To some extent, this makes sense to me, because t

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 7/11/12 01:13:47, Steven D'Aprano wrote: > On Tue, 06 Nov 2012 23:08:11 +, Prasad, Ramit wrote: > >> Steven D'Aprano wrote: >>> >>> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: >>> > To enter the newline, I typed Ctrl-Q to tell bash to treat the next > character as a lit

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 10:49:41 +0100, Hans Mulder wrote: > On 6/11/12 23:50:59, Steven D'Aprano wrote: >> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: >> To enter the newline, I typed Ctrl-Q to tell bash to treat the next character as a literal, and then typed Ctrl-J to get a

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Thomas Rachel
Am 31.10.2012 06:39 schrieb Robert Miles: For those of you running Linux: You may want to look into whether NoCeM is compatible with your newsreader and your version of Linux. This sounds as if it was intrinsically impossible to evaluate NoCeMs in Windows. If someone writes a software for

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote: > Helmut Jarausch, 09.11.2012 10:18: >> probably I'm missing something. >> >> Using str(Arg) works just fine if Arg is a list. >> But >> str([],encoding='latin-1') >> >> gives the error >> TypeError: coercing to str: need bytes, bytea

Re: error

2012-11-09 Thread inshu chauhan
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and > imported it using from notzanzibar import DataType. > No i haven't downloaded it.. and this site is not opening... > > Then you'd have instantiated it in some code like > data = DataType(filename) > > and then the type of dat

Relative imports in packages

2012-11-09 Thread Johannes Bauer
Hi list, I've these two minor problems which bothered me for quite some time, maybe you can help me. I'm using Python 3.2. For some project I have a component in its own package. Let's say the structure looks like this: pkg/__init__.py pkg/Foo.py pkg/Bar.py Foo.py and Bar.py contain their class

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
Thank you for all comments. > It makes very good sense to say: > > duckmatch(IFoo).compare(Foo) Since we do duck match of IFoo... but there is no `duck match`, there is `duck test`. I believe instead of `compare` is more readable with `equals`. Than it is more from mathematics - precise answer

RE: Writing game-state data...

2012-11-09 Thread Graham Fielding
> To: python-list@python.org > From: breamore...@yahoo.co.uk > Subject: Re: Writing game-state data... > Date: Fri, 9 Nov 2012 07:37:56 + > > On 09/11/2012 07:20, Graham Fielding wrote: > > > > Hey, folks, me again! I've been puzzling over this for a while now: I'm > > trying to write data

Re: Right solution to unicode error?

2012-11-09 Thread wxjmfauth
Le jeudi 8 novembre 2012 21:42:58 UTC+1, Ian a écrit : > On Thu, Nov 8, 2012 at 12:54 PM, wrote: > > > Font has nothing to do here. > > > You are "simply" wrongly encoding your "unicode". > > > > > '\u2013' > > > '–' > > '\u2013'.encode('utf-8') > > > b'\xe2\x80\x93' > > '\

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 6/11/12 23:50:59, Steven D'Aprano wrote: > On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: > >>> To enter the newline, I typed Ctrl-Q to tell bash to treat the next >>> character as a literal, and then typed Ctrl-J to get a newline. >> >> That sounds complicated, my version of bash let

Re: Python3.3 str() bug?

2012-11-09 Thread Stefan Behnel
Helmut Jarausch, 09.11.2012 10:18: > probably I'm missing something. > > Using str(Arg) works just fine if Arg is a list. > But > str([],encoding='latin-1') > > gives the error > TypeError: coercing to str: need bytes, bytearray or buffer-like object, >list found > > If this is

Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
Hi, probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or buffer-like object, list found If this isn't a bug how can I use str(Arg,encoding='latin-1')

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 08.11.2012 21:29, schrieb Terry Reedy: On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt wrote: On 3.3, it gives me a "TypeError: object.__init__() takes no parameters". To some extent, this makes sense to me, because the int subobject is not initialized in __init__ but in __new__. As a workar

Re: Writing game-state data...

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 12:20 AM, Graham Fielding wrote: > file_object = open('savegame.sav', 'wb') Here you open a file and assign it to "file_object". > file['map'] = map Here you attempt to write to "file" instead of "file_object". "file" is the name of a built-in type, hence your e