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
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
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
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
--
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
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
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
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
the 'if: .. else: ' version. ;)
-ak
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
speed reading, except real!
-ak
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
))
Thanks! -ak
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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?
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
--
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
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
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
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
Yep, you can run it without any kind of GUI to my knowledge.
--
http://mail.python.org/mailman/listinfo/python-list
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
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)
not to quote slashes for 'byte' fields.
Any help, hints, etc appreciated..
--
AK
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
, 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
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
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
anything wrong or is this a bug in urllib2 ?
-- ak
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
://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
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
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
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
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
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
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
. 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
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
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..
67 matches
Mail list logo