datetime

2012-09-13 Thread Max
How do I set the time in Python? Also, is there any *direct* way to shift it? Say, it's 09:00 now and Python makes it 11:30 *without* me having specified "11:30" but only given Python the 2h30m interval. Note that any "indirect" methods may need complicated ways to keep track of the milliseconds

Re: extended slicing and negative stop value problem

2011-08-20 Thread Max
On Aug 20, 11:29 am, Chris Angelico wrote: > If you're using a variable for the stop value, you just need to set it > to an explicit None if it would fall negative: > > >>> a[10:None:-1] > That doesn't work if it's set in a loop or if it's calculated as a formula. For example, this very simple co

Re: extended slicing and negative stop value problem

2011-08-21 Thread Max
On Aug 20, 1:40 pm, Steven D'Aprano wrote: > Pardon me for breaking threading, but I don't have Max's original post. Not sure why; I also can't see it! I'll copy it at the end just in case. > On Sat, Aug 20, 2011 at 7:20 PM, Max Moroz wrote: > > Wou

Re: Using Which Version of Linux

2005-11-06 Thread Max
[EMAIL PROTECTED] wrote: > ok, i m going to use Linux for my Python Programs, mainly because i > need to see what will these fork() and exec() do. So, can anyone tell > me which flavour of linux i should use, some say that Debian is more > programmer friendly, or shold i use fedora, or Solaris.

Re: Annoying behaviour of the != operator

2005-06-23 Thread Max
Jordan Rastrick wrote: > I don't want to order the objects. I just want to be able to say if one > is equal to the other. > > Here's the justification given: > > The == and != operators are not assumed to be each other's > complement (e.g. IEEE 754 floating point numbers do not satisf

Re: Newbie question: Explain this behavior - a followup

2005-07-15 Thread max
ad/d6c084e791a00 2f4?q=for+else&hl=en& for a good explanation of when the else part of the loop is executed. Basically, whenever the loop is exited normally, which is what happens when you iterate over an empty list like the one returned by range(1,1) max -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with images

2005-07-18 Thread max
l/ http://www.pythonware.com/library/pil/handbook/ but also be sure to read the "Setting Capababilities" section of this document: http://twainmodule.sourceforge.net/docs/caps.html max -- http://mail.python.org/mailman/listinfo/python-list

Re: UCALC equivalent

2005-08-12 Thread max
s mathematical expressions and is callable from python code. max -- http://mail.python.org/mailman/listinfo/python-list

servers in python

2005-08-19 Thread Max
isk of any hacking, or of this becoming an open relay? --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Light Revisted?

2005-08-21 Thread Max
The Windows XP version of Java > at java.com is 16+ MB, and the .NET framework is, well, I don't know > how big, but I doubt it's much less than 10MB. > AFAIR, it's closer to 50MB. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Code run from IDLE but not via double-clicking on its *.py

2005-08-30 Thread max
tart->Run: command.com on 95/98) and then either type the full path to the script or navigate to it and execute it. max -- http://mail.python.org/mailman/listinfo/python-list

Python scope is too complicated

2005-03-20 Thread Max
Yeah, I know. It's the price we pay for forsaking variable declarations. But for java programmers like me, Py's scoping is too complicated. Please explain what constitutes a block/namespace, and how to refer to variables outside of it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-20 Thread Max
banana" is a song about working on plantations in Jamaica). It may be more common in UK English. There's an expression "tally-ho!" which had something to do with British fox hunts, but they don't have those any more. Has anyone _not_ heard Jeff Probst say, "I'l

Re: Refactoring a generator function

2004-12-04 Thread max
Kent Johnson <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Here is a simple function that scans through an input file and > groups the lines of the file into sections. Sections start with > 'Name:' and end with a blank line. The function yields sections > as they are found. > > def make

Resticted mode still active (error?)

2005-04-06 Thread Max
ating file from main thread... Done Creating file from sub thread... Done Has anyone got any ideas about this? Thanks in advance, Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Resticted mode still active (error?)

2005-04-07 Thread Max
Not that I know of - the problem only seems to occur when using the Python C API. I'm trying to come up with a C programs that shows the error but it'll take a few days to set up the emvironment. >"Jeff Epler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- http://mail.python.or

Re: How to name Exceptions that aren't Errors

2005-04-07 Thread Max
YONE, it's Leo Breebart. This guys famous in the alternative universe of alt.fan.pratchett. You are the same Leo Breebart, right? Well done, APF9 is excellent. But what did we expect. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: What is unique about Python?

2005-12-23 Thread Max
atural way of doing things, the textbook has to kludge because its target audience is C++, Java and Pascal programmers. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumeration idioms: Values from different enumerations

2005-12-23 Thread Max
; happened to have written pizza first instead of last? What meaning do you give to True**False? > > The fact that they can be counted shouldn't fool you into thinking they > are numbers. > > > --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting milliseconds to human amount of time

2006-01-07 Thread Max
do - I haven't tested it). It's not strictly accurate (from a scientific/UTC perspective, as some minutes have 59 or 61 seconds rather than 60, but it's probably the best you need. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-14 Thread Max
o they can be displayed. > > > He can still store the repr of the string into the database, and then > reconstruct it with eval: > Yes, but len(repr('\x00')) is 4, while len('\x00') is 1. So if he uses BLOB his data will take almost a quarter of the space, compa

Re: Is 'everything' a refrence or isn't it?

2006-01-17 Thread Max
t; Except that what is passed is not "ham['spam'][0].eggs()[42]" - that's the *name of where one copy of the objects name is*. The name is ham['spam'][0].eggs()[42].id() - usually something like 0xBEEFBABE. When I fill in a form (say if I applied for a visa) - th

httplib.ResponseNotReady question

2006-11-13 Thread Max
than 1 then I get the error. Is there a method call that I need to restore the requestor object to a condition where it's eligible to receive another response? Thanks, Max -- http://mail.python.org/mailman/listinfo/python-list

Re: httplib.ResponseNotReady question

2006-11-13 Thread Max
Fredrik Lundh wrote: > Max wrote: > > > If I run this with loops=1 then everything works fine. If I use a > > number greater than 1 then I get the error. Is there a method call > > that I need to restore the requestor object to a condition where it's > > e

Re: Python for Visual Basic or C# programmers

2006-06-01 Thread Max
Metalone wrote: > > This might be a little too tricky. > [" %d", "%d][n < 0] % n --> selects list[0] or list[1] based upon sign > of number > ("%+d" % 123).replace("+", " ") is slightly longer but instantly comprehensible, alt

Re: how to create a cgi folder???

2006-06-01 Thread Max
n this PC), so if I managed to do it, it must have been in the apache docs or python docs (and I did manage). --Max -- http://mail.python.org/mailman/listinfo/python-list

if not CGI:

2006-06-01 Thread Max
arned it because I had incentive (3 local monetary units in the computer olympiad; I won 1). Is RoR incentive enough? --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: if not CGI:

2006-06-04 Thread Max
Bruno Desthuilliers wrote: > Max a écrit : (snip) > > RoR is not bad, but really over-hyped. There's no shortage of at least > as good solutions in Python. You may want to look at Django, Turbogears, > Pylons, web.py etc. for fullstack MVC frameworks. That's what I tho

Re: newbie: python application on a web page

2006-06-06 Thread Max
o you would have an HTML form on the page, and on clicking a button, load the graph (into an "iframe" or something perhaps [I have a feeling iframes have been deprecated - check first]). In which case you'd want to look up CGI, AJAX, etc. --Max -- http://mail.python.org/mailman/listinfo/python-list

Printing HTML

2006-01-27 Thread Max
ccess ODBC), so if it can be done easily in one of those, that'd be great, but if there's a module which makes it a breeze, I'm happy to download that too. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: 2-dimensional data structures

2006-01-27 Thread Max
rray, which can be nice (actually I think it's the main advantage over lists of lists): print grid[colNo, rowNo] > > Claudio --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing HTML

2006-01-27 Thread Max
Rene Pijlman wrote: > Max <[EMAIL PROTECTED]>: > >>How can I print (as in laser printer, not the python print statement) >>HTML from Python > > > Is the printer attached to your server, or are you printing over the > internet? > I'm not sure i

Re: Returning a value from code string

2006-01-28 Thread Max
launch attacks on other computers, and than attack my computer". Unless you have some revolutionary ideas in code-security analysis. In which case you can a lot more money than from implementing Everything2 in python. > -Kirk McDonald --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: generating method names 'dynamically'

2006-01-29 Thread Max
> I wouldn't think so, as long as Klass doesn't have /other/ methods - as long as it only has methods that are meant to be viewed externally. Which would probably not be the way one would ordinarily write the class, but if one knew one had to, one should be fine. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: stumped by tricky logic

2006-01-29 Thread Max
ursive function to read the file, and pass the containing Style object to it. It reads the props into the class, and recurses on any "sub-styles". After this, you'll have constructed a tree (keep a reference to root). Now you can use an extension of a standard pre-order traversal to output it. > - Dave > Hope this helps. --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators vs. Functions?

2006-02-04 Thread Max
me. > > Whether or not the difference is that significant though I am unsure. It > may be small enough that for most applications no one cares. I just wrote an application which retrieves values from a 300mb database, and got a significant speedup using iterators. --Max -- http:/

Should we still be learning this?

2006-02-18 Thread Max
later. I don't think this is good: list comprehensions are, IMO, one of Python's great features, Psyco prefers them, they're more pythonic, and map and filter seem to be going out the window for Python 3000. What do you think? --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Should we still be learning this?

2006-02-18 Thread Max
Felipe Almeida Lessa wrote: > Em Sáb, 2006-02-18 às 14:38 +0200, Max escreveu: > > Urgh. This sucks. Did they mention generators, at least? Sometimes list > comprehensions are even faster (I didn't check, but I think this one can > be an example of this: [i*2+2 for i in iterat

Re: Should we still be learning this?

2006-02-19 Thread Max
Felipe Almeida Lessa wrote: > Em Sáb, 2006-02-18 às 15:13 +0200, Max escreveu: > >>>I wonder if they need some updating. >>> >> >>And so does Dive Into Python (our textbook, diveintopython.org) which >>has the same deficiencies in its outline. >

Re: Should we still be learning this?

2006-02-19 Thread Max
have tried to learn Haskell, but - though I think I understand everything I read on it - I can't get my programs to run. --Max -- http://mail.python.org/mailman/listinfo/python-list

That's really high-level: bits of beautiful python

2006-02-21 Thread Max
lso liked 99 Bottles in one line: print '\n'.join(["%d bottles of beer on the wall." % i for i in range(100,0,-1)]) --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: Little tool - but very big size... :-(

2006-02-22 Thread Max
Giovanni Bajo wrote: > There are also other choices that can be made. For instance, wxWidgets is > *HUGE*. Indeed. Remember Tkinter is built-in. (I never got the hang of Tkinter and prefer wx, but if size is important...) --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: anygui,anydb, any opinions?

2005-05-31 Thread max
that it boils down to 2 things: The size and scope of gui and database frameworks, and the fact that opinions differ about what is 'ideal'. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread max
t corporations are considered people by the law is ridiculous. Using a license that ends up doing the same thing with code leaves a bad taste in my mouth. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread max
Steven D'Aprano <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On Mon, 06 Jun 2005 16:12:18 +, max wrote: > >> This is one thing that bothers me about the gpl. It essentially >> tries to create 'code as a legal entity'. That is, it gives &g

Python Genetic Algorithm

2008-01-27 Thread Max
, trying to get Python to do something it's not made for. Any help/ feedback would be wonderful. Thanks, Max Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 6:35 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Max wrote: > > In GAs, you operate on a Population of solutions. Each Individual from > > the Population is a potential solution to the problem you're > > optimizing, and Individuals hav

Re: Python Genetic Algorithm

2008-01-27 Thread Max
> You can subclass this as needed, altering the crossover method as necessary. > > ...perhaps I didn't understand your question. > -Steven > > On Jan 27, 2008 6:35 PM, Wildemar Wildenburger > > <[EMAIL PROTECTED]> wrote: > > Max wrote: > > > In

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 7:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 27 Jan 2008 15:09:52 -0800, Max wrote: > > Hi all. I'm just getting introduced to Python (mostly through Dive Into > > Python), and I've decided to use it for a proj

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 8:01 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Max" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | In GAs, you operate on a Population of solutions. Each Individual from > | the Population is a potential sol

Re: Python Genetic Algorithm

2008-01-28 Thread Max
On Jan 27, 7:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Just pass the class itself. For example: > > # Define a class. > class Parrot(object): > pass > > x = "Parrot" # x is the NAME of the class > y = Parrot # y is the CLASS itself > z = Parrot() # z is an INSTAN

Equivalent of system()?

2008-02-22 Thread Max
Is there a Python equivalent of C++'s system()? TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of system()?

2008-02-22 Thread Max
Thanks for the help! -- http://mail.python.org/mailman/listinfo/python-list

no inputstream?

2008-05-15 Thread max
just to get at that small tag data, and i assume there's a way to do this with file() or open() or something, i just can't get it to work. anyone know how i can fix this? thanks in advance for any help! best, max -- http://mail.python.org/mailman/listinfo/python-list

Re: no inputstream?

2008-05-15 Thread max
On May 15, 9:51 am, castironpi <[EMAIL PROTECTED]> wrote: > On May 15, 8:37 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > On Thu, 15 May 2008 06:08:35 -0700, max wrote: > > > i currently have locations of the mp3s in question as strings

Re: no inputstream?

2008-05-15 Thread max
you're right, my java implementation does indeed parse for Id3v2 (sorry for the confusion). i'm using the getrawid3v2() method of this bitstream class (http://www.javazoom.net/javalayer/docs/docs0.4/ javazoom/jl/decoder/Bitstream.html) to return an inputstream that then i buffer and parse. apolog

Re: no inputstream?

2008-05-15 Thread max
On May 15, 6:18 pm, MRAB <[EMAIL PROTECTED]> wrote: > On May 15, 9:00 pm, max <[EMAIL PROTECTED]> wrote: > > > you're right, my java implementation does indeed parse for Id3v2 > > (sorry for the confusion).  i'm using the getrawid3v2() method of this >

Re: no inputstream?

2008-05-16 Thread max
wrote: > > > > On Thu, 2008-05-15 at 17:11 -0600, John Krukoff wrote: > > > > > On Thu, 2008-05-15 at 15:35 -0700, max wrote: > > > > > > On May 15, 6:18 pm, MRAB <[EMAIL PROTECTED]> wrote: > > > > > > > On May 15, 9:

HTTP basic authentication with form-based authentication

2008-08-07 Thread Max
Following the tutorial at http://personalpages.tds.net/~kent37/kk/00010.html, I understand how to access HTTP basic authenticated pages or form- based authenticated pages. How would I access a page protected by both form-based authentication (using cookies) *and* HTTP basic authentication? -- http:

Re: HTTP basic authentication with form-based authentication

2008-08-08 Thread Max
On Aug 7, 3:54 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > Dnia Thu, 7 Aug 2008 11:14:05 -0700 (PDT), Max napisa³(a): > Use ClientCookie or even better - > mechanize:http://pypi.python.org/pypi/mechanize/ > The docs aren't perfect, but you should easily > find

Re: HTTP basic authentication with form-based authentication

2008-08-08 Thread Max
On Aug 7, 3:54 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > Dnia Thu, 7 Aug 2008 11:14:05 -0700 (PDT), Max napisa³(a): > Use ClientCookie or even better - > mechanize:http://pypi.python.org/pypi/mechanize/ > The docs aren't perfect, but you should easily > find

Re: detecting drives for windows and linux

2006-03-26 Thread Max
ds, ISOs and NTFS drives) in one hierarchy. --Max -- http://mail.python.org/mailman/listinfo/python-list

StringIO.readline() returns ''

2006-04-09 Thread Max
uot;Foo\n") >>> buf.write("Bar\n") >>> buf.flush() >>> buf.readline() '' I expected buf.readline() to return 'Foo\n'. What am I doing wrong? --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: StringIO.readline() returns ''

2006-04-09 Thread Max
Fredrik Lundh wrote: > you forgot to rewind the file: > Thank you. > > > --Max -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert simple B/W graphic to the dot matrix for the LED display/sign

2012-03-04 Thread Max Erickson
; im=im.convert('1') >>> px=im.load() >>> px[0,0] 0 That's the numeral one in the argument to convert. The load method returns a pixel access object. Max -- http://mail.python.org/mailman/listinfo/python-list

Re: installing 2 and 3 alongside on MS Windows

2012-05-25 Thread Max Erickson
The proposed launcher works fine for me: https://bitbucket.org/vinay.sajip/pylauncher/downloads (I'm not sure that is the most up to date place for the launcher, but that's the one I am using) Max -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-06-29 Thread Max Countryman
Yeah it won't work. Recursion depth will be reached. Steven's suggestion is much better. -- Max Countryman +1-917-971-8472 On Wednesday, June 29, 2011 at 2:05 PM, santosh h s wrote: > how to end ths over a period of time > > On Wed, Jun 29, 2011 at 11:25 PM, Max Co

extended slicing and negative stop value problem

2011-08-20 Thread Max Moroz
Would it be a good idea to change Python definition so that a[10, -1, -1] referred to the elements starting with position 10, going down to the beginning? This would require disabling the "negative stop value means counting from the end of the array" magic whenever the step value is negative. The

Re: PUT with proxy-support

2011-08-25 Thread Max Countryman
Check out the python Requests module: http://docs.python-requests.org/en/latest/index.html Sent from my iPhone On Aug 25, 2011, at 7:07, Shashwat Anand wrote: > I want to make a PUT request. > I need some headers of my own ( certificates etc ) and I need to mandatorily > use a proxy. > Also t

http://DuplicateFilesDeleter.com - This software deletes duplicate files in media collection of any type

2011-04-15 Thread Max Loger
http://DuplicateFilesDeleter.com - find duplicates http://DuplicateFilesDeleter.com is an innovative tool that can recognize duplicate audio files even if they are stored in different file formats and not marked with ID3 tags. It will find fast all similar or exact duplicate audio files in a fold

Use Chrome's / Firefox's dev-tools in python

2021-05-20 Thread max pothier
My school has a website for homework called pronote (no problem if you don't know it). After logging in on parisclassenumerique.fr (works with selenium but I cant get requests to work), I want to read one of the packets that is sent: All the info about my day, my homework, etc. are in there a

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-21 Thread max pothier
Hello, Thanks for you answer! Actually my goal is not to automatically get the file once I open the page, but more to periodically check the site and get a notification when there's new homework or, at the morning, know when an hour is cancelled, so I don't want to have to open the browser every

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-23 Thread max pothier
Hi, Seems like that could be a method of doing things. Just one clarification: the website has unselectable text, looks like it's an image strangely generated, so if I can get the packet with it, it would be perfect. As I said (I think), logging in with Selenium was already possible, and I could

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-23 Thread max pothier
@Curt: That is notifications for the ENT app, I want the notifications for the app named ProNote. ENT is for e-mails and Pronote for homework, quotes, etc. -- https://mail.python.org/mailman/listinfo/python-list

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-23 Thread max pothier
Already tried this, only works for messages and not for homework etc. -- https://mail.python.org/mailman/listinfo/python-list

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-24 Thread max pothier
Ok, So here's a screenshot: https://ibb.co/2dtGr3c 1 is the website's scrollbar and 2 is Firefox's scrollbar. Seems like it uses a strange embed thing. The packet follows: https://pastebin.com/2qEkhZMN @Martin Di Paola: I sent you the pastebin password per email so that you're the only one who can

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-24 Thread max pothier
Found this: https://pastebin.com/fvLkSJRp with use-select tags. I'll try to use selenium and select the page. But using the JSON packet that's sent will still be more practical. -- https://mail.python.org/mailman/listinfo/python-list

Socket.py SSM support

2019-06-01 Thread Max Franke
Hi, as of right now there appears to be a lack of setsockoptions required to enable SSM, MCAST_JOIN_SOURCE_GROUP or something a kin to that in particular. Is there currently any effort to add those options or any other workaround to make SSM work in python natively? Best regards Max

Re: Where to find python c-sources

2005-09-29 Thread Max M
Erik Max Francis wrote: > Tor Erik Sønvisen wrote: > >> I need to browse the socket-module source-code. I believe it's >> contained in the file socketmodule.c, but I can't locate this file... >> Where should I look? > > The source tarball, available on

Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-04 Thread Max M
ot net > language? Hehe ... I can run my very first Python program right now in the current version of Python. I cannot even find a platform to run my .asp code from that same timeframe ... So much for 'safe'! -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad

Re: Python reliability

2005-10-10 Thread Max M
ould have crashed your system. That should be an indicator: http://www.python.org/2.4.2/NEWS.html -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Windows installer, different versions of Python on Windows

2005-10-10 Thread Max M
erent versions of Zope 3, and since it is installed under a specific python version, the simplest solution would be to install several Python versions, and install a different zope3 version under each python install. Have I misunderstood something here? -- hilsen/regards Max M, Denmark http://www.m

Re: How to do *args, **kwargs properly

2005-10-11 Thread Max M
ptions): for key in options.keys(): if not key in FN_LEGAL_ARGS: raise TypeError, "'%s' is an invalid keyword argument for this function" % key -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do *args, **kwargs properly

2005-10-11 Thread Max M
Lasse Vågsæther Karlsen wrote: > Max M wrote: > So what you're saying is that instead of: > > def fn(*values, **options): > > I should use: > > def fn(values, cmp=cmp): > > in this specific case? > > and then instead of: > > fn(1, 2

Re: Python vs Ruby

2005-10-23 Thread Max M
e program in > less time. In my experience the LOC count is *far* less significant than the levels of indirections. Eg. how many levels of abstraction do I have to understand to follow a traceback, or to understand what a method relly does in a complex system. -- hilsen/regards Max M

lambda functions within list comprehensions

2005-10-29 Thread Max Rybinsky
Hello! Please take a look at the example. >>> a = [(x, y) for x, y in map(None, range(10), range(10))] # Just a list of >>> tuples >>> a [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9)] Now i want to get a list of functions x*y/n, for each (x, y) in a: >>> funcs

Re: lambda functions within list comprehensions

2005-10-29 Thread Max Rybinsky
Thank you for explanation, Alex. It appears that almost every beginner to Python gets in trouble with this ...feature. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda functions within list comprehensions

2005-10-30 Thread Max Rybinsky
OK. The thing i've got is an obscure semantic bug, occured because of my unawareness of the following Python "features": 1. (In major) http://mail.python.org/pipermail/python-dev/2005-September/056508.html 2. "late" bindings of the function's body Got to know! :) Thanks for your attention. -- h

Re: lambda functions within list comprehensions

2005-10-30 Thread Max Rybinsky
Valid link in my previews message is http://mail.python.org/pipermail/python-dev/2005-September/056669.html Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending email in utf-8?

2005-11-08 Thread Max M
ts: mimeMsg = MIMEMultipart() mimeMsg.attach(msg) for attachment in attachments: # Add the attachment tmp = email.message_from_string(str(attachment.headers)) filename =

Re: append to non-existing list

2005-11-09 Thread Max M
guess that's normal as it's the way python works...?!? Well you could do something like this. (Untested and unrecommended) self.__dict__.setdefault('pkcolumns', []).append(row[0].strip()) Personally I find pkcolumns = [] pkcolumns .append(row[0].strip()) to be nicer ;-) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread Max Erickson
low > level mouse events. My intuition(so take it with a grain of salt) says that it wouldn't make any sense for the list control to generate an event when the drag and drop lands on a different control. max -- http://mail.python.org/mailman/listinfo/python-list

Re: tutorial example

2005-11-11 Thread Max Erickson
42712475 None >>> As you can see, distance2 does not actually return the result of the calculation to the interactive prompt... max -- http://mail.python.org/mailman/listinfo/python-list

Re: tutorial example

2005-11-12 Thread Max Erickson
Not in python. For example, what would you call the following? def rsum(n, m): print n+m return n+m In python a method is callable attached to an object. A function is a callable object constructed with a def statement. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Midi Package: writing events non-chronologically

2005-11-24 Thread Max M
structure is then is complete, you use the midi library to write it to disk. I have attached a simple example here. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science # event classes. Only used internally by notes2midi class NoteOn: def __init__(self, time=0, pit

Re: Newbie question - clearing screen @ interactive prompt

2005-12-09 Thread Max Ischenko
ings (like newt). http://docs.python.org/lib/module-curses.html HTH, Max // http://max.textdriven.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Function Without Parentheses!

2005-01-02 Thread Max M
a('default result') -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: csh to Python

2005-01-04 Thread Max M
Nader Emami wrote: Hello, I am new in Python world, and would like to begin with translate a csh file to a python script. Could somebody give me an advise (documentation or web-site) where I can do that. You are probably interrested in the os 6 os.path modules. -- hilsen/regards Max M, Denmark

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Max M
unicode string into a special string/file format # and you can decode a string from a special string/file format back into unicode. ### u'Some danish characters \xe6\xf8\xe5' 'Some danish characters \xe6\xf8\xe5' Some danish characters æøå

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Max M
range(128) Hm, why does the 'encode' call complain about decoding? Because it tries to print it out to your console and fail. While writing to the console it tries to convert to ascii. Beside, you should write: u"ä".encode("latin-1") to get a latin-1 encoded stri

  1   2   3   4   5   6   7   8   9   10   >