Re: Correct type for a simple "bag of attributes" namespace object

2014-08-04 Thread Marko Rauhamaa
Ian Kelly : > In my experience, 99% of the time when anonymous classes are used, > they only contain one method. [...] > >> def A(x, y, z): >> d = y * y + z * z >> >> class Anonymous: >> def f(self): >> return x - d >> >> return Anonymous() >

Re: CodeSkulptor

2014-08-04 Thread Terry Reedy
On 8/3/2014 10:07 PM, Seymore4Head wrote: I run Win7 Just get 3.4.1 and install it on win 7. works great. and like to keep it lean Avoid 25 mb python install is more like keeping it anorexic ;-). Python will not bite or squeeze your machine. > so I also have an XP machine that I use for

Re: Python Programing for the Absoulte Beginner

2014-08-04 Thread Mark Lawrence
On 04/08/2014 07:30, Bob Martin wrote: in 726123 20140803 090919 Steven D'Aprano wrote: Steve Hayes wrote: I've got too big an investment in books on Python 2, and there are no books available on Python 3 (I don't regard downloadable PDFs or other onlines stuff as "books"). I love Python 3

Re:how to call back a method ?

2014-08-04 Thread Dave Angel
elearn Wrote in message: > I want to call back a function which is the method of a class . > > def callback(self.do,x): > return(self.do(x)) > > That is what i want to write,when i input > > def callback(self.do,x): > > error message: > > >File "", line 1 >

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Terry Reedy
On 8/3/2014 6:52 PM, Wiktor wrote: Hi, as OO programming exercise, I'm trying to port to Python one of my favorite game from early'90 (Atari 65XL/XE) - Kolony (here's video from original version on C64 https://www.youtube.com/watch?v=UFycYOp2cbE, and here's This appears to be an actual text s

Python Classes

2014-08-04 Thread Shubham Tomar
Hi, Python is the first programming language that I'm learning. I'm confused by the idea of classes and intimidated by syntax defining classes. I understand that you define classes to have re-usable methods and procedures, but, don't functions serve the same purpose. Can someone please explain the

Re: CodeSkulptor

2014-08-04 Thread Chris “Kwpolska” Warrick
On Mon, Aug 4, 2014 at 4:08 AM, Seymore4Head wrote: > I am just going to run 3.3 remotely. Why and why? 3.3 is an old, outdated version — the most recent version is v3.4.1. By running 3.3 you are missing out on some new features, and bugfixes. You are better off running v3.4.1. The other “why

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Chris “Kwpolska” Warrick
On Mon, Aug 4, 2014 at 2:17 AM, Glenn Linderman wrote: > For this OP problem, it is mostly a matter of finding a fixed-width font > that supports the box drawing characters and the Polish characters that are > desired. Lucida Console has a fair repertoire, and Consolas has a fair > repertoire, in

Re: Python Classes

2014-08-04 Thread Terry Reedy
On 8/4/2014 4:40 AM, Shubham Tomar wrote: Hi, Python is the first programming language that I'm learning. I'm confused by the idea of classes and intimidated by syntax defining classes. I understand that you define classes to have re-usable methods and procedures, but, don't functions serve the

Re: Tcl/Tk alpha channel bug on OSX Mavericks is fixeded, but how/when can I use the fix?

2014-08-04 Thread Peter Tomcsanyi
"Kevin Walzer" wrote in message news:lrmc0r$suj$1...@dont-email.me... New releases of Tcl/Tk 8.5 and 8.6 are due out soon; right now they are undergoing final testing as betas/release candidates. Thanks for the promising news. Where should I look for the announcement that there is something ne

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Glenn Linderman
On 8/3/2014 10:06 PM, Andrew Berg wrote: On 2014.08.03 23:14, Glenn Linderman wrote: Having read a bit about ConEmu, it seems that it is a "pretty face" built on top of Windows Console, by screen scraping the real (but hidden) Windows Console, and providing a number of interesting display featur

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Glenn Linderman
On 8/4/2014 1:39 AM, Terry Reedy wrote: On 8/3/2014 6:52 PM, Wiktor wrote: Hi, as OO programming exercise, I'm trying to port to Python one of my favorite game from early'90 (Atari 65XL/XE) - Kolony (here's video from original version on C64 https://www.youtube.com/watch?v=UFycYOp2cbE, and h

typo correction

2014-08-04 Thread Peter Tomcsanyi
Now I see that I wrote a quite unreadable typo: "unterd". I meant "untared". Peter Tomcsanyi -- https://mail.python.org/mailman/listinfo/python-list

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wolfgang Maier
On 08/04/2014 11:53 AM, Glenn Linderman wrote: I've never used the API from Python but random console access is documented at http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx Would using the API from Python involve doing the wrapping yourself or do you know

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Andrew Berg
On 2014.08.04 04:46, Glenn Linderman wrote: > How does one "directly run" another application using ConEmu? That wasn't > clear > from what I found to read. It sounded like you run ConEmu, run one or more > shells within it, and launch programs from those shells? And so it was also > unclear if a

testfixtures 4.0.1 Released!

2014-08-04 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.0.1. This is a bugfix release that fixes the following two edge cases: - Fix bugs when string compared equal and options to compare() were used. - Fix bug when strictly comparing two nested structures containing identical objec

Davis putnam algorithm for satisfiability...

2014-08-04 Thread varun7rs
Hello friends, I have some trouble understanding the davis putnam algorithm for satisfiability. I understood most of the code but I don't know where exactly backtracking is happening here. Your assistance would be very helpful to me. import sys import math import copy final_list = [] def sat

Re: Tcl/Tk alpha channel bug on OSX Mavericks is fixeded, but how/when can I use the fix?

2014-08-04 Thread Kevin Walzer
On 8/4/14, 5:40 AM, Peter Tomcsanyi wrote: "Kevin Walzer" wrote in message news:lrmc0r$suj$1...@dont-email.me... New releases of Tcl/Tk 8.5 and 8.6 are due out soon; right now they are undergoing final testing as betas/release candidates. Thanks for the promising news. Where should I look for

Will IronPython / WPF work on Mac OS X?

2014-08-04 Thread danwgrace
Hello, I am thinking of using IronPython to build an Python application. Using WPF in Visual Studio to draw the GUI and create the XAML. Can I then run this Python application on a Mac OS X (10.8)? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: CodeSkulptor

2014-08-04 Thread Peter Otten
Chris Angelico wrote: > On Mon, Aug 4, 2014 at 1:03 PM, Steven D'Aprano > wrote: >I think it's not a bug, but a restriction; since it's letting you run >code on their server, and since Python sandboxing is a hard problem, >CodeSkulptor cuts down the available modules. From the docs: >

creating log file with Python logging module

2014-08-04 Thread Arulnambi Nandagoban
Hello all, I am using logging module for my application to log all debug information. I configured it create a new log file every day with "TimedRotatingFileHandler". I display debug message in console as well. But I didn't see creation of new file. Can someone help me to sort out this proble

Re: Will IronPython / WPF work on Mac OS X?

2014-08-04 Thread Benjamin Kaplan
On Aug 4, 2014 6:23 AM, wrote: > > Hello, > I am thinking of using IronPython to build an Python application. Using WPF in Visual Studio to draw the GUI and create the XAML. Can I then run this Python application on a Mac OS X (10.8)? > Thanks. > -- Nope. IronPython on Mac runs on top of Mono, s

Re: Will IronPython / WPF work on Mac OS X?

2014-08-04 Thread Kevin Walzer
On 8/4/14, 8:17 AM, danwgr...@gmail.com wrote: Hello, I am thinking of using IronPython to build an Python application. Using WPF in Visual Studio to draw the GUI and create the XAML. Can I then run this Python application on a Mac OS X (10.8)? Thanks. IronPython is a Windows-only product,

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Arulnambi Nandagoban wrote: > I am using logging module for my application to log all debug information. > I configured it create a new log file every day with > > "TimedRotatingFileHandler". I display debug message in console as well. > But I didn't see creation of new file. Is the script run

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Peter Otten wrote: > You won't see a rollover if you restart it. Sorry, I tried it and the above statement is wrong. -- https://mail.python.org/mailman/listinfo/python-list

Re: creating log file with Python logging module

2014-08-04 Thread Peter Otten
Peter Otten wrote: > Peter Otten wrote: > >> You won't see a rollover if you restart it. > > Sorry, I tried it and the above statement is wrong. [Arulnambi Nandagoban] > logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - > %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level

Re: CodeSkulptor

2014-08-04 Thread Chris Angelico
On Mon, Aug 4, 2014 at 10:39 PM, Peter Otten <__pete...@web.de> wrote: >> (Idea, for anyone who runs a sandbox like that: Enumerate all packages >> and modules in the stdlib, and create a little stub for each of them. >> "import blahblah" will still produce ImportError, but "import >> datetime" cou

Re: Python Programing for the Absoulte Beginner

2014-08-04 Thread Chris Angelico
On Mon, Aug 4, 2014 at 3:30 PM, Bob Martin wrote: > With American English being 2.7 ?? > Sorry, but someone had to ask :-) A fairer comparison would be American English is IronPython, British English is PyPy. Mostly compatible, and people call them both Python, but not strictly identical. Chris

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wiktor
Hi, first, thank you all for responses. I decided to just use single line frame around menu. Yes, those double+single line corners work fine in ConEmu, but I don't want this Python script to be dependent on external program. Maybe one day it will be worth of showing to others, and it's silly to t

Re: try/exception - error block

2014-08-04 Thread Grant Edwards
On 2014-08-03, Roy Smith wrote: > In article , > Mark Lawrence wrote: > >> How to go about this is at "Short, Self Contained, Correct (Compilable), >> Example" at http://sscce.org/ > > It says there, "most readers will stop reading by 100 lines of code". I > guess I have a short attention spa

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wolfgang Maier
On 08/04/2014 05:00 PM, Wiktor wrote: Hi, first, thank you all for responses. I decided to just use single line frame around menu. Yes, those double+single line corners work fine in ConEmu, but I don't want this Python script to be dependent on external program. Maybe one day it will be worth

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wiktor
On Mon, 04 Aug 2014 17:43:41 +0200, Wolfgang Maier wrote: >>I'm not starting from scratch. I'm using packages 'termcolor', 'colorama' >> and 'colorconsole' - they provide functions to print text at desired >> position on screen, and change color of foreground/background of this text. > > Than

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Chris Angelico
On Tue, Aug 5, 2014 at 2:48 AM, Wiktor wrote: > From colorama I just use one function - init(). Without this > initialization all those ansii escape characters (used by colorama itself, > but also by termcolor.colored()) don't work in cmd.exe. At least I couldn't > make it work. I dug into colo

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wiktor
On Tue, 5 Aug 2014 03:06:41 +1000, Chris Angelico wrote: > On Tue, Aug 5, 2014 at 2:48 AM, Wiktor wrote: >> From colorama I just use one function - init(). Without this >> initialization all those ansii escape characters (used by colorama itself, >> but also by termcolor.colored()) don't work i

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Glenn Linderman
On 8/4/2014 3:33 AM, Andrew Berg wrote: If you want to save your users the hassle, I would definitely recommend a graphical environment. If I had realized that you intended your application to be widely deployed, I would have simply recommended that from the start. Graphical environments are go

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Glenn Linderman
On 8/4/2014 3:24 AM, Wolfgang Maier wrote: On 08/04/2014 11:53 AM, Glenn Linderman wrote: I've never used the API from Python but random console access is documented at http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx Would using the API from Python invol

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Terry Reedy
On 8/4/2014 11:00 AM, Wiktor wrote: Yes, I'd like to make text game, that looks like window-based, with popup boxes, inactive windows grayed out and all this stuff. And all this running on standard console window (cmd.exe). Your problem doing this is that cmd.exe is not a standard since 30

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Terry Reedy
On 8/4/2014 6:24 AM, Wolfgang Maier wrote: On 08/04/2014 11:53 AM, Glenn Linderman wrote: I've never used the API from Python but random console access is documented at http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx Would using the API from Python involve

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Grant Edwards
On 2014-08-04, Glenn Linderman wrote: > I believe that most Unix terminal emulators, which are used for running > shells and command lines, support cursor controls, and I believe most of > them have a mode that emulates the DEC VT-52 terminal, I'm not aware of any that are in common use, but t

Re: Tcl/Tk alpha channel bug on OSX Mavericks is fixeded, but how/when can I use the fix?

2014-08-04 Thread Peter Tomcsanyi
Many thanks for all the answers. "Kevin Walzer" wrote in message news:lrntjm$bma$1...@dont-email.me... Where is your current installation of Python? The above instructions assume that you are using the standard Python from python.org. As I mentioned before, if you have installed things via a

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Terry Reedy
On 8/4/2014 1:22 PM, Wiktor wrote: On Tue, 5 Aug 2014 03:06:41 +1000, Chris Angelico wrote: On Tue, Aug 5, 2014 at 2:48 AM, Wiktor wrote: From colorama I just use one function - init(). Without this initialization all those ansii escape characters (used by colorama itself, but also by term

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Chris Angelico
On Tue, Aug 5, 2014 at 5:17 AM, Terry Reedy wrote: > Is there no working codepage with ascii text and the line chars? I suppose I > am not surprised if not. That would be codepage 437. I grew up with that on DOS, as the one and only 256-character set, and then when we moved to OS/2 and actual cod

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Wiktor
On Mon, 04 Aug 2014 15:17:04 -0400, Terry Reedy wrote: >>I'm taking next step, so I tried to draw nice frame around menu (that's >> why I posted yesterday). > > Is there no working codepage with ascii text and the line chars? I > suppose I am not surprised if not. With single line (└┘┌┐─│

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Christian Gollwitzer
Am 04.08.14 01:08, schrieb Chris Angelico: On Mon, Aug 4, 2014 at 8:52 AM, Wiktor wrote: I have to ask - is there a way to make that original concept work? I know, that CP437 has symbols "╖", "╢" and "╘", but does not have polish letters - and I need to display them too. Yeah, that's exactly

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread giacomo boffi
Wiktor writes: > I'm not starting from scratch. I'm using packages 'termcolor', 'colorama' > and 'colorconsole' the 'urwid' package could be useful for similar projects but requires Linux, OSX, Cygwin or other unix-like OS so I guess it's of no use for you... ciao

Re: Python Classes

2014-08-04 Thread John Gordon
In Shubham Tomar writes: > classes. I understand that you define classes to have re-usable methods and > procedures, but, don't functions serve the same purpose. > Can someone please explain the idea of classes If a function simply accepts some data, does some calculations on that data and th

Re: Davis putnam algorithm for satisfiability...

2014-08-04 Thread Cameron Simpson
On 04Aug2014 04:51, varun...@gmail.com wrote: I have some trouble understanding the davis putnam algorithm for satisfiability. I understood most of the code but I don't know where exactly backtracking is happening here. Your assistance would be very helpful to me. At a glance, in the bottom p

Re: Python Classes

2014-08-04 Thread Terry Reedy
On 8/4/2014 6:44 PM, John Gordon wrote: __init__() is the initializer method, which is called as one step of creating a class object. In fact, it is the last step and usually is the main step for user-defined classes, and the only step one need be concerned with. Object is the lowest-level

Re: try/exception - error block

2014-08-04 Thread Cameron Simpson
On 03Aug2014 10:39, Roy Smith wrote: In article , bruce wrote: I'm posting the test code I'm using. Pointers/comments would be helpful/useful. It would be really helpful if you could post a minimal code example which demonstrates the problem you're having. Leave out everything (including th

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Akira Li
Wiktor writes: > On Mon, 04 Aug 2014 15:17:04 -0400, Terry Reedy wrote: > >>>I'm taking next step, so I tried to draw nice frame around menu (that's >>> why I posted yesterday). >> >> Is there no working codepage with ascii text and the line chars? I >> suppose I am not surprised if not. > >

TypeError: 'bytes' object is not callable error while trying to converting to bytes.

2014-08-04 Thread Satish ML
Hi, >>>import struct >>>file = open('data.bin', 'rb') >>>bytes = file.read() >>> records = [bytes([char] * 8) for char in b'spam'] Traceback (most recent call last): File "", line 1, in records = [bytes([char] * 8) for char in b'spam'] File "", line 1, in records = [bytes([char] * 8

Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.

2014-08-04 Thread Ben Finney
Satish ML writes: > >>>import struct > >>>file = open('data.bin', 'rb') Here you re-bind the name ‘file’ to the return value from that call. > >>>bytes = file.read() Here you re-bind the name ‘bytes’ to the return value from that call. > >>> records = [bytes([char] * 8) for char in b'spam']

Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.

2014-08-04 Thread Chris Angelico
On Tue, Aug 5, 2014 at 3:47 PM, Satish ML wrote: bytes = file.read() You've just shadowed the built-in type 'bytes' with your own 'bytes'. Pick a different name for this, and you'll be fine. 'data' would work. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Classes

2014-08-04 Thread dieter
Shubham Tomar writes: > Python is the first programming language that I'm learning. > I'm confused by the idea of classes and intimidated by syntax defining > classes. I understand that you define classes to have re-usable methods and > procedures, but, don't functions serve the same purpose. As