Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread AK
On 2018-05-10 13:52, D'Arcy Cain wrote: On 2018-05-10 07:39 AM, AK wrote: Try (should work from both PY2 and PY3): d0 = date(2018,0o2,0o1) Bad advice. Those numbers are decimal, not octal, You should use "date(2018,2,1)" here. Works in PY2, PY3 and for my birthday, Sept 4

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread AK
ntax error was reported and the correct result was returned. It is not a datetime problem. It is PY3 compatibility problem. Try (should work from both PY2 and PY3): d0 = date(2018,0o2,0o1) AK -- https://mail.python.org/mailman/listinfo/python-list

ANN: Python training "text movies"

2013-01-12 Thread AK
I don't know what to call these, so for now I'll call them "training text movies" until I come up with a better name.. I hope these will be helpful, especially to new students of Python. http://lightbird.net/larks/tmovies.html I'll be adding more in the next few days... - mitya -- http://

Unittest: how to pass information to TestCase classes?

2010-10-26 Thread AK
f the temp dir I created? The dir has to be created just once, before any tests run, and then multiple packages and multiple modules in them are imported and run. Thanks! -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-19 Thread AK
On 09/19/2010 10:32 PM, John Bokma wrote: AK writes: On 09/19/2010 07:18 PM, Gregory Ewing wrote: AK wrote: Afaik the idea is that you can read a novel at the speed of half a page a second or so and understand it to the same extent as people who'd read at a normal rate. I

Re: Too much code - slicing

2010-09-19 Thread AK
On 09/19/2010 07:18 PM, Gregory Ewing wrote: AK wrote: Afaik the idea is that you can read a novel at the speed of half a page a second or so and understand it to the same extent as people who'd read at a normal rate. I've never understood why anyone would *want* to read a novel

Re: Too much code - slicing

2010-09-19 Thread AK
On 09/19/2010 02:21 PM, Seebs wrote: On 2010-09-19, AK wrote: On 09/19/2010 03:31 AM, Seebs wrote: Just like: if condition: foo else: bar The condition is the primary, the clauses are secondary to it. To me, the problem with C ternary is, why is

Re: Too much code - slicing

2010-09-19 Thread AK
n the same way as punctuation might, but adding an additional layer which may be used but never gets in the way. -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-19 Thread AK
ething happen. After some time getting used to it, I'd end up seeing this as: . . . if .. else: . . . at first and then processing everything else. Again, syntax highlighting would help here. The only issue is that it'd be hard to separate the beginning from other code, for me that'd be the primary reason why this is not a good construct. -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-19 Thread AK
On 09/18/2010 11:28 PM, Steven D'Aprano wrote: On Sat, 18 Sep 2010 21:58:58 -0400, AK wrote: I don't understand this. So far as I know, the phrase "speed reading" refers to various methods of reading much faster than most people read, and is real but not exceptionally inte

Re: Too much code - slicing

2010-09-18 Thread AK
On 09/18/2010 10:12 PM, Seebs wrote: On 2010-09-19, AK wrote: On 09/18/2010 08:35 PM, Seebs wrote: News flash: Not all people think the same way. Film at 11. :) I've tried to use syntax coloring editors, and I've always found that they end up making me slower and less a

Re: Too much code - slicing

2010-09-18 Thread AK
On 09/18/2010 09:08 PM, Dennis Lee Bieber wrote: On Sat, 18 Sep 2010 20:00:32 -0400, AK declaimed the following in gmane.comp.python.general: Funny that you should say that, because I thought quite a few times that it would be really awesome if some texts in English had syntax highlighting

Re: Too much code - slicing

2010-09-18 Thread AK
On 09/18/2010 08:35 PM, Seebs wrote: On 2010-09-19, AK wrote: Funny that you should say that, because I thought quite a few times that it would be really awesome if some texts in English had syntax highlighting. Obviously, not Brothers Karamazov, but something like a tutorial, or a manual, or

Re: Too much code - slicing

2010-09-18 Thread AK
On 09/18/2010 07:38 PM, Seebs wrote: On 2010-09-18, AK wrote: On 09/18/2010 06:56 PM, Seebs wrote: Basically, I can handle do x if y pretty well, but do x if y else z always breaks my parser. So in English, I might say "I'll go to the store if I have time",

Re: Too much code - slicing

2010-09-18 Thread AK
On 09/18/2010 06:56 PM, Seebs wrote: On 2010-09-18, Steven D'Aprano wrote: On Fri, 17 Sep 2010 16:01:54 -0400, Andreas Waldenburger wrote: On Thu, 16 Sep 2010 16:20:33 -0400 AK wrote: I also like this construct that works, I think, since 2.6: code = dir[int(num):] if side == 'l

Re: Too much code - slicing

2010-09-16 Thread AK
side and slice accordingly. if side=='l': code = dir[int(num):] else : code = dir[:-1*int(num)] I also like this construct that works, I think, since 2.6: code = dir[int(num):] if side == 'l' else dir[:-1*int(num)] -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-19 Thread AK
ople deal with. It's just annoying that people bring up, for example, ground floor/ first floor as proof that both are equally natural. (I don't mean you, I know you said you agree that 1-th indexing is more intuitive). -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-18 Thread AK
On 08/17/2010 10:15 PM, Russ P. wrote: On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: Would said beginner also be surprised that a newborn baby is zero years old or would it be more natural to call them a one year old? Zero based counting is perfectly natural. You're confusing continuous and

Re: Python "why" questions

2010-08-18 Thread AK
On 08/17/2010 10:15 PM, Russ P. wrote: On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: Would said beginner also be surprised that a newborn baby is zero years old or would it be more natural to call them a one year old? Zero based counting is perfectly natural. You're confusing continuous and

Re: 79 chars or more?

2010-08-18 Thread AK
On 08/18/2010 05:11 AM, Stefan Schwarzer wrote: Hi Lie, On 2010-08-18 12:02, Lie Ryan wrote: On 08/17/10 12:59, AK wrote: On 08/16/2010 10:42 PM, James Mills wrote: My personal opinion (despite monitors being wider) is the horizontal scrolling isn't worth it. Stick to a 80-char width.

Re: 79 chars or more?

2010-08-17 Thread AK
On 08/17/2010 03:32 PM, Stefan Schwarzer wrote: Hi Andrei, On 2010-08-17 18:43, AK wrote: But let me ask you, would you really prefer to have: self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-

Re: 79 chars or more?

2010-08-17 Thread AK
On 08/17/2010 12:21 PM, Stefan Schwarzer wrote: On 2010-08-17 17:44, AK wrote: On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: I'd probably reformat this to self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text,

Re: 79 chars or more?

2010-08-17 Thread AK
re visible. Stefan Doesn't this create the problem of functions growing too long to fit in a screen? I think it's very useful to try to keep function size low enough so that you can view the whole function without having to scroll up and down. (even though that's not always possible) -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/17/2010 12:26 AM, James Mills wrote: On Tue, Aug 17, 2010 at 2:12 PM, AK wrote: There's no doubt that there are pro's and con's, but to be fair, it's not like code becomes unreadable over 79 chars - the difference is that when your terminal is 80 chars, it's l

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/16/2010 11:51 PM, Steven D'Aprano wrote: On Mon, 16 Aug 2010 22:35:49 -0400, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comf

Re: 79 chars or more?

2010-08-16 Thread AK
On 08/16/2010 10:42 PM, James Mills wrote: On Tue, Aug 17, 2010 at 12:35 PM, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to

79 chars or more?

2010-08-16 Thread AK
As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to work with that length, even though sometimes I have to edit files in 80 width terminals, it's stil

Python Tutorial

2010-08-13 Thread AK
similar to Django by Example: http://lightbird.net/dbe/ If you are interested and have a few years of experience with Python, drop me an email and we'll discuss this further... -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:59 PM, Grant Edwards wrote: > On 2010-06-18, AK wrote: > >> Here it is: >> >> Traceback (most recent call last): >> File "./vimp3_player.py", line 112, in >> Player().main() >> File "./vimp3_player.py", line

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 08:19 PM, Grant Edwards wrote: > On 2010-06-17, AK wrote: >> Hi, I'm trying to make a little mp3 server / client and I'm running into >> a problem with the Socket error 98 "Address already in use". The error >> doesn't happen right aw

Re: Socket error 98 "Address already in use"

2010-06-17 Thread AK
On 06/17/2010 07:21 PM, AK wrote: > Hi, I'm trying to make a little mp3 server / client and I'm running into > a problem with the Socket error 98 "Address already in use". The error > doesn't happen right away, I can send 3-4 commands, disconnecting and > recon

Socket error 98 "Address already in use"

2010-06-17 Thread AK
, socket.SO_REUSEADDR, 1) s.connect((HOST, PORT)) Thanks! -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread AK Eric
On Nov 12, 11:31 am, Terry Reedy wrote: > Alf P. Steinbach wrote: > > One reaction to >http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle > > graphics may be off-putting to some readers because it is associated > > with children's learning. > > > What do you think? > > I just star

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
On Nov 12, 10:10 am, Ethan Furman wrote: > AK Eric wrote: > > so: > > > # moduleA.py > > import moduleB > > > # moduleB.py > > import sys > > stuff = sys._getframe(1).f_locals > > print stuff > > > Prints: > > > {'__

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': , '__file__': 'C:\\Documents and SettingsMy Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks like you could query stuff['__file__']

Create video with text?

2009-11-11 Thread AK
Hi, what would be the best python package (or a framework that can be scripted in python) that can make a video with text moving around, jumping, zooming in/out and various other text effects? See the following link for an example: -- http://mail.py

Re: How can module determine its own path?

2009-10-30 Thread AK Eric
> > How can a module determine the path of the file that defines it? > > (Note that this is, in the general case, different from sys.argv[0].) > > __file__ Also: import inspect print inspect.getsourcefile(lambda:None) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 Global Variables

2009-10-30 Thread AK Eric
> > It isn't a neat trick anymore once you realize the name '__main__' > > isn't special. > > > Replace __main__ with foo, or config, or whatever, and you get the > > same results. Ok, there is a catch: a file with that name must exist, > > at least an empty one... True. I do feel a bit less spec

Re: Python 2.6 Global Variables

2009-10-29 Thread AK Eric
> Good that you're not advocating it, because IMHO it's bad practice to > have circular import dependencies.  By using the __main__ alias, you > avoid the worst problems, but that just means the others are more subtle. I figured I'd get that kind of response, not that it's incorrect ;) Great power

Re: Python 2.6 Global Variables

2009-10-29 Thread AK Eric
> 2/ in Python, "global" really means "module-level" - there's nothing > like a "true" global namespace. Isn't that __main__? import __main__ __main__.foo = "asdfasdf" print foo # asdfasdf Not advocating, but it does serve the purpose. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple audio

2009-10-21 Thread AK Eric
Yep, you can run it without any kind of GUI to my knowledge. -- http://mail.python.org/mailman/listinfo/python-list

Re: Skeletal animation

2009-10-04 Thread AK Eric
Building on what others have said and giving a +1 to Carl: I work daily in Maya doing character setup and rigging. As far as doing it straight in Python, again, like others, take a look at PyGame or Blender. I think the main question is: Do you want skeletal animation, or do you want skeletal an

Query screen resolution?

2009-08-28 Thread AK Eric
Thought this would be easy, maybe I'm missing something :) Trying to query the x,y resolution of my screen. I've seen this available through http://python.net/crew/mhammond/win32/ : from win32api import GetSystemMetrics print "width =", GetSystemMetrics (0) print "height =",GetSystemMetrics (1)

Re: How to 'de-slashify' a string?

2009-08-22 Thread AK
Vlastimil Brom wrote: 2009/8/22 AK : Vlastimil Brom wrote: 2009/8/22 AK : Steven D'Aprano wrote: On Sat, 22 Aug 2009 04:20:23 -0400, AK wrote: Hi, if I have a string '\\303\\266', how can I convert it to '\303\266' in a general way? It's not clear what you

Re: How to 'de-slashify' a string?

2009-08-22 Thread AK
Vlastimil Brom wrote: 2009/8/22 AK : Steven D'Aprano wrote: On Sat, 22 Aug 2009 04:20:23 -0400, AK wrote: Hi, if I have a string '\\303\\266', how can I convert it to '\303\266' in a general way? It's not clear what you mean. Do you mean you have a string &#x

Re: How to 'de-slashify' a string?

2009-08-22 Thread AK
Steven D'Aprano wrote: On Sat, 22 Aug 2009 04:20:23 -0400, AK wrote: Hi, if I have a string '\\303\\266', how can I convert it to '\303\266' in a general way? It's not clear what you mean. Do you mean you have a string '\\303\\266', that is: backsl

How to 'de-slashify' a string?

2009-08-22 Thread AK
eed a way to de-quote the slashes or alternatively some way to tell pygresql not to quote slashes for 'byte' fields. Any help, hints, etc appreciated.. -- AK -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sys.stout.flush()

2009-05-23 Thread AK
time.sleep(0.5) The idea is that it should print ONE, flush it, sleep .5 sec so that you can see 'ONE', then return to start of line, print TWO, flush it so you can read it, and sleep another 0.5 sec. NOTE comma after print statement. Does that work for you? -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: What do you think of ShowMeDo

2009-05-01 Thread AK
. So, how about a little kudos where it's due? A bit less nitpicking and a bit more appreciation? Just my humble opinion, that's all. (I'm not connected to the site in any way, I did watch a few dozen videos some time ago). -ak (rainy) -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-03-01 Thread ak
_fileobject.readline()) function.  For me it only fails > sometimes. > > This behavior is only observed on Windows, Python 2.5.  Running it on > Mac OS X, Python 2.5 yielded no problems. > > On Jan 19, 3:48 pm, ak wrote: > > > On Jan 19, 10:00 pm, ak wrote: > >

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-21 Thread ak
On Jan 20, 1:14 am, Steven D'Aprano wrote: > On Mon, 19 Jan 2009 13:00:44 -0800, ak wrote: > > Hi everyone, > > > I have a problem with urllib2 on this particular url, hosted on an > > Oracle HTTP Server > > >http://www.orange.sk/eshop/sk/portal/catalog.

Re: urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
On Jan 19, 10:00 pm, ak wrote: > Hi everyone, > > I have a problem with urllib2 on this particular url, hosted on an > Oracle HTTP Server > > http://www.orange.sk/eshop/sk/portal/catalog.html?type=post&subtype=p... > > which gets 302 redirected > tohttps://www.

urllib2 httplib.BadStatusLine exception while opening a page on an Oracle HTTP Server

2009-01-19 Thread ak
the cookie is not set yet, but trying with urllib2 gives the same exception as previously, whereas it should return the HTML error page) This works correctly on other urls on this website (http(s):// www.orange.sk). Am I doing anything wrong or is this a bug in urllib2 ? -- ak -- http://mail.python.org/mailman/listinfo/python-list

ANN: Tobu-0.5.0

2008-04-13 Thread AK
taller was added. Tobu's homepage is here: http://tobu.lightbird.net -- ak Tobu | http://tobu.lightbird.net/ | Freeform DB / Tagger / PIM Python-by-Example | http://pbe.lightbird.net/ | Guide to LibRef -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread AK
Max Erickson wrote: > AK <[EMAIL PROTECTED]> wrote: > >> Python-by-Example is a guide to LibRef, aiming to give examples >> for all functions, classes, modules, etc. Right now examples >> for functions in some of the most important modules are >> incl

Re: [ANN]: Python-by-Example updates

2008-04-12 Thread AK
Méta-MCI (MVP) wrote: > Hi! > Good! Thanks. > I found a bad link, for "traceback module" > @-salutations > > Michel Claveau > You're right! I forgot to upload that file, it's fixed now - thanks for noticing! -- -ak Tobu | http://tobu.lightbird.ne

[ANN]: Python-by-Example updates

2008-04-11 Thread AK
n of Python-by-Example: http://pbe.lightbird.net/ thanks, -- -ak Tobu | http://tobu.lightbird.net/ | Freeform DB / Tagger / PIM Python-by-Example | http://pbe.lightbird.net/ | Guide to LibRef -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-by-example - new online guide to Python Standard Library

2008-04-05 Thread AK
would be better than having people print out the guide and then either have print out again in a couple of weeks or stuck with using a very outdated guide. So, I think it will be one to three weeks at most before printable version is available.. Glad you like Python by Example!

Re: Python-by-example - new online guide to Python Standard Library

2008-04-04 Thread AK
shurik wrote: > that's great! thanks for putting this together. what about the inspect > module? and particularly getsource :) > Glad you like it! I will add every module eventually, but I'll put inspect up on top of todo list. -- -ak Tobu | http://tobu.lightbird

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread AK
AK wrote: > > I uploaded an updated site incorporating most of the suggestions I > received and fixing some errors along the way. I will be adding more > examples to modules that are already covered and will try to add more > modules during the following week. Thanks again to

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread AK
AK wrote: > Hello, > > I find that I learn easier when I go from specific examples to a more > general explanation of function's utility and I made a reference guide > that will eventually document all functions, classes and methods in > Python's Standard Library.

Re: Python-by-example - new online guide to Python Standard Library

2008-04-02 Thread AK
CM wrote: > On Apr 2, 2:50 pm, AK <[EMAIL PROTECTED]> wrote: >> Terry Reedy wrote: >>> "AK" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> || I'll be glad to hear comments/suggestions/etc: >>> | >&g

Re: Python-by-example - new online guide to Python Standard Library

2008-04-02 Thread AK
Terry Reedy wrote: > "AK" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > || I'll be glad to hear comments/suggestions/etc: > | > | http://www.lightbird.net/py-by-example/ > > Using - as the example/return delimiter does not work. &

Python-by-example - new online guide to Python Standard Library

2008-04-01 Thread AK
t modules. I will be adding more modules and eventually I'll cover everything. Here's my progress so far, let me know if this is useful; I'll be glad to hear comments/suggestions/etc: http://www.lightbird.net/py-by-example/ -- -ak Tobu | http://www.lightbird.net/tobu/ | F

ANN: Tobu 0.4j

2008-03-24 Thread AK
This is an initial announcement. Tobu is a freeform database / tagger / PIM and more. It works in both Linux and Windows and uses wxPython framework and pysqlite. Comments, suggestions, feature requests and critique are gladly appreciated. Tutorial with links to download page and to graphical o

Re: Tkinter question.

2006-06-17 Thread ak
Update: I found a way to do what I want with RadioButton with option indicatoron=0 which creates a bunch of what looks like regular buttons except that when one is pressed the other one is depressed and the value of the same variable is changed. Thanks dear me. [EMAIL PROTECTED] wrote: > Hi, I'd

Tkinter question.

2006-06-17 Thread ak
Hi, I'd like to create buttons on the fly that will call the same function, and the function in question has to know what was the name of the button that called it. Unless there is a preferred way for doing this.. Perhaps creating a new function on the fly along with the new button? Please help.. t