Re: method that can be called from a class and also from an instance
Steven D'Aprano wrote: On Thu, 22 Nov 2012 16:51:27 +0100, Peter Otten wrote: Marc Aymerich wrote: Hi, I want to create a method within a class that is able to accept either a class or an instance. [...] Why would you overload a method that way? The use-case I have is that I have a number of classes with default state. Most instances don't override any of the state, so the instances don't add anything except an extra conceptual layer: instance = MyClass() # notice that there are no arguments passed instance.method(args) Since the instances don't have any state except for that already held by the class, they are redundant and pointless. Just knowing the class is enough to specify the behaviour. If I used class methods, I could do this: MyClass.method(args) But here's the thing -- sometimes I *do* have instances that override the default state: instance = MyClass(x, y, z) instance.method(args) Now if method is a class method, my per-instance state is ignored. So I want a method that can be called from the class, and see the default state, or from the instance, and see the per-instance state. Neither classmethod, staticmethod nor ordinary instance methods do the job, but my custom dualmethod does. http://code.activestate.com/recipes/577030/ Am I reading that right that you don't invoke method() as MyClass.method()? Then I'd probably use class attributes to store the default state and shade them by instance attributes as needed. class A: state = default def __init__(self, state=None): if state is not None: self.state = state def method(self): return self.state assert A().method() == default assert A(special).method() == special The same idea might work for the OP, too (but I'm not sure it's a good idea): class B: def inst_f(self): return instance @classmethod def f(class_): return class def __init__(self): self.f = self.inst_f assert B.f() == class assert B().f() == instance -- http://mail.python.org/mailman/listinfo/python-list
Re: Migrate from Access 2010 / VBA
kgard wrote: Greetings: I am the lone developer of db apps at a company of 350+ employees. Everything is done in MS Access 2010 and VBA. I'm frustrated with the limitations of this platform and have been considering switching to Python. I've been experimenting with the language for a year or so, and feel comfortable with the basics. I am concerned that I'll have a hard time replacing the access form and report designers. I've worked a little with TKinter, but it's a far cry from the GUI designer in Access. Finding a professional grade report designer looks like an even bigger challenge. I don't need to port any applications, but I will need to use the data (mdb/accede format), design a variety of reports with multi-level groupings, and deliver them to many individual recipients via email. Has anyone here made this transition successfully? If so, could you pass along your suggestions about how to do this as quickly and painlessly as possible? These guys are coming from Foxpro, but I'd expect a huge overlap of the problem spaces: http://dabodev.com/ (Disclaimer: I have not tried Dabo myself) -- http://mail.python.org/mailman/listinfo/python-list
Re: Print value from array
On 22/11/12 19:44:02, Mike wrote: Hello, I am noob en python programing, i wrote a perl script for read from csv but now i wish print value but the value must be within double quote and I can not do this. For example now the output is: ma user@domain displayName Name SecondName givenName Name sn SecondName cn Name and i wish ma user@domain displayName Name Lastname givenName Name sn SecondName cn Name My script is #!/usr/bin/python import csv with open ('file.csv', 'rb') as f: reader = csv.reader (f, delimiter=';' ) for row in reader: mail = row [0] name = row [1] lastname = row [2] name2 = row [1] + ' ' + row [2] print 'ma ' + mail + ' displayName ' + name2.title() + ' givenName ' + name.title() + ' sn ' + lastname.title() + ' cn ' + name.title() # print '\n' f.close() How about: #!/usr/bin/python import csv with open('file.csv', 'rb') as f: reader = csv.reader(f, delimiter=';' ) for mail, firstname, lastname in reader: fullname = firstname + ' ' + lastname print 'ma %s' % mail, print 'displayname %s' % fullname.title(), print 'givenName %s' % firstname.title(), print 'sn %s' % lastname.title(), print 'cn %s' % firstname.title() f.close() -- HansM -- http://mail.python.org/mailman/listinfo/python-list
Pass parameters/globals to eval
I am trying to set the parameter 'a' below so that it can be used when I call eval: def gp_function(): ... return 1+a ... print eval(gp_function(), {'a':123, 'gp_function':gp_function}) Traceback (most recent call last): File stdin, line 1, in module File string, line 1, in module File stdin, line 2, in a_method NameError: global name 'a' is not defined Why isn't 'a' defined? Shouldn't you be able to define the global variables with a dict passed to eval? Is there an other way to do this, beside the two obvious: defining 'a' before calling gp_function and using a as an argument in gp_function? In case you are wondering why I want this: This is a simplification of a problem I ran into when experimenting with pyevolve. After running pyevolve: GTreeGP.getCompiledCode() I get some compiled code, and need to pass some arguments to it. Perhaps there is an easier way to do it... Kind Regards Emil -- http://mail.python.org/mailman/listinfo/python-list
Re: Pass parameters/globals to eval
On Fri, Nov 23, 2012 at 11:14 PM, esan...@gmail.com wrote: Why isn't 'a' defined? Shouldn't you be able to define the global variables with a dict passed to eval? Is there an other way to do this, beside the two obvious: defining 'a' before calling gp_function and using a as an argument in gp_function? It is defined, but not in the context of the called function. You defined that function in a particular scope, which then becomes its global scope. (I'm handwaving a lot of details here. Bear with me.) When you eval a bit of code, you define the global scope for _that code_, but not what it calls. Calling gp_function from inside there switches to the new global scope and off it goes. Normally, I'd recommend your second option, passing a as an argument. It's flexible, clear, doesn't rely on fancy names and hidden state. But to answer your actual question: Yes, there is another way to do it. In all probability, gp_function is actually defined at module scope (I'm guessing here but it seems likely based on your description). Simply assign to the module's namespace before calling it - it'll see that as a global. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: method that can be called from a class and also from an instance
On Fri, 23 Nov 2012 09:52:25 +0100, Peter Otten wrote: Steven D'Aprano wrote: http://code.activestate.com/recipes/577030/ Am I reading that right that you don't invoke method() as MyClass.method()? No. I give an example and explicitly state: You can use this class without instantiating: Example.method('else') # returns 'something else' Then I'd probably use class attributes to store the default state and shade them by instance attributes as needed. class A: state = default def __init__(self, state=None): if state is not None: self.state = state def method(self): return self.state That doesn't allow me to call A.method(). On the other hand, if method were a class method, then I could say A.method() or A(state).method, but in both cases I would get the default. So that isn't suitable. [...] The same idea might work for the OP, too (but I'm not sure it's a good idea): class B: This needs to be a new-style class unless you're using Python 3. def inst_f(self): return instance @classmethod def f(class_): return class def __init__(self): self.f = self.inst_f assert B.f() == class assert B().f() == instance Without studying that in detail, it looks like that would be an alternative solution to the same problem. The downsides are: - you have two distinct but almost identical implementations of method f, one called f and one called inst_f; - it works by shadowing method f in the instance, which may strike many people as too tricky for production software. Me personally, I think the first objection is critical. Having to write the same method twice, with subtle differences, is inviting bugs. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
python3.3 - tk_setPalette bug?
Hi, AFAIK, this should work: import tkinter as Tk root= Tk.Tk() root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') but python-3.3:0e4574595674+ gives Traceback (most recent call last): File Matr_Select.py, line 174, in module root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') File /usr/lib64/python3.3/tkinter/__init__.py, line 390, in tk_setPalette + _flatten(args) + _flatten(kw.items())) TypeError: argument must be sequence What am I missing? Thanks, Helmut. -- http://mail.python.org/mailman/listinfo/python-list
Re: 10 sec poll - please reply!
Dear all, the emails are getting kind of long so to ask you briefly: What do you think of splitting `type` into two functions `press` and `enter`? Their use cases are: press(CTRL + 'a') press(ENTER) press(ALT + 'f', 's') enter(Hello World!) enter(test.txt, into=File name) Thanks, Michael On Thursday, November 22, 2012 7:00:55 PM UTC+1, Michael Herrmann wrote: Dear all, thank you for your replies. After experimenting with your suggestions, we have arrived at a solution that we believe fits well with our existing API. However, before we implement this solution, we would like to ask you one last time to sign off on our proposal or raise any serious problems you see with it. We took the fact that naming our one function 'type' was so difficult to name as an indicator that it may be trying to do too many things: On the one hand, it allows you to enter plain text as in `type(Hello World!)`; on the other hand, it lets you press single keys, possibly in combination with control keys as for instance in `type(CTRL + 'a')`. We believe it won't normally be necessary to combine the two. For instance, while you could see what type(CTRL + 'a' + Hello World!) does, we think you would be more likely to use the two separate calls type(CTRL + 'a') type(Hello World!) One of the main goals of our automation product is that using it should feel like giving instructions to a human being looking over their shoulder at a screen. For this reason, it's very useful for us if the function names in our API are short, if possible without underscores, and close to the vocabulary you would use in an everyday conversation. We hope that by offering an API with this property, we can not only make it easier to use for experienced programmers such as yourself, but also be approachable for people from a less technical background. In our gut feeling, the words apart from `type` that would most normally be used in an everyday conversation to express the three examples I have given in my first mail are: press(CTRL + 'a') enter(Hello World) press(ENTER) We really quite like the word `type`, and a few people here seem to favour it too. In particular, Steven: We're glad you accidentally clicked on our mail. Thank you for your inputs and the great quote by Phil Karlton. We think you were right in everything you said. However, some people seem to be *really* put off when you override a built-in function. Even though of course you can avoid the overriding by saying from automa.api import type *as* ..., (as Tim pointed out) we'd like to avoid irritating those people. For this reason, we would rather not use `type`. Many people here voted for send_keys(...). We agree with Dave and Neil that `type` may have too many uses already. As Chris and MRAB pointed out, 'send_keys' is used in many other automation tools. This makes it intuitive for people with knowledge of such tools. However, as I said above (and should have probably said earlier), we are also trying to reach users from a less technical background. Since these people would not normally use 'send_keys' in an everyday conversion, we are afraid that it would not be an intuitive name for them. A similar argument applies to some extent to our 'type_keys', to our 'generate_keystrokes', Ramit's 'simulate_keypress', 'simulate_key(s)_down', 'send_kb_press', 'fake_typing' and 'send_char(s)' and Tim's 'feedkeys'. We thank you for your suggestions. Hopefully you can also agree with our choice! Some suggestions were very nice, short and pretty unambiguous, such as Dennis' `emit` and particularly Alan's `strike`. However, they're unfortunately also rather rarely used and we'd be afraid that it'd be hard to remember them. Thank you though! A final point that Evan made and that also we find very important is to have verbs in our function names. Our proposed solution is to split what we previously called `type` into two functions, 'press' and 'enter' (proposed by xDog Walker). 'press' could be used to press single keys or combinations of them, at once: press(CTRL + 'a') press(ENTER) To open a menu via the keyboard, you could also supply several key combinations to be pressed, in sequence: press(ALT + 'f', 's') 'enter' on the other hand would be used to enter longer strings of plain text: enter(Hello World!) With a functionality we already have, you could supply an optional 'into' parameter that selects a text field into which the text is entered: enter(test.txt, into=File name) 'enter' currently does involve generating same system events that are fired when pressing (and releasing) sequences of keys. However, we did not want to include this technical detail in the function name - it keeps
Re: python3.3 - tk_setPalette bug?
Helmut Jarausch wrote: Hi, AFAIK, this should work: import tkinter as Tk root= Tk.Tk() root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') but python-3.3:0e4574595674+ gives Traceback (most recent call last): File Matr_Select.py, line 174, in module root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') File /usr/lib64/python3.3/tkinter/__init__.py, line 390, in tk_setPalette + _flatten(args) + _flatten(kw.items())) TypeError: argument must be sequence What am I missing? Nothing, as far as I can tell. Please file a bug report on http://bugs.python.org. For now you can work around the bug with root.tk_setPalette(background, 'AntiqueWhite1', foreground, 'blue') -- http://mail.python.org/mailman/listinfo/python-list
who is that...?!!
who is that...?!! http://www.youtube.com/watch?v=SIADfS030qgfeature=BFalist=PLB95C1C59E12FBA96 thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: 10 sec poll - please reply!
Hi again, Steven's points and the feeling for `type` are very good and maybe the problems I mentioned can be ramified. I therefore opened a new thread to find out what the general public thinks about overwriting built-in functions such as `type` here: https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.python/GjZ2hAS1Wyk Thanks, Michael On Friday, November 23, 2012 10:08:06 AM UTC+1, Michael Herrmann wrote: Hi Steven, On Friday, November 23, 2012 6:41:35 AM UTC+1, Steven D'Aprano wrote: On Thu, 22 Nov 2012 10:00:54 -0800, Michael Herrmann wrote: We took the fact that naming our one function 'type' was so difficult to name as an indicator that it may be trying to do too many things: I don't think it is difficult to name at all. On the one hand, it allows you to enter plain text as in `type(Hello World!)`; That would be called typing. I agree that typing might be more common in this context. However, you also understand me when I say enter. on the other hand, it lets you press single keys, That would be called typing. Here, I disagree. You press enter and you press ALT+TAB. You might be able to say type ENTER but that is much less common. Google agrees: http://bit.ly/10o8yAQ vs. http://bit.ly/WmVwyU. possibly in combination with control keys as for instance in `type(CTRL + 'a')`. That would be called prestidigitation. Nah, just kidding. That would also be called typing. Here too Google favours press ctrl+a over type ctrl+a. We believe it won't normally be necessary to combine the two. I can't imagine why you say that. You even go ahead and give a perfectly fine example of combining a control character with plain text. I don't know what operating system you are using, but under Linux, people often use strings of regular characters mixed in with control- or alt- characters. E.g. I in the shell, I might type Alt-B Shift-' END Shift-' to jump backwards one word (Alt-B), insert a double quote mark (Shift-'), jump to the end of the line I am editing (END), and insert another double quote mark. Unfortunately, I didn't explain what I mean by plain text. Your example could be implemented with the press from our proposal, as follows: press(ALT + 'B', '', END, '') What I meant when I said that press could not be used to enter plain text was that it would not be possible to enter a sequence of multiple normal letters enclosed in single quotes, as in press(Hello World) If in your example you had wanted to add more than just a single character to the beginning or end of the line, this means you would have to write press(ALT + 'B') enter(beginning of line) press(END) enter(end of line) I agree that the following would read better here: press(ALT + 'B') type(beginning of line) press(END) type(end of line) However like Google above, I would disagree with type(ALT + 'B') type(beginning of line) type(END) type(end of line) or even type(ALT + 'B' + beginning of line + END + end of line) It is a needless restriction to assume that every control character must only be part of a single key press event. I even remember a Mac application back in the early 1990s or late 1980s that used combinations like Ctrl-A Y to perform commands. (Actually, such older Macs didn't have a Control key, they used Command instead, but the principle is the same.) One of the main goals of our automation product is that using it should feel like giving instructions to a human being looking over their shoulder at a screen. In a word processor, I might say Type Ctrl-A Ctrl-X to cut all the text from the document. rather than Press Ctrl-A. Now press Ctrl-X. With the current proposal, it'd be press(CTRL + 'A', CTRL + 'X') Forgetting about `type` vs `press` for a moment, chaining the key combinations like this is OK, isn't it? We really quite like the word `type`, and a few people here seem to favour it too. In particular, Steven: We're glad you accidentally clicked on our mail. Thank you for your inputs and the great quote by Phil Karlton. We think you were right in everything you said. However, some people seem to be *really* put off when you override a built-in function. Even though of course you can avoid
ANN : occmodel v0.1.0
I am pleased to announce the first official release of occmodel (v0.1.0) and the releated libraries geotools/gltools. Description -- occmodel is a small library which gives a high level access to the OpenCASCADE modelling kernel. For most users a direct use of the OpenCASCADE modelling kernel can be quite a hurdle as it is a huge library. The geometry can be visualized with the included viewer. This viewer is utilizing modern OpenGL methods like GLSL shaders and vertex buffers to ensure visual quality and maximum speed. To use the viewer OpenGL version 2.1 is needed. Home page : http://github.com/tenko/occmodel Documentation : http://tenko.github.com/occmodel/index.html In addition the following related libraries are released: geotools (required) : http://github.com/tenko/geotools Documentation : http://tenko.github.com/geotools/index.html gltools (optional) : http://github.com/tenko/gltools Documentation : http://tenko.github.com/gltools/index.html As this is the first official release some hurdles are expected Binary installers are available for the Windows platform. Best regards Runar Tenfjord -- http://mail.python.org/mailman/listinfo/python-list
RE: Getting a seeded value from a list
Steven D'Aprano wrote: On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: However, this still means that the player will see the exact same level regenerated every time, absolutely fresh. As previously stated in this thread, that's not usually a good thing for encounters, treasure, etc. Once some nasty critter has been killed, he should STAY killed! :) Why? That isn't true in real life, why should it be true for games? It is not true in all games. I have seen games where treasures regenerate in the same location except for key items. Same goes for enemies (where only bosses do not regenerate). It really just depends on the type of game you are playing--designing in this case. ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list
Re: 10 sec poll - please reply!
On Fri, Nov 23, 2012 at 2:42 PM, Michael Herrmann michael.herrm...@getautoma.com wrote: Dear all, the emails are getting kind of long so to ask you briefly: What do you think of splitting `type` into two functions `press` and `enter`? Their use cases are: press(CTRL + 'a') press(ENTER) press(ALT + 'f', 's') enter(Hello World!) enter(test.txt, into=File name) Thanks, Michael First of, please don’t top-post. Second of, the type—enter split a bad idea. It would require me to think whether I should use one or the other. type() is perfectly fine, because Automa is never going to be used as from automa import *. And if it is, it’s in your shell for non-Pythonistas. And also, my general thoughts: type() is just fine. Unless you want to call it simulate_pressing_keys_on_the_keyboard_without_getting_a_mechanical_arm_out_of_the_screen_and_pressing_the_keys_with_it(), but then you will need to create simulate_using_the_mouse_without_getting_a_mechanical_arm_out_of_the_screen_and_moving_the_mouse_or_pressing_its_buttons_with_it(), too. -- Kwpolska http://kwpolska.tk stop html mail | always bottom-post www.asciiribbon.org | www.netmeister.org/news/learn2quote.html GPG KEY: 5EAAEA16 -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it bad style to override the built-in function `type`?
In article d2e59ddf-d44c-44d9-91c5-539b03cfc...@googlegroups.com, Michael Herrmann michael.herrm...@getautoma.com wrote: do you think it's bad style to override the built-in function `type`? I'm co-developing a GUI automation library called Automa (http://www.getautoma.com) and 'type' would be a very fitting name for a function that generates artificial key strokes. For local variable names with small scopes, I don't fret much about overriding built-in names. For a library, I would try harder to find non-conflicting names. How about one of these: type_text() enter_text() keyboard() PS, A suggestion about your website. In these days of tech exit strategies and M/A crazyness, putting Purchase and Company as adjacent items in the main menu might be misconstrued. At first glance, I read it as Purchase company. Twitter Bootstrap, no? -- http://mail.python.org/mailman/listinfo/python-list
Why queue.empty() returns False even after put() is called?
Hi, The empty() returns True even after put() has been called. Why it is empty when there some items in it? Could anybody help me understand it? Thanks! ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat main.py #!/usr/bin/env python import multiprocessing queue = multiprocessing.Queue() print queue.empty() queue.put(['a', 'b']) queue.put(['c', 'd']) print queue.empty() Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list
Re: 10 sec poll - please reply!
Hi, I see your concern with having two functions that have to be separately remembered... I personally would also be fine with type(), however some people are violently against it. I opened a new thread (https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.python/GjZ2hAS1Wyk) to ask just how many people would have a problem with this. I know I'm really spamming this list and apologize. I promise it'll be over soon. Michael On Friday, November 23, 2012 5:43:08 PM UTC+1, Kwpolska wrote: On Fri, Nov 23, 2012 at 2:42 PM, Michael Herrmann ... wrote: Dear all, the emails are getting kind of long so to ask you briefly: What do you think of splitting `type` into two functions `press` and `enter`? Their use cases are: press(CTRL + 'a') press(ENTER) press(ALT + 'f', 's') enter(Hello World!) enter(test.txt, into=File name) Thanks, Michael First of, please don’t top-post. Second of, the type—enter split a bad idea. It would require me to think whether I should use one or the other. type() is perfectly fine, because Automa is never going to be used as from automa import *. And if it is, it’s in your shell for non-Pythonistas. And also, my general thoughts: type() is just fine. Unless you want to call it simulate_pressing_keys_on_the_keyboard_without_getting_a_mechanical_arm_out_of_the_screen_and_pressing_the_keys_with_it(), but then you will need to create simulate_using_the_mouse_without_getting_a_mechanical_arm_out_of_the_screen_and_moving_the_mouse_or_pressing_its_buttons_with_it(), too. -- Kwpolska http://kwpolska.tk stop html mail | always bottom-post www.asciiribbon.org | www.netmeister.org/news/learn2quote.html GPG KEY: 5EAAEA16 -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it bad style to override the built-in function `type`?
On 11/23/2012 11:22 AM, Joel Goldstick wrote: On Fri, Nov 23, 2012 at 11:12 AM, Michael Herrmann michael.herrm...@getautoma.com mailto:michael.herrm...@getautoma.com wrote: Hi, do you think it's bad style to override the built-in function `type`? I'm co-developing a GUI automation library called Automa (http://www.getautoma.com) and 'type' would be a very fitting name for a function that generates artificial key strokes. Personally, I think this is a horrible idea. On this list and the tutor list, people often use variable names that are already defined in the language. It leads to non obvious errors -- especially when revisting old code. Why not call the thing 'key_stroke'? I agree. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
argparse -- mutually exclusive sets of arguments?
My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse; add_mutually_exclusive_group() isn't quite the right thing. It could specify that foo and --config are mutually exclusive, but not (as far as I can see) the more complicated logic described above. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why queue.empty() returns False even after put() is called?
On 2012-11-23 16:57, Peng Yu wrote: Hi, The empty() returns True even after put() has been called. Why it is empty when there some items in it? Could anybody help me understand it? Thanks! ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat main.py #!/usr/bin/env python import multiprocessing queue = multiprocessing.Queue() print queue.empty() queue.put(['a', 'b']) queue.put(['c', 'd']) print queue.empty() It works correctly for me. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why queue.empty() returns False even after put() is called?
On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu pengyu...@gmail.com wrote: Hi, The empty() returns True even after put() has been called. Why it is empty when there some items in it? Could anybody help me understand it? Thanks! ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat main.py #!/usr/bin/env python import multiprocessing queue = multiprocessing.Queue() print queue.empty() queue.put(['a', 'b']) queue.put(['c', 'd']) print queue.empty() According to the docs, the Queue uses a background thread to load data into it: When a process first puts an item on the queue a feeder thread is started which transfers objects from a buffer into the pipe. Most likely it still appears to be empty because this thread has not had a chance to run yet. If you try inserting a time.sleep() call, you should see the queue become non-empty once the background thread has run. -- http://mail.python.org/mailman/listinfo/python-list
Re: argparse -- mutually exclusive sets of arguments?
On 11/23/2012 1:46 PM, Roy Smith wrote: My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse; add_mutually_exclusive_group() isn't quite the right thing. It could specify that foo and --config are mutually exclusive, but not (as far as I can see) the more complicated logic described above. Make the two positional arguments be one duple? Or tell argparse that all three are optional and handle the 'more complicated logic' in your own code after argparse returns. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Why queue.empty() returns False even after put() is called?
On 23Nov2012 11:53, Ian Kelly ian.g.ke...@gmail.com wrote: | On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu pengyu...@gmail.com wrote: | The empty() returns True even after put() has been called. Why it is | empty when there some items in it? Could anybody help me understand | it? Thanks! | | ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat | main.py | #!/usr/bin/env python | | import multiprocessing | | queue = multiprocessing.Queue() | print queue.empty() | queue.put(['a', 'b']) | queue.put(['c', 'd']) | print queue.empty() | | According to the docs, the Queue uses a background thread to load data into it: | | When a process first puts an item on the queue a feeder thread is | started which transfers objects from a buffer into the pipe. | | Most likely it still appears to be empty because this thread has not | had a chance to run yet. If you try inserting a time.sleep() call, | you should see the queue become non-empty once the background thread | has run. Conversely, might it not appear empty because the objects have been thrown at the pipe already, appearing to have been consumed? Or is there end-to-end handshaking controlling what .empty() tests? (Though again, the far end may have grabbed them already too.) -- Cameron Simpson c...@zip.com.au The ZZR-1100 is not the bike for me, but the day they invent nerf roads and ban radars I'll be the first in line..AMCN -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it bad style to override the built-in function `type`?
On 23Nov2012 10:41, Michael Herrmann michael.herrm...@getautoma.com wrote: [...] | I know it's a common beginner's mistake to incautiously override | built-in functions. However, we put in a lot of research and have come to | the conclusion that, if Python had not already defined it, `type` would | be the best name. We are now trying to evaluate how bad the disadvantages | you mention are in comparison to the advantage to having a name that is | more intuitive to use in the problem domain. | | Can you somehow relate to my explanations, or are your experiences | with overwriting built-in variables so bad that you would advise to | never ever do it? My own experience says that it is a thing best avoiding without a truly amazing reason not to. I urge you not to: type(foo) is a very basic Python idiom and you're breaking it. One day it _will_ bite you or your users. You will understand, but I would give goods odds that some of your users will not the day they go to examine the type of an object for perfectly normal pythonic reasons. Example: I have a module that stores objects and they have as a primary key a name and a type - not Python types, just strings. Accordingly I have a similar situation to yours: the desire to use the word type. Fortunately for me, as an attribute in (usually small) code chunks I can usually go: t = foo.type ... work with t here ... Where I must pass one as a parameter I use the common convention of naming the parameter type_ at the receiving end. For the calling end, as in your case, you want to use: type(blah) Is it at all possible to make all uses of your type function method calls? Eg: something.type(text to type) It avoids the overloading while keeping your desired name. -- Cameron Simpson c...@zip.com.au Wouldn't it be great if all emergency stopping situations occurred on your favourite bit of road..you'd probably know about it before it happened and would be able to take other evasive action. - Neville Brabet id...@melbourne.dialix.oz.au -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting a seeded value from a list
On Sat, Nov 24, 2012 at 3:27 AM, Prasad, Ramit ramit.pra...@jpmorgan.com wrote: Steven D'Aprano wrote: On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: However, this still means that the player will see the exact same level regenerated every time, absolutely fresh. As previously stated in this thread, that's not usually a good thing for encounters, treasure, etc. Once some nasty critter has been killed, he should STAY killed! :) Why? That isn't true in real life, why should it be true for games? It is not true in all games. I have seen games where treasures regenerate in the same location except for key items. Same goes for enemies (where only bosses do not regenerate). It really just depends on the type of game you are playing--designing in this case. Perhaps they regenerate, but do they regenerate from the exact same random seed? For instance, in Murkon's Refuge, the maps are handcrafted and thus constant every time you enter a particular level - but go downstairs and upstairs, and the monsters and treasure regenerate, different from last time. Of course, if the idea is that you're rewinding time, then it makes good sense for you to see the exact same pattern of enemies. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: 10 sec poll - please reply!
On Fri, 23 Nov 2012 05:42:22 -0800, Michael Herrmann wrote: Dear all, the emails are getting kind of long so to ask you briefly: What do you think of splitting `type` into two functions `press` and `enter`? This invites confusion as to the rules of when you can call `press` and when you can call `enter`. Especially since you haven't explained the rules, just given a bunch of non-exhaustive examples and invited people to extrapolate what the rules are. (By the way, they aren't use-cases, they're examples.) Their use cases are: press(CTRL + 'a') press(ENTER) press(ALT + 'f', 's') enter(Hello World!) enter(test.txt, into=File name) Is `press('s')` allowed? What about `press('S')`, or do I have to write `press(SHIFT + 's')`? If I can write `press(ALT + 'f', 's')`, can I write `press('f', 's')`? If not, why not? Can I write `press('fs')` as a simpler version of `press('f', 's')`? If not, why not? Can I write `press(CTRL + 'i')` to get a tab? How about `press('\t')`? If I want three tabs, can I write `press('\t\t\t')`, or do I have to write press(CTRL + 'i') press(CTRL + 'i') press(CTRL + 'i') If I want a tab, a letter, and a newline, repeated three times, can I do this? press(\tA \tB \tC ) Or do I have to do this? press(CTRL + 'i') enter('A') press(CTRL + 'i') enter('B') press(CTRL + 'i') enter('C') Speaking of enter, how do I type Hello World! without entering it? If I want to type Hello World! without ENTER, do I have to do this? press('H') press('e') press('l') press('l') ... you get the picture With a function named press, I would expect to be able to say: press('a') time.sleep(5) release('a') How do I do something like that? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
RE: Problem with subprocess.call and windows schtasks
Dave Angel wrote: On 11/20/2012 06:41 PM, Tom Borkin wrote: (Please don't top-post. Now we lose all the context) Using shlex, I now have this: #!\Python27\python import os, subprocess path = os.path.join(C:\\, Program Files, Apache Group, Apache2, htdocs, ccc, run_alert.py) #subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', 'test', '/TR', path, '/ST', '23:50']) subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', 'test', '/TR', 'run_alert.py', '/ST', '23:50']) Both of the above commands throw the same error: ERROR: The filename, directory name or volume label syntax is incorrect. I don't use Windows, but doesn't a Windows program usually have an .exe extension? So why would you expect it to find SchTasks ? Adding extensions is a shell feature, and you're not using the shell. Also, you should take a look at the value path. On Linux, it shows up as: C:\\/Program Files/Apache Group/Apache2/htdocs/ccc/run_alert.py It'll be different under Windows, but probably still wrong. Windows 7 + Python 2.6 os.path.join(C:\\, Program Files, Apache Group, Apache2, ... htdocs, ccc, run_alert.py) 'C:\\Program Files\\Apache Group\\Apache2\\htdocs\\ccc\\run_alert.py' ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list
Re: argparse -- mutually exclusive sets of arguments?
On 23 November 2012 18:46, Roy Smith r...@panix.com wrote: My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse; add_mutually_exclusive_group() isn't quite the right thing. It could specify that foo and --config are mutually exclusive, but not (as far as I can see) the more complicated logic described above. Do you need to use argparse? If not, I've been recommending docopt due to its power and simplicity: -START - Command. Usage: command foo bar command --config=file Options: foo The egg that spams bar The spam that eggs --config=file The config that configures from docopt import docopt if __name__ == '__main__': arguments = docopt(__doc__) print(arguments) - END - USAGE - %~ python simple_docopt.py foobar barfoo {'--config': None, 'bar': 'barfoo', 'foo': 'foobar'} %~ python simple_docopt.py foobar Usage: simple_docopt.py foo bar simple_docopt.py --config=file %~ python simple_docopt.py --config=turtle.conf {'--config': 'turtle.conf', 'bar': None, 'foo': None} %~ python simple_docopt.py --config=turtle.conf not allowed Usage: simple_docopt.py foo bar simple_docopt.py --config=file --- END USAGE --- -- http://mail.python.org/mailman/listinfo/python-list
Re: argparse -- mutually exclusive sets of arguments?
On Fri, Nov 23, 2012 at 11:46 AM, Roy Smith r...@panix.com wrote: My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse; add_mutually_exclusive_group() isn't quite the right thing. It could specify that foo and --config are mutually exclusive, but not (as far as I can see) the more complicated logic described above. I don't think you could even do the former. An argument must be optional in order to be mutually exclusive with anything. This works, however: parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--config', type=file) group.add_argument('--foobar', nargs=2, metavar=('FOO', 'BAR')) print parser.parse_args() Downsides are that the resulting interface is a little more formal and a little less friendly, and unless you customize the action you'll wind up with a 2-element 'foobar' arg instead of separate 'foo' and 'bar' args. -- http://mail.python.org/mailman/listinfo/python-list
[issue16534] test_float failure on IA64 (HPUX)
Mark Dickinson added the comment: Without having looked too hard, the many warnings are almost certainly from our definition of Py_NAN. That's been fixed in the default branch. I'm not sure whether it's worth backporting just to fix warnings. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16534 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Serhiy Storchaka added the comment: Sorry, it's my fault. Here is a patch which should fix the bug. -- nosy: +skrah Added file: http://bugs.python.org/file28082/test_unknown_option.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Serhiy Storchaka added the comment: Actually 2.7 tests should not be broken, but this patch unify 2.7 and 3.x code. -- Added file: http://bugs.python.org/file28083/test_unknown_option-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4080] unittest: display time used by each test case
anatoly techtonik added the comment: pyunit_time.patch is invalid - missing space on the last line. -- nosy: +techtonik ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16535] json encoder unable to handle decimal
Serhiy Storchaka added the comment: The json module already has too many options. No need for yet one such specialized. class number_str(float): ... def __init__(self, o): ... self.o = o ... def __repr__(self): ... return str(self.o) ... def decimal_serializer(o): ... if isinstance(o, decimal.Decimal): ... return number_str(o) ... raise TypeError(repr(o) + is not JSON serializable) ... print(json.dumps([decimal.Decimal('0.20001')], default=decimal_serializer)) [0.20001] You can extend this to support complex numbers, fractions, date and time, and many other custom types. Have specialized options for this would be cumbersome. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- nosy: +kristjan.jonsson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14803] Add feature to allow code execution prior to __main__ invocation
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- nosy: +kristjan.jonsson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16531] Allow IPNetwork to take a tuple
Serhiy Storchaka added the comment: How about ipaddress.IPv4Network((3232235520, 16)), ipaddress.IPv4Network((3232235520, 65535)) and ipaddress.IPv4Network((3232235520, 4294901760))? ipaddress.IPv4Address(3232235520) IPv4Address('192.168.0.0') ipaddress.IPv4Address(65535) IPv4Address('0.0.255.255') ipaddress.IPv4Address(4294901760) IPv4Address('255.255.0.0') ipaddress.IPv4Network('192.168.0.0/0.0.255.255') IPv4Network('192.168.0.0/16') ipaddress.IPv4Network('192.168.0.0/255.255.0.0') IPv4Network('192.168.0.0/16') -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation
Kristján Valur Jónsson added the comment: Butting in here: Early on in the startup, a search is made for site.py using automatic sys.path settings. Do the suggestions here propose to override this? I know there is a -s flag, but all these flags start to be confusing. I have been looking for ways to completely ignore automatic settings for sys.path, either from internal heuristics (either build environment or installed environment) or PYTHONPATH. The reason for this is that as a developer in a large project, one that has many branches, each with their potentially different version of python compiled and with their own libraries, and where a standard python distribution may even be installed on the machine as well, we still want to be able to run scripts with each branch' own python with relative simplicity with some sort of guarantee that we are not inadvertently pulling in modules from other, unrelated branches, or god forbid, the installed python. PEP 405 seemed to go a long way, although it didn't provide a means in the pyvenv.cfg to completely override sys.path from the startup. I wonder if there isn't a synergy here with PEP 405, e.g. would it make sense to have a pyvenv.cfg file next to the __main__.py file? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16535] json encoder unable to handle decimal
Mark Dickinson added the comment: Judging by the discussion that Éric points to, and by the various stackoverflow questions on the topic ([1], [2]), this is a common enough need that I think it would make sense to have some support for it in the std. lib. There's a sense in which Decimal is the 'right' type for json, and we shouldn't make it harder for people to do the right thing with respect to (e.g.) financial data in databases. [1] http://stackoverflow.com/questions/4019856/decimal-to-json [2] http://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object -- nosy: +mark.dickinson stage: - needs patch versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11797] 2to3 does not correct reload
Berker Peksag added the comment: Here's a patch that adds tests and updates the documentation. -- nosy: +berker.peksag Added file: http://bugs.python.org/file28084/issue11797.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11797 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16532] AMD64 Windows 7 build failures
Jeremy Kloth added the comment: On Thu, Nov 22, 2012 at 3:11 PM, Antoine Pitrou rep...@bugs.python.org wrote: The AMD64 Windows 7 buildbot shows weird build failures in ctypes: http://buildbot.python.org/all/buildslaves/kloth-win64 The _ctypes_d.pyd was considered to be in use by the system (although Process Explorer could not the file handle for it). I've since rebooted the machine (it had system updates pending anyway) so the problem should be fixed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4473] POP3 missing support for starttls
Lorenzo M. Catucci added the comment: OK, I'm uploading poplib_03_starttls_v5.diff; I only changed the caps=self.capa() into caps = self.capa() in the @@ -352,21 +360,42 @@ class POP3: hunk. Thank you for pointing at the line; I tried to run pep8.py on poplib.py, but failed to find the line, since I was overwhelmed by the reported pre-existing pep8 inconsistencies... I'm tempted to open a pep8 issue on poplib after we finish with stls... Thank you very much for reviewing! -- Added file: http://bugs.python.org/file28085/poplib_03_starttls_v5.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4473 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4473] POP3 missing support for starttls
Changes by Lorenzo M. Catucci lore...@sancho.ccd.uniroma2.it: Removed file: http://bugs.python.org/file28026/poplib_03_starttls_v4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4473 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16491] try-except-raise-bug
Ezio Melotti added the comment: Can you paste the traceback you get with IDLE and also try the same from the command line? -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16491 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16538] The docs doesn't describe MAKE_CLOSURE correctly
New submission from Daniel Urban: The documentation of the dis module describes the MAKE_CLOSURE opcode incorrectly. The description of MAKE_FUNCTION was updated in 242d3f8e8c50 (issue14349) to include the qualified name, but MAKE_CLOSURE wan't. A patch is attched. -- assignee: docs@python components: Documentation files: make_closure.patch keywords: needs review, patch messages: 176166 nosy: daniel.urban, docs@python priority: normal severity: normal stage: patch review status: open title: The docs doesn't describe MAKE_CLOSURE correctly versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file28086/make_closure.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16538 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16538] The docs doesn't describe MAKE_CLOSURE correctly
Roundup Robot added the comment: New changeset 5d1e7912e23e by Andrew Svetlov in branch '3.3': Issue #16538: correctly describe MAKE_CLOSURE in docs. http://hg.python.org/cpython/rev/5d1e7912e23e New changeset 8fff40a7c5b5 by Andrew Svetlov in branch 'default': Merge issue #16538: correctly describe MAKE_CLOSURE in docs. http://hg.python.org/cpython/rev/8fff40a7c5b5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16538 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16538] The docs doesn't describe MAKE_CLOSURE correctly
Andrew Svetlov added the comment: Fixed. Thanks. -- nosy: +asvetlov resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16538 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16534] test_float failure on IA64 (HPUX)
Mark Dickinson added the comment: I wonder whether adding -fpeval=float to the CFLAGS would fix this. There's a lot of information at http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=0008a22194f02110a22194f02110275d6e10RCRD but I don't know whether it's relevant to this machine. Trent? -- nosy: +trent ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16534 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
New submission from anatoly techtonik: It is very annoying. Take this as an example. 'patch' is a module (library) that is meant to be used from other programs. Therefore it can not (should not) setup handlers for itself. import patch patch.PatchSet().parse('7745') No handlers could be found for logger patch Is it the same for Python 3? -- components: Library (Lib) messages: 176170 nosy: techtonik, vinay.sajip priority: normal severity: normal status: open title: Turn off 'No handlers could be found for logger' message versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
anatoly techtonik added the comment: Forgot to mention that bundled NullHandler doesn't work in Python 2.7 and from what I can see it is not covered with tests for this version. Traceback (most recent call last): File stdin, line 1, in module File patch.py, line 124, in fromstring return PatchSet( StringIO(s) ) File patch.py, line 196, in __init__ self.parse(stream) File patch.py, line 512, in parse warning(error: no patch data found!) File C:\Python27\lib\logging\__init__.py, line 1152, in warning self._log(WARNING, msg, args, **kwargs) File C:\Python27\lib\logging\__init__.py, line 1258, in _log self.handle(record) File C:\Python27\lib\logging\__init__.py, line 1268, in handle self.callHandlers(record) File C:\Python27\lib\logging\__init__.py, line 1307, in callHandlers if record.levelno = hdlr.level: AttributeError: type object 'NullHandler' has no attribute 'level' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2454] sha and md5 fixer
Meador Inge added the comment: I'm not sure how much this is needed considering hashlib has been around, since 2.5. I hope people aren't having to port from before then. Martin alluded to that when he opened the issue saying this wasn't necessary, but a nice to have. However, it has been over four years since the issue was opened. Maybe it should just be closed. I don't really have an opinion either way. Martin, are you still interested in this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
anatoly techtonik added the comment: Nevermind the last message - I was specifying NullHandler as a class, not as an instance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14273] distutils2: logging handler not properly initialized
anatoly techtonik added the comment: More specifically, you need to copy NullHandler code if you want to run it with Python 2.x 2.7 -- nosy: +techtonik ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Ezio Melotti added the comment: The new patch doesn't seem to be correct: without the patch: $ ./python -a -z Unknown option: -a Unknown option: -z usage: ./python [option] ... [-c cmd | -m mod | file | -] [arg] ... with the patch: $ ./python -a -z Unknown option: -a usage: ./python [option] ... [-c cmd | -m mod | file | -] [arg] ... A test case for this should also be added. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
Vinay Sajip added the comment: This is not a valid issue. The approach to use is documented: http://docs.python.org/2.6/library/logging.html#configuring-logging-for-a-library http://docs.python.org/2.7/howto/logging.html#configuring-logging-for-a-library -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Serhiy Storchaka added the comment: Thanks, Ezio, for point. without the patch: $ ./python -a -z Unknown option: -a Unknown option: -z usage: ./python [option] ... [-c cmd | -m mod | file | -] [arg] ... This behavior isn't correct. Try also -E -a -z and -a -E -z (also with 3.3.0). However I found an error in the test in my patch (actually previous test for 2.7 was correct, but not full). Patch updated, new tests added. -- Added file: http://bugs.python.org/file28087/test_unknown_option_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file28088/test_unknown_option_2-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Ezio Melotti added the comment: This behavior isn't correct. Shouldn't python report all the invalid flags passed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Serhiy Storchaka added the comment: Should not. It happened unintentionally (and inconsistently). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16529] Compiler error when trying to compile ceval.c on OpenSUSE 11.3
Jesús Cea Avión added the comment: Could you possibly locate the problematic changeset? Could be doable by bisection. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16529 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5765] stack overflow evaluating eval(() * 30000)
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16529] Compiler error when trying to compile ceval.c on OpenSUSE 11.3
Marc-Andre Lemburg added the comment: On 23.11.2012 17:02, Jesús Cea Avión wrote: Could you possibly locate the problematic changeset? Could be doable by bisection. I'll try to find the changeset. There were only 4 checkins related to ceval.c since the 3.3.0 release, so one of those will have to have triggered the problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16529 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16529] Compiler error when trying to compile ceval.c on OpenSUSE 11.3
Marc-Andre Lemburg added the comment: On 23.11.2012 17:24, M.-A. Lemburg wrote: On 23.11.2012 17:02, Jesús Cea Avión wrote: Could you possibly locate the problematic changeset? Could be doable by bisection. I'll try to find the changeset. There were only 4 checkins related to ceval.c since the 3.3.0 release, so one of those will have to have triggered the problem. This changeset triggered the problem: changeset: 79693:ac30a1b1cf17 user:Benjamin Peterson benja...@python.org date:Fri Oct 12 11:34:51 2012 -0400 summary: ceval cleanup It's fairly large (http://hg.python.org/cpython/rev/ac30a1b1cf17), so I can't easily tell which part might be worth looking at more closely. I do notice that the logic for error handling was changed from doing a break to doing a goto error. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16529 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
New submission from Neil Girdhar: When using sequence types polymorphically, range, list, and tuple are both iterable and subscriptable. Unfortunately, itertools.count, cycle, and repeat objects are not subscriptable, although this is not a hard change. Please consider making these objects subscriptable for polymorphic usage. -- components: Library (Lib) messages: 176183 nosy: Neil.Girdhar priority: normal severity: normal status: open title: Make itertools count, cycle, and repeat objects subscriptable like range. type: enhancement versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +rhettinger stage: - needs patch versions: -Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
Serhiy Storchaka added the comment: Range, list, and tuple are iterables, but itertools.count, cycle, and repeat objects are iterators. Subscripting is not a part of iterator protocol. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16306] Multiple error line for unknown command line parameter
Roundup Robot added the comment: New changeset 6a79e3beb854 by Ezio Melotti in branch '2.7': #16306: report only the first unknown option and add more tests. Patch by Serhiy Storchaka. http://hg.python.org/cpython/rev/6a79e3beb854 New changeset 654a628f5f00 by Ezio Melotti in branch '3.2': #16306: report only the first unknown option and add more tests. Patch by Serhiy Storchaka. http://hg.python.org/cpython/rev/654a628f5f00 New changeset 421a8a5ffbb2 by Ezio Melotti in branch '3.3': #16306: merge with 3.2. http://hg.python.org/cpython/rev/421a8a5ffbb2 New changeset 51caa0820fad by Ezio Melotti in branch 'default': #16306: merge with 3.3. http://hg.python.org/cpython/rev/51caa0820fad -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
Neil Girdhar added the comment: Apologies if this is a bad question, but why do count, cycle, and repeat return iterators rather than iterables? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16474] More code coverage for imp module
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16474 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16537] Python’s setup.py raises a ValueError when self.extensions is empty
Éric Araujo added the comment: LGTM. -- nosy: +eric.araujo title: setup.py throws a ValueError when self.extensions is empty - Python’s setup.py raises a ValueError when self.extensions is empty ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16537 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16526] Python does not cross compile properly
Éric Araujo added the comment: See also: http://bugs.python.org/issue3754 cross-compilation support for python build http://bugs.python.org/issue1006238 cross compile patch http://bugs.python.org/issue1597850 Cross compiling patches for MINGW (superseder of http://bugs.python.org/issue1339673, cross compile and mingw support) http://bugs.python.org/issue3871 cross and native build of python for mingw32 with distutils http://bugs.python.org/issue3718 environment variable MACHDEP and python build system http://bugs.python.org/issue10782 Not possible to cross-compile due to poor detection of %lld support in printf -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16526 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16519] site.venv() should use abspath(executable)
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo, vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16477] tarfile fails to close file handles in case of exception
Andrew Svetlov added the comment: LGTM -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16508] include the object type in the lists of documented types
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16508 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16509] sqlite3 docs do not explain check_same_thread
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ghaering stage: - needs patch versions: +Python 3.2, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16509 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16518] add buffer protocol to glossary
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16518 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
Éric Araujo added the comment: The point of itertools is to implement building blocks for iterators, which are memory-efficient and can sometimes be infinite, contrary to sequences. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
anatoly techtonik added the comment: I'd say this is a pretty valid issue with won't fix or workaround available resolution. The question - is the same behavior preserved for Python 3? -- resolution: invalid - wont fix status: closed - languishing ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16488] Add context manager support to epoll object
Andrew Svetlov added the comment: +0 for patch -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16541] tk_setPalette doesn't accept keyword parameters
New submission from Helmut Jarausch: import tkinter as Tk root= Tk.Tk() root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') but python-3.3:0+ (3.3:27cb1a3d57c8+) gives Traceback (most recent call last): File Matr_Select.py, line 174, in module root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') File /usr/lib64/python3.3/tkinter/__init__.py, line 390, in tk_setPalette + _flatten(args) + _flatten(kw.items())) TypeError: argument must be sequence Thanks for looking into it, Helmut. -- components: Tkinter messages: 176193 nosy: HJarausch priority: normal severity: normal status: open title: tk_setPalette doesn't accept keyword parameters type: compile error versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16541 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16542] http//bugs.python/joko.suwito
New submission from joko suwito: thank you -- messages: 176194 nosy: joko.suwito priority: normal severity: normal status: open title: http//bugs.python/joko.suwito ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16542 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16541] tk_setPalette doesn't accept keyword parameters
Serhiy Storchaka added the comment: There are two ways to fix this issue: 1. Fix tk_setPalette() (just wrap kw.items() with list() or tuple()). 2. Fix C implementation of _flatten() for work with any iterators. -- nosy: +gpolo, serhiy.storchaka stage: - needs patch type: compile error - behavior versions: +Python 3.2, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16541 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16523] attrgetter and itemgetter signatures in docs need cleanup
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +patch nosy: +chris.jerdonek stage: needs patch - patch review versions: +Python 3.2 Added file: http://bugs.python.org/file28089/issue16523.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16542] http//bugs.python/joko.suwito
Changes by Ezio Melotti ezio.melo...@gmail.com: -- resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16542 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.
Serhiy Storchaka added the comment: Apologies if this is a bad question, but why do count, cycle, and repeat return iterators rather than iterables? Actually they are iterables too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16530] documentation of os.wait3
Roundup Robot added the comment: New changeset a2038edb51cd by Ezio Melotti in branch '2.7': #16530: the options arg of os.wait3 is required. http://hg.python.org/cpython/rev/a2038edb51cd New changeset 1cf1194a443e by Ezio Melotti in branch '3.2': #16530: the options arg of os.wait3 is required. http://hg.python.org/cpython/rev/1cf1194a443e New changeset 7359ade2ab0b by Ezio Melotti in branch '3.3': #16530: merge with 3.2. http://hg.python.org/cpython/rev/7359ade2ab0b New changeset a728056347ec by Ezio Melotti in branch 'default': #16530: merge with 3.3. http://hg.python.org/cpython/rev/a728056347ec -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16530 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16530] documentation of os.wait3
Ezio Melotti added the comment: Fixed, thanks for the report! -- assignee: docs@python - ezio.melotti nosy: +ezio.melotti resolution: - fixed stage: - committed/rejected status: open - closed versions: -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16530 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16531] Allow IPNetwork to take a tuple
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +easy nosy: +ezio.melotti stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16541] tk_setPalette doesn't accept keyword parameters
Guilherme Polo added the comment: If doing list(kw.items()) works, I'm fine with that. If it does not, then ttk._format_optdict(kw) should. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16541 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16539] Turn off 'No handlers could be found for logger' message
Amaury Forgeot d'Arc added the comment: Python 3 has exactly the same documentation: http://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library -- nosy: +amaury.forgeotdarc resolution: wont fix - works for me status: languishing - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16523] attrgetter and itemgetter signatures in docs need cleanup
Chris Jerdonek added the comment: +.. function:: attrgetter(attr[, attr2, attr3, ...]) Why not reword to use the *attr notation? It is even already being used below: + The function is equivalent to:: def attrgetter(*items): if any(not isinstance(item, str) for item in items): -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16543] Use positional arguments in PyArg_UnpackTuple
New submission from Ezio Melotti: This came up in #16515. While using PyArg_UnpackTuple to parse the positional arguments in a function that receives both positional and keyword arguments, the error message returned when the number of arguments is incorrect is misleading, e.g.: max(foo=1) TypeError: max expected 1 arguments, got 0 This can be fixed by adding positional before arguments in the error message. The attached patch fixes this and the pluralization of argument(s). -- assignee: ezio.melotti components: Interpreter Core files: unpacktuple.diff keywords: patch messages: 176202 nosy: ezio.melotti priority: normal severity: normal stage: test needed status: open title: Use positional arguments in PyArg_UnpackTuple type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file28090/unpacktuple.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16543 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16523] attrgetter and itemgetter signatures in docs need cleanup
Ezio Melotti added the comment: I thought about that, but wanted to make a distinction between the form that accepts only 1 arg and returns an item and the form that receives 2+ args and returns a tuple. -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16515] TypeError message incorrect for max() with one keyword arg
Ezio Melotti added the comment: I created #16543 for PyArg_UnpackTuple. Once that is fixed we can continue with this. -- dependencies: +Use positional arguments in PyArg_UnpackTuple ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16543] Use positional arguments in PyArg_UnpackTuple
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16543 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16543] Use positional arguments in PyArg_UnpackTuple
Serhiy Storchaka added the comment: +(min == 1 ? : s), l); In second part of patch should be max. Reformat the code so that `min` and `(min == 1 ? : s)` will be in one line and it will be more clear. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16543 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16523] attrgetter and itemgetter signatures in docs need cleanup
Chris Jerdonek added the comment: You can also make that distinction using *. For example: .. function:: attrgetter(attr, *attrs) or .. function:: attrgetter(attr) attrgetter(attr1, attr2, *attrs) (cf. http://docs.python.org/dev/library/functions.html#max ) Elsewhere we started to prefer using two signature lines where two or more behaviors are possible, which might be good to do in any case. With the ... notation, this would look like: .. function:: attrgetter(attr) attrgetter(attr1, attr2, ...) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16543] Use positional arguments in PyArg_UnpackTuple
Mark Dickinson added the comment: Now that I look at uses of PyArg_UnpackTuple, I'm wondering whether this needs to be fixed at all. Apart from `max` and `min`, do you know of any other cases where this gives a misleading error message? Almost all the uses I can find are for simple functions/methods where all arguments are positional-only. (Ex: range, pow, slice, dict.pop). max and min *do* clearly need an error message fix. (Apologies: I know it was me who suggested that PyArg_UnpackTuple needed fixing in the first place. But now I'm not sure that's true.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16543 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16543] Use positional arguments in PyArg_UnpackTuple
Mark Dickinson added the comment: Of course, the 'arguments' - 'argument' fix would still be nice to have. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16543 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com