[issue43171] Counter not supported add in Python 3.x

2021-02-08 Thread Frank AK
New submission from Frank AK : In python 3.10, you couldn't plus two Counter instance, you will got the below tip: ``` >>> from collections import Counter >>> x={1:['a','b','c']} >>> y={1:['d','e','f'],2:['g']} >>> Counter(y) + Counter(x) Traceback (most

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. I

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

2018-05-10 Thread AK
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 --

Unittest: how to pass information to TestCase classes?

2010-10-26 Thread AK
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/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 interesting. Afaik

Re: Too much code - slicing

2010-09-19 Thread AK
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

Re: Too much code - slicing

2010-09-19 Thread AK
in 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
the 'if: .. else: ' version. ;) -ak -- http://mail.python.org/mailman/listinfo/python-list

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 that fast

Re: Too much code - slicing

2010-09-19 Thread AK
On 09/19/2010 10:32 PM, John Bokma wrote: AKandrei@gmail.com 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

Re: Too much code - slicing

2010-09-18 Thread AK
to another ident level. By the way, it also looks far more readable in an editor where if and else would be highlighted vs. all in plain colour. -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-18 Thread AK
speed reading, except real! -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-18 Thread AK
extent as people who'd read at a normal rate. Woody Allen joke: I learned speed reading and read WarPeace; - it involves Russia. -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-18 Thread AK
the text, then syntax highlight of all nouns, do another quick scan, and then turn off syntax highlight and concentrate on the parts that you did not understand while scanning. Is there a program that'd do something like that? -ak -- http://mail.python.org/mailman/listinfo/python-list

Re: Too much code - slicing

2010-09-18 Thread AK
already know the last sentence ended. In the same way, in many cases other punctuation is not absolutely necessary for understanding. The other thing is of course that it helps you not to name your variables using keywords and spot misspelled keywords. -ak -- http://mail.python.org/mailman

Re: Too much code - slicing

2010-09-16 Thread AK
is check the 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

Re: Python why questions

2010-08-19 Thread AK
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: 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: 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. Cainda...@druid.net 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

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. Cainda...@druid.net 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

Re: 79 chars or more?

2010-08-17 Thread AK
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-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, '%Y-%m-%d', '%m

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-%m-%d', '%m%d%Y

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

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, AKandrei@gmail.com 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

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 comfortable

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, AKandrei@gmail.com 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 less

Python Tutorial

2010-08-13 Thread AK
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

Socket error 98 Address already in use

2010-06-17 Thread AK
)) Thanks! -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 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 reconnecting and they work fine and then I get

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 a...@nothere.com 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

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 a...@nothere.com wrote: Here it is: Traceback (most recent call last): File ./vimp3_player.py, line 112, in module Player().main() File ./vimp3_player.py, line 35, in main self.listen() File ./vimp3_player.py

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__': module '__builtin__' (built-in), '__file__': 'C:\\Documents and Settings\\userName\\My Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks

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 et...@stoneleaf.us wrote: AK Eric wrote: so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': module '__builtin__' (built-in), '__file__': 'C:\\Documents

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread AK Eric
On Nov 12, 11:31 am, Terry Reedy tjre...@udel.edu wrote: Alf P. Steinbach wrote: One reaction to url: url: 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?

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://www.youtube.com/watch?v=ejweI0EQpX8 --

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 special now

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

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

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)

How to 'de-slashify' a string?

2009-08-22 Thread AK
not to quote slashes for 'byte' fields. Any help, hints, etc appreciated.. -- AK -- http://mail.python.org/mailman/listinfo/python-list

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: backslash backslash three zero three backslash

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

2009-08-22 Thread AK
Vlastimil Brom wrote: 2009/8/22 AK a...@nothere.com: Vlastimil Brom wrote: 2009/8/22 AK a...@nothere.com: 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: Problems with sys.stout.flush()

2009-05-23 Thread AK
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
, 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
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 akte...@gmail.com wrote: On Jan 19, 10:00 pm, ak akte...@gmail.com wrote: Hi everyone, I have a problem withurllib2on this particular url, hosted on an Oracle HTTP Server

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 ste...@remove.this.cybersource.com.au 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.html? type

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

2009-01-19 Thread ak
anything wrong or is this a bug in urllib2 ? -- ak -- http://mail.python.org/mailman/listinfo/python-list

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 akte...@gmail.com 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=postsubtype=p... which gets 302 redirected tohttps://www.orange.sk/eshop/sk/catalog

[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-01-19 Thread ak
New submission from ak akte...@gmail.com: https://www.orange.sk/ is served by an Oracle HTTPS server, and works with firefox or opera but not urllib2. code snippet: import cookiejar import urllib2 cookiejar = cookielib.LWPCookieJar() opener = urllib2.build_opener(urllib2

ANN: Tobu-0.5.0

2008-04-13 Thread AK
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
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.net/ | Freeform DB / Tagger / PIM Python-by-Example

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 included. http://pbe.lightbird.net/ thanks, The second

[ANN]: Python-by-Example updates

2008-04-11 Thread AK
://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
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! thx, -- -ak Tobu | http://tobu.lightbird.net

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.net/ | Freeform DB / Tagger

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. For now, I covered about 20 most

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 all who posted advice

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. If you do not want to substantially lengthen the document

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: | |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
. 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/ | Freeform DB / Tagger / PIM

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

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