Re: Using asyncio for serial port
On 8 Feb 2014 23:45, james.time4...@gmail.com wrote: Hiya I'm looking at using asyncio for creating an socket - serial protocol bridge, but looking at the current implementation of asyncio it looks to be quite socket specific. I can't see any way to get it to support a simple serial device. Any advice on where to proceed would be very much appreciated! You might have more luck on the python-tulip list/group. Asyncio is still very new for most people :) Cheers, Phil Thanks! James -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On 2/10/2014 10:01 PM, genius...@gmail.com wrote: Is there a better way of drawing such as another modules Logo is a drawing language designed for kids who do not know geometry but can imagine walking around on a dirt field and occasionally turning while dragging a stick or dripping paint. Part of the charm is discovering the patterns that emerge when simple actions are repeated. The Python version, turtle, is built on top of tkinter and its Canvas widget. Since I *do* know coordinate geometry and don't care about the moving animal metaphor, I find it easier to use Canvas directly. This avoids the bugs and limitations (including speed) introduced by the turtle module. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Error getting while running python function
On 11/02/2014 04:26, Jaydeep Patil wrote: On Tuesday, 11 February 2014 09:37:23 UTC+5:30, Jaydeep Patil wrote: I have defined one function as below. def InfoDir(msg): msg1 = wx.MessageDialog(msg) msg1.ShowModal() msg1.Destroy() InfoDir(Testing) It gives below error. msg1 = wx.MessageDialog(msg) File C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py, line 2922, in __init__ _windows_.MessageDialog_swiginit(self,_windows_.new_MessageDialog(*args, **kwargs)) TypeError: Required argument 'message' (pos 2) not found Process finished with exit code 1 Please give me solution for this. Is anybody answer my query? Regards Jay Come on you lot, pull your bloody fingers out, I've been waiting for NINETEEN minutes!!! Would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing above, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
On 2/11/2014 2:43 AM, Larry Hastings wrote: On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I redownloaded 64bit 3.4.0 and install gives the same message. Can someone verify that this is not some bizarre glitch on my machine? If it is not, Windows users should download the 32 bit binary for now. Someone should remove the link to the installer that does not work. A followup should be posted when it is replaced. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.4.0 release candidate 1
Hi, It would be nice to give also the link to the whole changelog in your emails and on the website: http://docs.python.org/3.4/whatsnew/changelog.html Congrats for your RC1 release :-) It's always hard to make developers stop addings new minor changes before the final version :-) Victor 2014-02-11 8:43 GMT+01:00 Larry Hastings la...@hastings.org: On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. This is a preview release, and its use is not recommended for production settings. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series include: * PEP 428, a pathlib module providing object-oriented filesystem paths * PEP 435, a standardized enum module * PEP 436, a build enhancement that will help generate introspection information for builtins * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 450, a new statistics module * PEP 451, standardizing module metadata for Python's module import system * PEP 453, a bundled installer for the *pip* package manager * PEP 454, a new tracemalloc module for tracing Python memory allocations * PEP 456, a new hash algorithm for Python strings and binary data * PEP 3154, a new and improved protocol for pickled objects * PEP 3156, a new asyncio module, a new framework for asynchronous I/O Python 3.4 is now in feature freeze, meaning that no new features will be added. The final release is projected for mid-March 2014. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ Please consider trying Python 3.4.0rc1 with your code and reporting any new issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) ___ Python-Dev mailing list python-...@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
On 2/11/2014 5:13 AM, Terry Reedy wrote: On 2/11/2014 2:43 AM, Larry Hastings wrote: On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I wrote too soon. Python 3.4.0rc1 (v3.4.0rc1:5e088cea8660, Feb 11 2014, 05:54:25) [MSC import tkinter Traceback ... import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application. So tkinter, Idle, turtle fail and the corresponding tests get skipped. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Get a datetime with nanoseconds
2014-02-11 6:42 GMT+01:00 Igor Korot ikoro...@gmail.com: Hi, ALL, I am woking on an application for digital forensic. In this application I am getting this 2 pieces of information: atime - long representing the time stamp atime_nano - long representing the nanoseconds. What I'd like to do is to have a python datetime object which will be a representation of those 2 values. I can get a datetime object out of atime timestamp, but I don't know how to do it for atime_nano. I did a little research. It looks like people on SO are saying that I will not be able to get this kind of precision, but I'd be grateful if I can at least get the best possible precision (millioseconds?) it would be great. Thank you for any pointers. -- https://mail.python.org/mailman/listinfo/python-list Hi, it seems, datetime has support for microseconds datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None) http://docs.python.org/3.3/library/datetime.html#datetime.datetime I haven't done anything using this precision, but I guess, microseconds could be used out of the box; for some higher precision, you'd probably need to code your own datatype. hth, vbr -- https://mail.python.org/mailman/listinfo/python-list
Re:Get a datetime with nanoseconds
Igor Korot ikoro...@gmail.com Wrote in message: Construct a datetime. timedelta object, and add it to your datetime. mytime += datetime. timedelta (microseconds=nano//1000) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Get a datetime with nanoseconds
On Tuesday, February 11, 2014 7:42:16 AM UTC+2, Igor Korot wrote: Hi, ALL, I am woking on an application for digital forensic. In this application I am getting this 2 pieces of information: atime - long representing the time stamp atime_nano - long representing the nanoseconds. What I'd like to do is to have a python datetime object which will be a representation of those 2 values. I can get a datetime object out of atime timestamp, but I don't know how to do it for atime_nano. I did a little research. It looks like people on SO are saying that I will not be able to get this kind of precision, but I'd be grateful if I can at least get the best possible precision (millioseconds?) it would be great. Thank you for any pointers. i think you mix 2 issues here: - get date time for specific point in time from system with nanosecond precision. If i am wrong then to what SO are saying that I will not be able to get this kind of precision is related? - and how to have datetime to support nanosecond. That should be straightforward and isn't hard. You should implement class having datetime class instance stored and another member for nanosecond portion. Yet implement datetime operators and members to mimic all of that in original class. /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
On Tue, Feb 11, 2014 at 5:45 AM, Terry Reedy tjre...@udel.edu wrote: On 2/11/2014 5:13 AM, Terry Reedy wrote: ... I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I wrote too soon. Python 3.4.0rc1 (v3.4.0rc1:5e088cea8660, Feb 11 2014, 05:54:25) [MSC import tkinter Traceback ... import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application. So tkinter, Idle, turtle fail and the corresponding tests get skipped. 32 bit and 64 bit both work for me. Windows 7. -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
On 2014-02-11 13:06, David Robinow wrote: On Tue, Feb 11, 2014 at 5:45 AM, Terry Reedy tjre...@udel.edu wrote: On 2/11/2014 5:13 AM, Terry Reedy wrote: ... I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I wrote too soon. Python 3.4.0rc1 (v3.4.0rc1:5e088cea8660, Feb 11 2014, 05:54:25) [MSC import tkinter Traceback ... import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application. So tkinter, Idle, turtle fail and the corresponding tests get skipped. 32 bit and 64 bit both work for me. Windows 7. Also works for me. Windows 8.1 64-bit. -- https://mail.python.org/mailman/listinfo/python-list
pip3.x error using LIST instead of list
As the subject line says, details below. c:\Python34\Scriptspip3.4 LIST Traceback (most recent call last): File C:\Python34\lib\runpy.py, line 189, in _run_module_as_main __main__, mod_spec) File C:\Python34\lib\runpy.py, line 87, in _run_code exec(code, run_globals) File c:\Python34\Scripts\pip3.4.exe\__main__.py, line 9, in module File C:\Python34\lib\site-packages\pip\__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File C:\Python34\lib\site-packages\pip\__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list Is this a known problem, should I raise a bug against pip, what is the best course of action? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On Wed, Feb 12, 2014 at 1:10 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: File C:\Python34\lib\site-packages\pip\__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list Is this a known problem, should I raise a bug against pip, what is the best course of action? Hmm, yep. I'd confirm that as a bug. Inspection of the surrounding code suggests that it shouldn't be lowercasing there (a couple of lines above, it fetches out args_else[0].lower(), but to remove it from cmd_args, it should use original case). Search the tracker for it, to see if it already exists; if not, create it. You have the file name and line number, so you could probably even make a patch :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
In article 52f9b6af$0$11128$c3e8...@news.astraweb.com, Steven D'Aprano st...@pearwood.info wrote: On Mon, 10 Feb 2014 22:40:48 -0600, Tim Daneliuk wrote: On 02/08/2014 05:54 PM, Sam wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are not advisable to be developed using Python? [snip a bunch of good examples] Applications in which you do not want the casual reader to be able to derive the meaning of the source code. That's a bad example. Do you think that the casual reader will be able to understand the meaning of .pyc files? No, but anybody with script-kiddie level sophistication can download a pyc decompiler and get back a pretty good representation of what the source was. Whether I mind shipping my source, or you mind shipping your source isn't really what matters here. What matters is that there *are* people/companies who don't want to expose their source. Perhaps for reasons we don't agree with. For those people, Python is not a good choice. -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On Tue, 11 Feb 2014 14:10:32 + Mark Lawrence wrote: As the subject line says, details below. c:\Python34\Scriptspip3.4 LIST Traceback (most recent call last): File C:\Python34\lib\runpy.py, line 189, in _run_module_as_main __main__, mod_spec) File C:\Python34\lib\runpy.py, line 87, in _run_code exec(code, run_globals) File c:\Python34\Scripts\pip3.4.exe\__main__.py, line 9, in module File C:\Python34\lib\site-packages\pip\__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File C:\Python34\lib\site-packages\pip\__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list Is this a known problem, should I raise a bug against pip, what is the best course of action? Hi, I get the same error with an older release of pip. But, I get that error regardless which uppercase argument I am passing to pip. Look below: hanez@phantom ~ % pip LIST Traceback (most recent call last): File /usr/lib/python-exec/python2.7/pip, line 9, in module load_entry_point('pip==1.5.2', 'console_scripts', 'pip')() File /usr/lib64/python2.7/site-packages/pip/__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File /usr/lib64/python2.7/site-packages/pip/__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list hanez@phantom ~ % pip FOO Traceback (most recent call last): File /usr/lib/python-exec/python2.7/pip, line 9, in module load_entry_point('pip==1.5.2', 'console_scripts', 'pip')() File /usr/lib64/python2.7/site-packages/pip/__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File /usr/lib64/python2.7/site-packages/pip/__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list hanez@phantom ~ % pip foo ERROR: unknown command foo hanez@phantom ~ % pip --version pip 1.5.2 from /usr/lib64/python2.7/site-packages (python 2.7) hanez@phantom ~ % -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 2014-02-10, Ned Batchelder n...@nedbatchelder.com wrote: On 2/10/14 9:43 AM, Tim Chase wrote: The opposite of what the utf8/utf16 do! sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16')) 225 However, as pointed out repeatedly, string-indexing in fixed-width encodings are O(1) while indexing into variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR gives the benefits of O(1) indexing while saving space when a string doesn't need to use a full 32-bit width. Please don't engage in this debate with JMF. His mind is made up, and he will not be swayed, no matter how persuasive and reasonable your arguments. Just ignore him. I think reasonable criticisms should be contested no matter who posts them. I agree jmf shouldn't be singled out for abuse, summoned, insulted, or have his few controversial opinions brought into other topics. Tim's post was responding to a specific, well-presented criticism of Python's string implementation. Left unchallenged, it might linger unhappily in the air, like a symphony ended on a dominant 7th chord. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On Wed, Feb 12, 2014 at 1:24 AM, Roy Smith r...@panix.com wrote: Whether I mind shipping my source, or you mind shipping your source isn't really what matters here. What matters is that there *are* people/companies who don't want to expose their source. Perhaps for reasons we don't agree with. For those people, Python is not a good choice. But if it comes to that, there's really nothing that's all that great a choice. After all, a small amount of introspection will identify the external references in something (even C code has that, unless every single call is statically linked; and even then, I've used gdb usefully on other people's optimized binaries), so while someone might not be able to figure out how your code works, they can at least figure out what it's doing, and call on it directly. The only difference between a .pyc file and a binary executable is that the pyc bytecode is written for a virtual machine rather than a physical CPU. It's not a matter of this is good, that is bad, but a spectrum of difficulties - optimized C code with everything statically linked is about as close to one extreme as you'll get without consciously obfuscating your code, and well-commented source is the opposite extreme. A minified source file, a .pyc file, or a dynamically linked .so, all are just someplace along that range. It's just a question of how much time and effort it takes to figure out the internals of the code. Considering that there are big companies spending lots of money devising DRM schemes, and their code often gets decompiled or reverse engineered within a day of release, I'd have to say that even obfuscated code is no real barrier. The *only* way to expose nothing is to publish nothing - which, these days, usually means running your software on a server and distributing a fairly dumb client... a model that MUDs have been using to great effect for decades, and are even today able to be run commercially. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On Wed, Feb 12, 2014 at 1:27 AM, Johannes Findeisen mail...@hanez.org wrote: Hi, I get the same error with an older release of pip. But, I get that error regardless which uppercase argument I am passing to pip. Look below: Correct. The exception is thrown before it's looked at what the subcommand is; it happens any time the argument != argument.lower(). Simple work-around: always type subcommands in lower-case :) Much easier work-around than for some bugs I've seen. Like, printing from Win-OS/2 requires holding the print queue, printing your document, adding a second job from a smarter print client, then releasing the print queue so both jobs go through in succession. This one, the work-around is just do what you'd normally do anyway. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On 11/02/2014 14:41, Chris Angelico wrote: On Wed, Feb 12, 2014 at 1:27 AM, Johannes Findeisen mail...@hanez.org wrote: Hi, I get the same error with an older release of pip. But, I get that error regardless which uppercase argument I am passing to pip. Look below: Correct. The exception is thrown before it's looked at what the subcommand is; it happens any time the argument != argument.lower(). Simple work-around: always type subcommands in lower-case :) No matter what I try I can't get the subcommands in lower-case when I have caps lock on, is there a simple work-around for this as well? :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: New to Py 3.3.3 having prob. with large integer div. float.
On Tuesday, February 11, 2014 2:24:01 AM UTC-5, cas...@gmail.com wrote: On Monday, February 10, 2014 6:40:03 PM UTC-8, hlauk.h...@gmail.com wrote: I am coming off Python 2.6.6 32 bite platform and now in win 8.1 64 bite. I had no problems with gmpy in 2.6.6 and large integer floating points where you could control the length of the floating point by entering the bite size of the divisor(s) you are using. That would give the limit length of the float in the correct number of bites. In Python 3.3.3 and gmpy2 I have tried many things in the import mpfr module changing and trying all kinds of parameters in the gmpy2 set_context module and others. The best I can get without an error is the results of a large integer division is a/b = inf. or an integer rounded up or down. I can't seem to find the right settings for the limit of the remainders in the quotient. My old code in the first few lines of 2.6.6 worked great and looked like this - import gmpy BIG =(A large composite with 2048 bites) SML =(a smaller divisor with 1024 bites) Y= gmpy.mpz(1) A= gmpy.mpf(1) y=Y x=BIG z=SML a=A k=BIG j=BIG x=+ gmpy.next.prime(x) while y 20: B = gmpy.mpf(x.1024) ## the above set the limit of z/b float (see below) to 1024 b=B a=z/b c=int(a) d=a-c if d = .001: proc. continues from here with desired results. gmpy2 seems a lot more complex but I am sure there is a work around. I am not interested in the mod function. My new conversion proc. is full of ## tags on the different things I tried that didn't work. TIA Dan The following example will divide two integers with a result precision of 1024 bits: import gmpy2 # Set mpfr precision to 1024 gmpy2.get_context().precision=1024 # Omitting code a = gmpy2.mpz(SML)/gmpy2.mpz(x) Python 3.x performs true division by default. When integer division involves an mpz, the result will be an mpfr with the precision of the current context. Does this help? casevh Thanks a lot, I will give it a go. Dan -- https://mail.python.org/mailman/listinfo/python-list
Re: New to Py 3.3.3 having prob. with large integer div. float.
On 11/02/2014 14:50, hlauk.h.bog...@gmail.com wrote: Thanks a lot, I will give it a go. Dan I'm pleased to see that you have answers. In return would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing that I've snipped as there's so much of it, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On Wed, Feb 12, 2014 at 1:50 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 11/02/2014 14:41, Chris Angelico wrote: On Wed, Feb 12, 2014 at 1:27 AM, Johannes Findeisen mail...@hanez.org wrote: Hi, I get the same error with an older release of pip. But, I get that error regardless which uppercase argument I am passing to pip. Look below: Correct. The exception is thrown before it's looked at what the subcommand is; it happens any time the argument != argument.lower(). Simple work-around: always type subcommands in lower-case :) No matter what I try I can't get the subcommands in lower-case when I have caps lock on, is there a simple work-around for this as well? :) Hold Shift :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On 2014-02-11 06:30, Steven D'Aprano wrote: You need to understand the difference between syntax and semantics. This is invalid English syntax: Cat mat on sat the. This is valid syntax, but semantically wrong: The mat sat on the cat. This is both syntactically and semantically correct: The cat sat on the mat. And there are times you *do* want to do unconventional things with the language, and Python allows that: http://www.catster.com/files/600px-cat-hiding-under-rug.jpg because in that particular use case, it *is* semantically correct. With Python's correct design, we have: spam # always, without exception, refers to the object spam() # always, without exception, calls the object With your suggested design, we would have: spam # sometimes refers to the object, sometimes calls the object spam() # always calls the object Ruby makes this mistake, and is a lessor language for it. One of the (many) reasons Ruby drives me nuts. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
On Tuesday, February 11, 2014 4:10:32 PM UTC+2, Mark Lawrence wrote: As the subject line says, details below. c:\Python34\Scriptspip3.4 LIST Traceback (most recent call last): File C:\Python34\lib\runpy.py, line 189, in _run_module_as_main __main__, mod_spec) File C:\Python34\lib\runpy.py, line 87, in _run_code exec(code, run_globals) File c:\Python34\Scripts\pip3.4.exe\__main__.py, line 9, in module File C:\Python34\lib\site-packages\pip\__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File C:\Python34\lib\site-packages\pip\__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list Is this a known problem, should I raise a bug against pip, what is the best course of action? Mark Lawrence Python 3.3.3 pip 1.4.1 no problem: (app1)app1#pip LIST ecdsa (0.10) gevent (1.0) greenlet (0.4.2) hiredis (0.1.2) json-rpc (1.2) lockfile (0.9.1) lxml (3.2.5) mysql-connector-python (1.1.5) paramiko (1.12.1) pip (1.4.1) pycrypto (2.6.1) redis (2.9.0) requests (2.2.0) setuptools (0.9.8) tinyrpc (0.5) uWSGI (2.0) WebOb (1.3.1) Werkzeug (0.9.4) python 3.3.3 pip 1.5.2 - problem (mnp_venv3)mnp_venv3#pip LIST Traceback (most recent call last): File /opt/smsc/mnp/mnp_venv3/bin/pip, line 11, in module sys.exit(main()) File /opt/smsc/mnp/mnp_venv3/lib/python3.3/site-packages/pip/__init__.py, line 177, in main cmd_name, cmd_args = parseopts(initial_args) File /opt/smsc/mnp/mnp_venv3/lib/python3.3/site-packages/pip/__init__.py, line 156, in parseopts cmd_args.remove(args_else[0].lower()) ValueError: list.remove(x): x not in list imho there are ongoing changes in pip due to new features. It could be due to that. imho, at line 156 .lower() should be removed, because of cmd_args holds original argument list (copied at line 155) got as argument to function parseopts() /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano st...@pearwood.info wrote: 1. Parenthesis should not be required for parameter- less functions. Of course they should. Firstly, parameter-less functions are a code- smell, and ought to be discouraged. Secondly, even if you have a good reason for using one -- for example, random.random -- then the difference between referring to the object and calling the object should be clear. Interesting. Can you clarify or provide some links to the parameter-less functions are a code-smell” bit? I agree with your points about consistency. I disagree with the original poster that niladic functions should have a different syntax than the others. I empathize with him, I’ve made the same mistake before (being an ardent Smalltalker in the past, it’s an easy habit to have bite you). But the consistency is more important. And in python, things “happen” when parentheses appear. I just accept that. OTOH, I’m not sure I’ve heard the parameters-less functions are a code one? Is it just loose functions that you’re referring to? As opposed to methods (which are just bound functions)? I could maybe accept that. But methods with fewer arguments, and even none, are a desirable thing. There are code smells that are the opposite in fact, methods with long parameter lists are generally seen as code smell (“passing a paragraph”). Anyway, I’d love to understand better what you see as the code smell and why. -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
Terry Reedy tjre...@udel.edu wrote: On 2/11/2014 2:43 AM, Larry Hastings wrote: On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I redownloaded 64bit 3.4.0 and install gives the same message. Can someone verify that this is not some bizarre glitch on my machine? I downloaded and installed it without problems on a 64bit Windows 7 system. Maybe it is a bizarre glitch on your system, or perhaps it assumes something is present which is there on my system and missing on yours. I see that part way through the install it downloads setuptools/pip from pypi. Did your system have network access? What happens if you enable the installer log by running: msiexec /i python-3.4.0rc1.amd64.msi /L*v logfile.txt Does it put any useful messages in logfile.txt? -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs travisgri...@gmail.com wrote: OTOH, I’m not sure I’ve heard the parameters-less functions are a code one? Is it just loose functions that you’re referring to? As opposed to methods (which are just bound functions)? I could maybe accept that. But methods with fewer arguments, and even none, are a desirable thing. There are code smells that are the opposite in fact, methods with long parameter lists are generally seen as code smell (“passing a paragraph”). 'self' is, imo, a parameter. When you call a parameter-less method on an object, it's usually an imperative with a direct object (or sometimes a subject): some_file.close() # Close some_file some_list.shuffle() # Shuffle some_list some_file.readline() # Some_file, read in a line There are times when, for convenience, the object is implicit. print(some text, file=some_file) # Print that text print(file=some_file) # Print a blank line print(some text) # Print that text to sys.stdout print() # Print a blank line to sys.stdout So in that situation, the no-args call does make sense. Of course, this is a call to a function that does take args, but it's accepting all the defaults and providing no additional content. It's quite different to actually define a function that mandates exactly zero arguments, and isn't making use of some form of implicit state (eg a closure, or maybe a module-level function that manipulates module-level state - random.random() would be an example of the latter). Syntactically, Python can't tell the difference between print() and foo() where foo can never take args. I'd say that a function taking no args is code smell, unless it's obviously taking its state from somewhere else (callbacks, for instance - maybe you pass a bound method, or maybe a closure, but in either case it has implicit state that's not described by function args); but _calling_ with no args isn't as smelly. It's certainly less common than using args, but there are plenty of times when a type is called without args, for instance[1]. ChrisA [1] Okay, that was a really abysmal pun. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
Travis Griggs writes: in fact, methods with long parameter lists are generally seen as If you have a predicate with ten arguments, you probably forgot some (heard long time ago over in the Prolog world). -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On Wed, Feb 12, 2014 at 3:07 AM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Travis Griggs writes: in fact, methods with long parameter lists are generally seen as If you have a predicate with ten arguments, you probably forgot some (heard long time ago over in the Prolog world). Conversely: Thirteen pushes for each call! Whew. But now we have our files open. (from an assembly language programming tutorial, on the DosOpen API in OS/2) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
ANN: PSF Python Marketing Brochure - Last call for Ad Sponsors
[Please help spread the word by forwarding to other relevant mailing lists, user groups, etc. world-wide; thanks :-)] ANNOUNCING PSF Python Marketing Brochure - Last call for Ad Sponsors Please support the PSF in providing the Python community with free high quality marketing material to promote Python INTRODUCTION Over the last few years, the Python brochure team has worked on and created a high-quality brochure to help user groups, conferences and companies using Python to promote and spread the word about Python. The brochure will be printed in a first edition of 10,000 copies which the PSF will then distribute to user groups, Python conferences and educational institutions on request and free of charge. With the Python brochure, we hope to reach out to an audience which is not easy to address and convince using electronic and mostly developer oriented media. PREVIEW Please take a look at our preview PDF version of the brochure to see for yourself: http://brochure.getpython.info/preview.pdf SEEKING YOUR HELP The team set out to create and print the brochure without introducing extra costs for the PSF. Our aim is to fully finance the brochure production, printing and shipment to interested parties using money from sponsors. To make this happen, we are seeking your help ! = We have already signed up sponsors for 6 half page ads, but still need another *5 half page ad sponsors* to sign up. = There are also *6 smaller reference entry sponsorships* left to be sold. If you are affiliated with or know a company investing into Python and looking for ways to reach out to a large audience of interested Python users, students, developers - and people in key decision making positions, please reach out to us and help make the project a success. The deadline for ad and reference entry signups is *Feb 28* - in just under three weeks. You can find all the details about the available sponsorship options on this page: http://brochure.getpython.info/sponsorship Orders can be placed directly with the production company, Evenios Publishing on the website. All sponsors will receive a box of about 120 free copies of the brochure as Thank You gift. ORDERING EXTRA COPIES Companies who are interested in receiving extra copies can pre-order additional boxes which will then be printed in addition to the initial 10.000 copy batch: http://brochure.getpython.info/mediadata/subscription-order-procedure It is also possible to donate such extra boxes to educational institutions: http://brochure.getpython.info/mediadata/education-sponsorship If you have special requirements, please contact the team at broch...@getpython.info for more information. We're very flexible in addressing your needs. MORE INFORMATION More information on the brochure, the idea behind it, media data and ordering links are available on our project page: http://brochure.getpython.info/ Thanks for your help, -- Marc-Andre Lemburg Director Python Software Foundation http://www.python.org/psf/ -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On Feb 11, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs travisgri...@gmail.com wrote: OTOH, I’m not sure I’ve heard the parameters-less functions are a code one? Is it just loose functions that you’re referring to? As opposed to methods (which are just bound functions)? I could maybe accept that. But methods with fewer arguments, and even none, are a desirable thing. There are code smells that are the opposite in fact, methods with long parameter lists are generally seen as code smell (“passing a paragraph”). 'self' is, imo, a parameter. When you call a parameter-less method on an object, it's usually an imperative with a direct object (or sometimes a subject): some_file.close() # Close some_file some_list.shuffle() # Shuffle some_list some_file.readline() # Some_file, read in a line There are times when, for convenience, the object is implicit. print(some text, file=some_file) # Print that text print(file=some_file) # Print a blank line print(some text) # Print that text to sys.stdout print() # Print a blank line to sys.stdout So in that situation, the no-args call does make sense. Of course, this is a call to a function that does take args, but it's accepting all the defaults and providing no additional content. It's quite different to actually define a function that mandates exactly zero arguments, and isn't making use of some form of implicit state (eg a closure, or maybe a module-level function that manipulates module-level state - random.random() would be an example of the latter). Syntactically, Python can't tell the difference between print() and foo() where foo can never take args. So at this point, what I’m reading is that actually making a “no arg function” is difficult, if we widen the semantics. The “arguments” of a function may be bound to its implicit self parameter, or tied to module state. I'd say that a function taking no args is code smell, unless it's obviously taking its state from somewhere else (callbacks, for instance - maybe you pass a bound method, or maybe a closure, but in either case it has implicit state that's not described by function args); but _calling_ with no args isn't as smelly. It's certainly less common than using args, but there are plenty of times when a type is called without args, for instance[1]. Which leaves me wondering, how would I get my code to smell this way then? What IS an example of a no arg function that doesn’t have an implicit object, that smells? It seems I can escape the smell clause, as long as I find some data that I reason is attached to my function. This all aside, I don’t think these are what the OP had in mind. A code inspection algorithm is not going to be able to discern when an explicitly parameterless function has implicit parameters. It’s just going to see something like print vs print() or aPoint.transpose vs aPoint.transpose() -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
On 2/11/2014 8:06 AM, David Robinow wrote: On Tue, Feb 11, 2014 at 5:45 AM, Terry Reedy tjre...@udel.edu wrote: On 2/11/2014 5:13 AM, Terry Reedy wrote: ... I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I wrote too soon. Python 3.4.0rc1 (v3.4.0rc1:5e088cea8660, Feb 11 2014, 05:54:25) [MSC import tkinter Traceback ... import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application. So tkinter, Idle, turtle fail and the corresponding tests get skipped. 32 bit and 64 bit both work for me. Windows 7. The failed 64-bit installs somehow messed up the 32-bit install. With 3.4 completely removed, including the residual directories, the 32-bit install works but the 64-bit install still gives me the same message. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
Mark Lawrence breamore...@yahoo.co.uk Wrote in message: No matter what I try I can't get the subcommands in lower-case when I have caps lock on, is there a simple work-around for this as well? :) You could do what I've done for my own DOS, Windows, and Linux computers for years: disable the caps-lock key -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Using asyncio for serial port
james.time4...@gmail.com: I'm looking at using asyncio for creating an socket - serial protocol bridge, but looking at the current implementation of asyncio it looks to be quite socket specific. I can't see any way to get it to support a simple serial device. Never tried it, but if you can open the serial device and get its file descriptor, you should be able to use http://docs.python.org/3.4/library/asyncio-eventloop.html#watch-file-descriptors BTW, the specification doesn't indicate if the reader/writer callbacks are level-triggered or edge-triggered. I'm afraid they are level-triggered. At any rate, asyncio looks like a real positive development in Pythonland. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
No, Gisle Vanem - I do NOT get the picture. First of all you did NOT answer my question. And this is the way I always have - and the people I typically respond to - respond to emails. Check the end - if that is where you expect me to enter any additional info. - Original Message - From: Gisle Vanem gva...@yahoo.no To: Walter Hughey wkhug...@gmail.com Cc: python-list@python.org Sent: Monday, February 10, 2014 4:13:44 PM Subject: Re: Newcomer Help Walter Hughey wkhug...@gmail.com wrote: Thank you for your reply. One quick question, when I reply should it be replay to all or to the person who sent the emial? When replying, the most important thing to remember is... order. A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? Get the picture now newcomer? --gv -- this crap came from you - Apple does install a version of Python, normally a somewhat older version. My computer has 2.5 and 2.6 installed and I have opened it and inserted code that works. I do need a way to write the code, test it, and then save a copy to turn in for the assignment. I was not aware that a normal text editor would work. I shall definitely look at that later today. Walter - Original Message - From: Rustom Mody rustompm...@gmail.com To: python-list@python.org Sent: Monday, February 10, 2014 11:07:14 AM Subject: Re: Newcomer Help On Monday, February 10, 2014 9:40:22 PM UTC+5:30, Walter Hughey wrote: I am new to Python programming, actually new to any programming language. I sent the email below to the python...@python.org a few days ago. So far I have not seen a reply, actually, I have not seen anything from pythonmac in any emails although I am supposed to be a member. I don't know if I am sending these to the correct place or if I am not receiving emails from the pythonmac list. I would appreciate any assistance either in how do I get to the pythonmac list or answers to the issue below. I went to the pythonmac list because I am trying to run Python 3.3 on a Mac computer. Thank you, Walter From: Walter Hughey wkhu...@gmail.com To: python...@python.org Sent: Friday, February 7, 2014 11:54:49 AM Subject: Newcomer Help Greetings, I am new at Python programming, technically a newbie at writing programming code. I have been involved in the maintenance of computers for several years and have decided to increase my knowledge and experience. I am taking a course that - although not a programming course - does require writing of code. I am trying to use Python to write the code. I use a Mac computer and the first issue is getting working with Python. The computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have added Python 3.3, the version our Professor recommended. I have checked out the Python installed by Apple and can enter in code and it works, but I need to create a file, run it, and then provide it for the Professor to grade and I don't know how with the Apple installed version. While reading about Python, I saw comments about the note concerning outdated software: If you are using Python from a python.org 64-bit/32-bit Python installer for Mac OS X 10.6 and later, you should only use IDLE or tkinter with an updated third-party Tcl/Tk 8.5, like ActiveTcl 8.5 installed. I located, downloaded and installed the recommended version of ActiveTcl 8.5.15.0. When I open Idle, I see a warning that The version of Tcl/Tk (8.5.7) in use may be unstable. I received this warning both before and after installing the software above. I open Idle, choose New File then most often the computer will freeze, Idle does nothing, cannot enter text into the text box, cannot close the application either with the red circle or by selecting IdleClose Idle. As often as that, Idle freezes as soon as I open new file, and I cannot close without resorting to Force Quit. I have removed and re-installed Python after downloading and installing the Tcl/Tk software and it does not help. I have seen this work fine on a Mac running Mac OS X 10.8.3. I really just need to get this working on the older version. A am not only new to Python, I am new on this list and hope I have started my stay here in the correct manner! Hi! You have started on a clear note and are welcome here. I dont know anything about macs so hopefully someone else will give you more specific answers. However can you check that python interpreter runs in a shell, and that after starting it if you type say: 2 + 3 RETURN you get 5 If that is the case you can still develop the way most python programmers develop, viz Write your code in a normal text editor
Re: [RELEASED] Python 3.4.0 release candidate 1
On 2/11/2014 10:42 AM, Duncan Booth wrote: Terry Reedy tjre...@udel.edu wrote: On 2/11/2014 2:43 AM, Larry Hastings wrote: On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get There is a problem with this Windows Installer package. A program required for the install to complete could not be run. No, the generic message does not bother to say *which* program :-(. 34 bit 3.4.0 installed fine. I redownloaded 64bit 3.4.0 and install gives the same message. Can someone verify that this is not some bizarre glitch on my machine? I downloaded and installed it without problems on a 64bit Windows 7 system. Maybe it is a bizarre glitch on your system, or perhaps it assumes something is present which is there on my system and missing on yours. As I noted in response to David, starting completely clean allows 32 bit version to install, but not 64 bit version. I see that part way through the install it downloads setuptools/pip from pypi. Did your system have network access? Enough to post the original message ;-). And yes, A box came up asking about that and I said yes. What happens if you enable the installer log by running: msiexec /i python-3.4.0rc1.amd64.msi /L*v logfile.txt A megabyte file with nearly 7000 lines Does it put any useful messages in logfile.txt? 'error' occurs on 40. most are like the following MSI (s) (40:08) [11:57:25:973]: Package to be registered: 'python-3.4.0rc1.amd64.msi' MSI (s) (40:08) [11:57:25:973]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (40:08) [11:57:25:973]: Note: 1: 2262 2: AdminProperties 3: -2147287038 Here is the one for the boxed message: Action 11:57:26: RemovePip. Action start 11:57:26: RemovePip. MSI (s) (40:0C) [11:57:26:426]: Note: 1: 1721 2: RemovePip 3: C:\Programs\Python34\python.exe 4: -m ensurepip._uninstall MSI (s) (40:0C) [11:57:26:426]: Note: 1: 2262 2: Error 3: -2147287038 Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RemovePip, location: C:\Programs\Python34\python.exe, command: -m ensurepip._uninstall MSI (s) (40:0C) [11:57:28:874]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (40:0C) [11:57:28:874]: Product: Python 3.4.0b2 (64-bit) -- Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RemovePip, location: C:\Programs\Python34\python.exe, command: -m ensurepip._uninstall MSI (c) (98:EC) [11:57:30:204]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'. Action ended 11:57:30: ExecuteAction. Return value 3. MSI (c) (98:EC) [11:57:30:204]: Doing action: FatalError A Can you make anything of these? -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Flag control variable
hello, i'd like to know how to set up a flag to change a variable, for example, i want a simple script to combine 2 numbers, sum = num + another_num print Now the sum of the numbers equals : , sum how could i make it so that if i type python ./script.py 21 41 that i get the sum of 21 and 41 ? luke -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On Tuesday, February 11, 2014, luke.gee...@gmail.com wrote: hello, i'd like to know how to set up a flag to change a variable, for example, i want a simple script to combine 2 numbers, sum = num + another_num print Now the sum of the numbers equals : , sum how could i make it so that if i type python ./script.py 21 41 that i get the sum of 21 and 41 ? Google for python command line arguments. -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
luke.gee...@gmail.com wrote: i'd like to know how to set up a flag to change a variable, for example, i want a simple script to combine 2 numbers, sum = num + another_num print Now the sum of the numbers equals : , sum how could i make it so that if i type python ./script.py 21 41 that i get the sum of 21 and 41 ? You seem to be looking for sys.argv which contains the script name and the command-line arguments. $ cat script.py import sys a = int(sys.argv[1]) b = int(sys.argv[2]) print a, +, b, =, a + b $ python script.py 21 41 21 + 41 = 62 The conversion to int (or float etc.) is necessary because in python 21 + 41 '2141' -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via implict conversion to boolean (and other steaming piles!)
On 2/11/2014 11:19 AM, Travis Griggs wrote: On Feb 11, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote: So in that situation, the no-args call does make sense. Of course, this is a call to a function that does take args, but it's accepting all the defaults and providing no additional content. It's quite different to actually define a function that mandates exactly zero arguments, and isn't making use of some form of implicit state (eg a closure, or maybe a module-level function that manipulates module-level state - random.random() would be an example of the latter). Syntactically, Python can't tell the difference between print() and foo() where foo can never take args. So at this point, what I’m reading is that actually making a “no arg function” is difficult, if we widen the semantics. It is quite easy. def f(): return 3 # or any other constant. Chris said that useful functions in Python are (mostly) not really niladic, which is equivalent to saying that niladic functions in Python are (mostly) not really useful. They are a mainly a device in pure function theory to have constants (True, False, 0, 1, ...) while also having everything be a function (the 'pure' part). Pure set theory uses its own tricks to make the same constants (and functions) be sets ;-). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Thanks a lot -- https://mail.python.org/mailman/listinfo/python-list
Metaprogramming question
The discussion about niladic functions, made me want to follow a segue and do some reflection/introspective programming in Python. I’ve not done a lot of that yet, and it seemed like an educational (well, at least entertaining) goose chase. If I run the following code: import datetime datetime.datetime.now(13, 42) I will get an error (expected). The error I will get is: Traceback (most recent call last): File stdin, line 1, in module TypeError: now() takes at most 1 argument (2 given) So, at some point, there’s some metadata in the system attached to the builtin datetime.datetime.now method, that indicates 1 argument, tops. So here’s my basic question. Is there anyway to programatically query that information in python code? inspect.signature(datetime.datetime.now) just gives a ValueError. inspect must only be good for the python code that I write, in python. Is there another way to dig out what the interpreter knows there? -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
when expandig the script to multiple calcs i got a problem a = 32 c = 51 sign = * File stdin, line 1 sign = * ^ SyntaxError: invalid syntax is there a way of adding * without quoting marks, because if you do it just soms the arguments -- https://mail.python.org/mailman/listinfo/python-list
Re: Metaprogramming question
On Tue, Feb 11, 2014 at 12:13 PM, Travis Griggs travisgri...@gmail.com wrote: So here’s my basic question. Is there anyway to programatically query that information in python code? inspect.signature(datetime.datetime.now) just gives a ValueError. inspect must only be good for the python code that I write, in python. Is there another way to dig out what the interpreter knows there? Fixing that issue is in the works. Argument Clinic[1][2] has been added for Python 3.4 which, once all C functions have been converted, will provide signature information for all builtins (functions written in C). If you try out the Python 3.4 RC1[3], you can try inspect.signature(datetime.datetime.now) again and get the information you expect: that's one of the (unfortunately relatively few) builtins that is already converted. Aside from the Argument Clinic effort, builtin functions are pretty much black boxes to Python--hence why we're trying to fix it! -- Zach [1] http://docs.python.org/3.4/howto/clinic.html [2] http://hg.python.org/cpython/file/default/Tools/clinic/clinic.py [3] http://python.org/download/releases/3.4.0/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 2014-02-11 10:16, luke.gee...@gmail.com wrote: when expandig the script to multiple calcs i got a problem a = 32 c = 51 sign = * File stdin, line 1 sign = * ^ SyntaxError: invalid syntax is there a way of adding * without quoting marks, because if you do it just soms the arguments -- You want to store the actual operation. The operator module makes this fairly easy, so you can do something like import operator as o operations = { *: o.mul, +: o.add, /: o.div, -: o.sub, } a = 32 c = 51 operation = operations[*] print(operation(a,c)) -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
well i'm trying something else but no luck : #!bin/bash/python import sys import os a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 2014-02-11 10:37, luke.gee...@gmail.com wrote: command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + This is the fault of your shell (bash perhaps)? Try this: bash$ echo + + bash$ echo * (a list of files in your current directory here) which occurs because of file-globbing. You have a couple options that occur to me: 1) quote the asterisk: bash$ ./mycode.py 3 * 2 which will let Python see it without the shell expanding it 2) use a different character/string such as 3 times 2 3) pass the whole thing as a quoted string and then let Python do the splitting: bash$ ./mycode.py 3 * 2 a, operator, b = argv[1:].split() print(a,b,c) -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
luke.gee...@gmail.com wrote: well i'm trying something else but no luck : #!bin/bash/python Hm. import sys import os For debugging purposes put the line print sys.argv here to see what arguments are passed to the script. When you type $ python script.py 2 * 2 in the shell the * sign is replaced with all items in the current directory. To avoid that you have to escape, i. e. prepend a backslash: $ python script.py 2 \* 2 To illustrate: $ touch one two three $ ls one three two $ python -c 'import sys; print sys.argv' 2 + 2 ['-c', '2', '+', '2'] $ python -c 'import sys; print sys.argv' 2 * 2 ['-c', '2', 'one', 'three', 'two', '2'] $ python -c 'import sys; print sys.argv' 2 \* 2 ['-c', '2', '*', '2'] a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + -- https://mail.python.org/mailman/listinfo/python-list
Re: pip3.x error using LIST instead of list
https://groups.google.com/forum/#!topic/python-virtualenv/8wzQfjQW2i8 -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero, Python falls back to the worse case. sys.getsizeof('a' * 100) 125 sys.getsizeof('a' * 100 + 'oe') 240 sys.getsizeof('a' * 100 + 'oe' + '\U0001') 448 If Python used UTF-32 for EVERYTHING, then all three of those cases would be 448, so it clearly disproves your claim that python does not save memory at all. The opposite of what the utf8/utf16 do! sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16')) 225 However, as pointed out repeatedly, string-indexing in fixed-width encodings are O(1) while indexing into variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR gives the benefits of O(1) indexing while saving space when a string doesn't need to use a full 32-bit width. A utf optimizes the memory and the performance at the same time. It behaves like a mathematical operator, a unique operator for a unique set of elements. Unbeatable. The FSR is an exclusive or mechanism. I you wish to same memory, you have to encode, and if you are encoding, maybe because you have to, one loses performance. Paradoxal. Your O(1) indexing works only and only because and when you are working explicitly with a static unicode string you never touch. It's a little bit the the corresponding performance case of the memory case. jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 19:55:59 UTC+1 schreef Gary Herron: On 02/11/2014 10:37 AM, luke.gee...@gmail.com wrote: well i'm trying something else but no luck : #!bin/bash/python import sys import os a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + Look at the error message. Carefully! It says, quite clearly, the call to int is being passed a string Adafruit-Raspberry-Pi-Python-Code, which of course can't be converted to an integer. Now the question is how you ran the program in such a manner that sys.argv[3] has such an odd value. What does your command line look like? You didn't tell us, but that's where the trouble is. Gary Herron how do you meen what does your command line look like? -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 10:37 AM, luke.gee...@gmail.com wrote: well i'm trying something else but no luck : #!bin/bash/python import sys import os a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + Look at the error message. Carefully! It says, quite clearly, the call to int is being passed a string Adafruit-Raspberry-Pi-Python-Code, which of course can't be converted to an integer. Now the question is how you ran the program in such a manner that sys.argv[3] has such an odd value. What does your command line look like? You didn't tell us, but that's where the trouble is. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 11/02/2014 18:53, wxjmfa...@gmail.com wrote: Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero, Python falls back to the worse case. sys.getsizeof('a' * 100) 125 sys.getsizeof('a' * 100 + 'oe') 240 sys.getsizeof('a' * 100 + 'oe' + '\U0001') 448 If Python used UTF-32 for EVERYTHING, then all three of those cases would be 448, so it clearly disproves your claim that python does not save memory at all. The opposite of what the utf8/utf16 do! sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16')) 225 However, as pointed out repeatedly, string-indexing in fixed-width encodings are O(1) while indexing into variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR gives the benefits of O(1) indexing while saving space when a string doesn't need to use a full 32-bit width. A utf optimizes the memory and the performance at the same time. It behaves like a mathematical operator, a unique operator for a unique set of elements. Unbeatable. The FSR is an exclusive or mechanism. I you wish to same memory, you have to encode, and if you are encoding, maybe because you have to, one loses performance. Paradoxal. Your O(1) indexing works only and only because and when you are working explicitly with a static unicode string you never touch. It's a little bit the the corresponding performance case of the memory case. jmf Why are you so rude as to continually post your nonsense here that not a single person believes, and at the same time still quite deliberately use gg to post it with double line spacing. If you lack the courtesy to stop the former, please have the courtesy to stop the latter. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: luke.gee...@gmail.com wrote: well i'm trying something else but no luck : #!bin/bash/python Hm. import sys import os For debugging purposes put the line print sys.argv here to see what arguments are passed to the script. When you type $ python script.py 2 * 2 in the shell the * sign is replaced with all items in the current directory. To avoid that you have to escape, i. e. prepend a backslash: $ python script.py 2 \* 2 To illustrate: $ touch one two three $ ls one three two $ python -c 'import sys; print sys.argv' 2 + 2 ['-c', '2', '+', '2'] $ python -c 'import sys; print sys.argv' 2 * 2 ['-c', '2', 'one', 'three', 'two', '2'] $ python -c 'import sys; print sys.argv' 2 \* 2 ['-c', '2', '*', '2'] a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + when using python script.py 2 \* 2 i get Traceback (most recent call last): File math2.py, line 5, in module sign = int(sys.argv[2]) ValueError: invalid literal for int() with base 10: '*' -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 10:59 AM, luke.gee...@gmail.com wrote: Look at the error message. Carefully! It says, quite clearly, the call to int is being passed a string Adafruit-Raspberry-Pi-Python-Code, which of course can't be converted to an integer. Now the question is how you ran the program in such a manner that sys.argv[3] has such an odd value. What does your command line look like? You didn't tell us, but that's where the trouble is. Gary Herron how do you meen what does your command line look like? When you run this python script, *how* do you do so? Perhaps you type something like: python script.py 21 '*' 42 If not, then how do you supply values for the script's sys.argv? If it is like that, then I see the most likely potential problem. The asterisk character (on Linux at least) is considered a wild-card character -- it is replaced by a list of local files so your command becomes python script.py 21 somefile1 somefile2 somefile3 ...and so on. 42 If you put it in quotes, then it won't be expanded (at least in the usual Linux shells -- you system may vary) and you'll end up with the asterisk in sys.argv[2] and the number in sys.argv[3]. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 11/02/2014 18:59, luke.gee...@gmail.com wrote: Would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spaced text that I've snipped, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 20:01:05 UTC+1 schreef luke@gmail.com: Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: luke.gee...@gmail.com wrote: well i'm trying something else but no luck : #!bin/bash/python Hm. import sys import os For debugging purposes put the line print sys.argv here to see what arguments are passed to the script. When you type $ python script.py 2 * 2 in the shell the * sign is replaced with all items in the current directory. To avoid that you have to escape, i. e. prepend a backslash: $ python script.py 2 \* 2 To illustrate: $ touch one two three $ ls one three two $ python -c 'import sys; print sys.argv' 2 + 2 ['-c', '2', '+', '2'] $ python -c 'import sys; print sys.argv' 2 * 2 ['-c', '2', 'one', 'three', 'two', '2'] $ python -c 'import sys; print sys.argv' 2 \* 2 ['-c', '2', '*', '2'] a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, =, a + b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_plus%s_equals%s' % (a, b, sum) os.system (command1) elif sign == *: sum = a * b print a, sign, b, =, a * b command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' % (a, b, sum) when using * i get Traceback (most recent call last): File ./math+.py, line 6, in module b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + when using python script.py 2 \* 2 i get Traceback (most recent call last): File math2.py, line 5, in module sign = int(sys.argv[2]) ValueError: invalid literal for int() with base 10: '*' i found it int(sys.argv[2]) should be sys.argv[2] is there a way i can do python ./script.py 3 * 3 instead of python ./script 3 \* 3 ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
luke.gee...@gmail.com writes: when using python script.py 2 \* 2 i get Traceback (most recent call last): File math2.py, line 5, in module sign = int(sys.argv[2]) ValueError: invalid literal for int() with base 10: '*' You've mis-spelt sigh. This is not the code that you posted. You misunderestimate that error message. It tells everything. -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 11:01 AM, luke.gee...@gmail.com wrote: when using python script.py 2 \* 2 i get Traceback (most recent call last): File math2.py, line 5, in module sign = int(sys.argv[2]) ValueError: invalid literal for int() with base 10: '*' Stop trying to guess what is going on. Print out sys.argv, and *see* what values are there. Then read the error message. You wrote your script expecting sys.argv[2] to contain an int, but in fact (according to the error) it contains a '*' -- which can't be converted to an integer obviously. Your error is in running the script incorrectly, *OR* in your understanding of how the command line arguments get placed in sys.argv. In either case you best bet is to examine sys.argv by printing it (or examining it within a debugger) and *see* what values it contains. Then adjust your script (or the running of it) accordingly. These are very beginner level debugging suggestions. If you develop the skill to read and understand the error messages, and the skill to print (or otherwise examine) the values your program is dealing with, you progress will by 100's of times faster then this slow wait for someone to respond to on this list. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 11:06 AM, luke.gee...@gmail.com wrote: i found it int(sys.argv[2]) should be sys.argv[2] is there a way i can do python ./script.py 3 * 3 instead of python ./script 3 \* 3 ? That's not really a Python question. The shell (as it's called) which interprets your typed command and runs Python with the rest of the command line arguments is in control of this. If you can find a way to tell your shell to not expand '*' characters, or find a shell that does not do so, then yes, you can dispense with the back-slash. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 2014-02-11 11:06, luke.gee...@gmail.com wrote: command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' 1) PLEASE either stop using Google Groups or take the time to remove the superfluous white-space you keep adding to your posts/replies 2) you shouldn't need to use sudo to play sounds. That's just a bad practice waiting for trouble. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASED] Python 3.4.0 release candidate 1
Hi. On 11.2.2014. 17:21, Terry Reedy wrote: The failed 64-bit installs somehow messed up the 32-bit install. With 3.4 completely removed, including the residual directories, the 32-bit install works but the 64-bit install still gives me the same message. I had a similar problem with the beta 3 release where x64 failed to install on my computer. Not sure if the underlying issue is the same as yours but my issue was resolved after uninstalling the Visual Studio C++ runtime, rebooting and doing a clean install. I wanted to report the issue then, but since I could not reproduce it, I had nothing exact to say other than 'did not work for me, now it does, don't know if it was me or you'. :-) Hope this helps. Best regards, Jurko Gospodnetić -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 20:28:44 UTC+1 schreef Tim Chase: On 2014-02-11 11:06, luke.gee...@gmail.com wrote: command1 = sudo mpg321 'http://translate.google.com/translate_tts?tl=enq=%s_times%s_equals%s' 1) PLEASE either stop using Google Groups or take the time to remove the superfluous white-space you keep adding to your posts/replies 2) you shouldn't need to use sudo to play sounds. That's just a bad practice waiting for trouble. -tkc its one rule in the original (at least on my computer) -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
hey, i got another problem now, if i use the imterpreter to do 3 * 4 it gives twelve the script gives ? any tips -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 11/02/2014 19:54, luke.gee...@gmail.com wrote: Op dinsdag 11 februari 2014 20:28:44 UTC+1 schreef Tim Chase: 1) PLEASE either stop using Google Groups or take the time to remove the superfluous white-space you keep adding to your posts/replies For the THIRD time, would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing which I've AGAIN snipped, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 11:55 AM, luke.gee...@gmail.com wrote: hey, i got another problem now, if i use the imterpreter to do 3 * 4 it gives twelve the script gives ? any tips 3*4 12 3*4 '' Multiplying two integers produces the result you expect. Multiplying a *string* by an integer is what you are doing. (And it just repeats the string a number of times -- not what you want.) Your code used to have int(...) to convert the string supplied by sys.argv into integers. What happened to them? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Would it be possible to make an int(sys.argv[1]) Not needed and set value 0 ( or in another script 1) For example a = int(sys.argv[1]) b = int(sys.argv[2]) c = int(sys.argv[3]) And I run Python ./script.py 2 3 It just set c automaticly to 0 or 1 Luke (PS thanks for the quick help) -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
Steven D'Aprano wrote: Secondly, O(N*log N) applies to *comparison sorts*. Non-comparison sorts such as radix-, counting- and bucket-sort have average case complexity of O(N). They require additional space, though. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
On 02/11/2014 01:18 PM, luke.gee...@gmail.com wrote: Would it be possible to make an int(sys.argv[1]) Not needed and set value 0 ( or in another script 1) For example a = int(sys.argv[1]) b = int(sys.argv[2]) c = int(sys.argv[3]) And I run Python ./script.py 2 3 It just set c automaticly to 0 or 1 Luke (PS thanks for the quick help) That question does not make sense to me. Yes, you can set c=1 in your program, or zero if that's what you want, but this can't be the question you are really trying to ask. -- https://mail.python.org/mailman/listinfo/python-list
Re: ANN: PSF Python Marketing Brochure - Last call for Ad Sponsors
Under Subscription Sponsors in the listing of destinations, I'm going to guess from the grouping that NE should be NL. Emile On 02/11/2014 08:18 AM, M.-A. Lemburg wrote: [Please help spread the word by forwarding to other relevant mailing lists, user groups, etc. world-wide; thanks :-)] ANNOUNCING PSF Python Marketing Brochure - Last call for Ad Sponsors Please support the PSF in providing the Python community with free high quality marketing material to promote Python INTRODUCTION Over the last few years, the Python brochure team has worked on and created a high-quality brochure to help user groups, conferences and companies using Python to promote and spread the word about Python. The brochure will be printed in a first edition of 10,000 copies which the PSF will then distribute to user groups, Python conferences and educational institutions on request and free of charge. With the Python brochure, we hope to reach out to an audience which is not easy to address and convince using electronic and mostly developer oriented media. PREVIEW Please take a look at our preview PDF version of the brochure to see for yourself: http://brochure.getpython.info/preview.pdf SEEKING YOUR HELP The team set out to create and print the brochure without introducing extra costs for the PSF. Our aim is to fully finance the brochure production, printing and shipment to interested parties using money from sponsors. To make this happen, we are seeking your help ! = We have already signed up sponsors for 6 half page ads, but still need another *5 half page ad sponsors* to sign up. = There are also *6 smaller reference entry sponsorships* left to be sold. If you are affiliated with or know a company investing into Python and looking for ways to reach out to a large audience of interested Python users, students, developers - and people in key decision making positions, please reach out to us and help make the project a success. The deadline for ad and reference entry signups is *Feb 28* - in just under three weeks. You can find all the details about the available sponsorship options on this page: http://brochure.getpython.info/sponsorship Orders can be placed directly with the production company, Evenios Publishing on the website. All sponsors will receive a box of about 120 free copies of the brochure as Thank You gift. ORDERING EXTRA COPIES Companies who are interested in receiving extra copies can pre-order additional boxes which will then be printed in addition to the initial 10.000 copy batch: http://brochure.getpython.info/mediadata/subscription-order-procedure It is also possible to donate such extra boxes to educational institutions: http://brochure.getpython.info/mediadata/education-sponsorship If you have special requirements, please contact the team at broch...@getpython.info for more information. We're very flexible in addressing your needs. MORE INFORMATION More information on the brochure, the idea behind it, media data and ordering links are available on our project page: http://brochure.getpython.info/ Thanks for your help, -- https://mail.python.org/mailman/listinfo/python-list
Python programming
Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem -- https://mail.python.org/mailman/listinfo/python-list
Python programming
Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem -- https://mail.python.org/mailman/listinfo/python-list
Fun with function argument counts
After the recent discussion about the classic error: if self.isFooBar: return 42 Among many thing, the OPs contention was that the ability to have this kind of error was a Bad Thing (tm). Which led to me asking about code smells and parameterless functions/methods. So I got curious. Semantics of implicit objects aside, how often is it possible to write code like that. In short, how frequent are methods/functions that have zero explicit args (not implicit, because while fun, that’s not how we code them). It was a fun experiment, I’ve been doing python for a little over a year now, and I thought it would be enjoyable/educational to do a bit of metaprogramming. First the results though. Below is a histogram of function argument count: argCount x occurrences (% of total) -1 x 10426 ( 3.2%) # these are where I stuffed all of the routines I couldn’t extract the argspecs for 0 x 160763 (48.7%) 1 x 109028 (33.0%) 2 x 40473 (12.3%) 3 x 7059 ( 2.1%) 4 x 2383 ( 0.7%) 5 x 141 ( 0.0%) 6 x46 ( 0.0%) 7 x12 ( 0.0%) 10 x 1 ( 0.0%) 16 x 1 ( 0.0%) 19 x 2 ( 0.0%) Nearly half of the functions/methods I scanned were zero args (48.7). Which was more than I expected. I haven’t dug enough to see if there’s a flock of canaries in there or not. The code to produce that table is here: https://gist.github.com/anonymous/8947229. Yes, it’s hacky. Wasn’t trying to win any style/idiom awards with this one. To get this table, I used PyPy 3-2.1 beta for OSX. I basically attempted to parse all of the modules found in it’s lib-python directory. A subset of the modules wouldn’t load, I’m not sure whether to write that off as the work-in-progress nature of pypy or what. And I black listed some of them (such as idlelib.idle, ctypes.test.*, etc). But from the counts, I was able to get a pretty large corpus of them. I learned a number of fun things as part of the exercise: 1) I did not want to try load all modules at once into my environment. I suspect that would create problems. Using os.fork() to isolate the load/analysis of each module was a handy way to deal with that. The trick of using if pid: branch to split of the flow of execution was cool. Maybe it’s the wrong tool for the job and I missed an obvious one, but I thought it was kinda clever. 2) Using cpython, a lot of the core library can’t be reflected on. I tried to use the inspect module, and found that things like inspect.getmembers(datetime.datetime, inspect.ismethod) resulted in a big surprise. Especially if you leave off the predicate, and see that there are a lot of things in there that claim they ARE methods). I finally stumbled into inspect.isroutine, but found that most of the results couldn’t be reified using inspect.signature anyway. The “it’s all python, all the way down, well mostly” ideology of pypy ensured that a higher percentage opt the base libraries could be analyzed. 3) It’s easy to take 3.3.x for granted. I found right away that signature was introduced in 3.3, so I had to use inspect.getfullargspec() instead. 4) optional arguments were an interesting dillema. I chose to reduce the argument count of a signature by the number of default arguments. Since they are essentially optional. So the stats there have a bias to the “minimal” call signature. 5) my method of scanning loadable modules is probably very naive/brute force/stupid. I would love it if there was a better way to do that. 6) Who writes a function with 19 mandatory arguments anyway subprocess._execute_child() and distutils.cygwincompiler._execute_child() 7) I’m not entirely sure, given #6, that I’m not seeing inherited methods for all classes, so getting an overinflated count from them. Can anyone answer that? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On 12/02/2014 00:21, ngangsia akumbo wrote: Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem You *NEVER* stop learning. To become a master thinker take a degree in philosophy. On the other hand to master tkinter search for a tutorial that you can follow. Or if you're feeling brave help out with tkinter or IDLE issues on the bug tracker at bugs.python.org :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Fun with function argument counts
On Wed, Feb 12, 2014 at 11:34 AM, Travis Griggs travisgri...@gmail.com wrote: 1) I did not want to try load all modules at once into my environment. I suspect that would create problems. Using os.fork() to isolate the load/analysis of each module was a handy way to deal with that. The trick of using if pid: branch to split of the flow of execution was cool. Maybe it’s the wrong tool for the job and I missed an obvious one, but I thought it was kinda clever. That's the normal way to use fork() in any environment. The standard C idiom is to call fork(), and then test for *three* possibilities: 0 means you're in the child, 0 means you're in the parent, and 0 means you're still in the parent, and forking failed. Python simplifies that a bit by raising an error if something goes wrong, so you can simply: if os.fork(): # Parent continues else: # Child process 2) Using cpython, a lot of the core library can’t be reflected on That's being improved as of 3.4, thanks to Argument Clinic. Though the whole stdlib might not be converted, so you might have to wait for 3.5. 4) optional arguments were an interesting dillema. I chose to reduce the argument count of a signature by the number of default arguments. Since they are essentially optional. So the stats there have a bias to the “minimal” call signature. That's one way to look at it. That tells you what can be called with no args. But it's not always a fair look at the function's usefulness; maybe with no arguments, it always returns a constant value: bool() False The bool function (really the type/constructor) is much more useful with an argument, but it's technically callable without. 6) Who writes a function with 19 mandatory arguments anyway subprocess._execute_child() and distutils.cygwincompiler._execute_child() Hmm. Those are internal functions (leading underscore). Might be fairer to remove those from consideration. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Simple % question
I just have a simple question. I don’t understand why 1%10 = 1? -- https://mail.python.org/mailman/listinfo/python-list
Re:Python programming
ngangsia akumbo ngang...@gmail.com Wrote in message: Please i have a silly question to ask. No silly questions, just silly answers. How long did it take you to learn how to write programs? An hour, twenty years. It took an hour to learn how the keypunch worked, where the manuals were mounted, and how to submit unauthorized card decks to the college computer. Twenty years to find out that managing people was harder than managing computer languages. I did some of my best work before I learned that some of those problems were impossible. What is the best way i can master thinker? Never heard of it. Is it a computer language? I know the syntax but using it to write a program is a problem -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On Wed, Feb 12, 2014 at 11:21 AM, ngangsia akumbo ngang...@gmail.com wrote: Please i have a silly question to ask. How long did it take you to learn how to write programs? Well, let's see. I started programming a quarter of a century ago, and I'm a lot less than a quarter of the way to knowing everything about programming, so I'd say it'll take at least a hundred years :) Seriously, you will spend your whole life learning. Just as a program is never finished, but at some point you ship it, so also a programmer has never learned, but at some point you start writing things that are useful to other people. At what point does that happen? Varies enormously. Lots of teenagers go through a school or uni course on programming thinking, I'm going to write a computer game!. That is, IMO, a bad start to programming - a truly fun game that can be written after taking a basic comp sci course is going to be a reimplementation of one that already exists (maybe Othello - that would be within a uni graduate's skill, I think), which isn't what most people think of when talking about writing a computer game. So what's your goal? Automate some mundane task that you do every day/week/month? You could master that fairly readily. Win at Jeopardy using a supercomputer? Try assembling an IBM-level team of experts. :) What is the best way i can master thinker? I know the syntax but using it to write a program is a problem As Mark says, mastering tkinter means picking up a tutorial and working through it. More generally, I would recommend learning *any* skill (programming or not) by having a need, and chipping away at the problem until you've solved it to your own satisfaction. Don't learn tkinter just for the sake of learning tkinter; learn it because you want to make XYZ, for which you want/need a GUI. (Until you're an expert programmer already. Then you might learn a new skill just for the sake of learning it, but there's a difference, and you'll know it when you get to that point. Sometimes it's fun to create something under stupid restrictions that make absolutely no sense - that's part of the basis of code golf, for instance.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re:Python programming
Dave Angel wrote: What is the best way i can master thinker? Never heard of it. Is it a computer language? Socrates himself is particularly missed -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On Wed, Feb 12, 2014 at 12:11 PM, Dave Angel da...@davea.name wrote: I did some of my best work before I learned that some of those problems were impossible. Sounds like something from the invention of Post-It Notes. I can't find an authoritative source, but it's all over the internet, attributed to Spencer Silver: If I had thought about it, I wouldn't have done the experiment. The literature was full of examples that said you can't do this. Programming is often like this. Actually, computing generally. The literature was full of examples that said that Alice: Madness Returns required Windows 7, a hot video card, and so on. Turns out that Linux and Wine will do the job quite nicely. Never mind that the makers are completely uninterested in helping... I just did some leg-work and got my favourite recent game going under my favourite operating system :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On Tue, Feb 11, 2014 at 8:21 PM, Walter Hurry walterhu...@gmail.com wrote: Dave Angel wrote: What is the best way i can master thinker? Never heard of it. Is it a computer language? Socrates himself is particularly missed A lovely little thinker, but a bugger when he's pissed. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On Wednesday, February 12, 2014 2:11:39 AM UTC+1, Dave Angel wrote: ngangsia akumbo ngang...@gmail.com Wrote in message: python GUI Tkinter -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
Scott W Dunning swdunn...@cox.net writes: I just have a simple question. I don’t understand why 1%10 = 1? Have you read the documentation for that operator? URL:http://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations The language reference URL:http://docs.python.org/3/reference/ is the place to look for official explanations of language features. -- \ “I met my girlfriend in Macy's; she was buying clothes, and I | `\ was putting Slinkies on the escalators.” —Steven Wright | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Fun with function argument counts
On 02/11/2014 05:05 PM, Chris Angelico wrote: On Wed, Feb 12, 2014 at 11:34 AM, Travis Griggs wrote: 6) Who writes a function with 19 mandatory arguments anyway subprocess._execute_child() and distutils.cygwincompiler._execute_child() Hmm. Those are internal functions (leading underscore). Might be fairer to remove those from consideration. Not at all. Even private routines get used by somebody! ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On Wed, Feb 12, 2014 at 12:06 PM, Scott W Dunning swdunn...@cox.net wrote: I just have a simple question. I don’t understand why 1%10 = 1? The real question is: What do you expect that symbol to mean? Its actual meaning is quite simple. In long division, dividing one number by another looks like this: 86528 31415 ) 2718281828 251320 -- 205081 188490 -- 165918 157075 -- 88432 62830 - 256028 251320 -- 4708 (Monospaced font required here.) 2718281828 is the dividend; 31415 is the divisor. They're the numbers we started with. At the top, we get the quotient, 86528, and down the bottom, the remainder, 4708. Now let's ask Python about those numbers: 2718281828 // 31415 86528 2718281828 % 31415 4708 That's all it is. The // operator, when given two integers, will give back an integer which is the quotient. The % operator (usually called modulo), given the same two integers, gives you back the remainder. With the dividend smaller than the divisor, your quotient is zero and your remainder is the whole rest of the number; so 1 % 10 is 1. In fact, 1 % anything greater than 1 will be 1. Does that help? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On 02/11/2014 07:06 PM, Scott W Dunning wrote: I just have a simple question. I don’t understand why 1%10 = 1? I think because 1 is evenly divisible by 10 exactly 0 times with a 1 remainder. I mean int(1 / 10) == 0, with a 1 remainder. The same is true for all numbers leading up to 10. for i in range(12): print('{} % 10 == {}'.format(i, i % 10)) 0 % 10 == 0 1 % 10 == 1 2 % 10 == 2 3 % 10 == 3 4 % 10 == 4 5 % 10 == 5 6 % 10 == 6 7 % 10 == 7 8 % 10 == 8 9 % 10 == 9 10 % 10 == 0 11 % 10 == 1 You can see that with the divmod() function also. -- \¯\ /¯/\ \ \/¯¯\/ / / Christopher Welborn (cj) \__/\__/ / cjwelborn at live·com \__/\__/ http://welbornprod.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On Wednesday, February 12, 2014 6:36:17 AM UTC+5:30, Scott W Dunning wrote: I just have a simple question. I don't understand why 1%10 = 1? This is not really about python. See http://en.wikipedia.org/wiki/Euclidean_division Particularly the examples section and note that when you divide a by b you get a quotient -- q and remainder -- r. In your case a is 1 b is 10. Now see that wikipedia page -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On Wednesday, February 12, 2014 5:51:29 AM UTC+5:30, ngangsia akumbo wrote: Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem It takes 5 years to become a doctor It takes 10 years to become a musician At 3 years or thereabouts, (a typical computer science degree), programming is a bit easier. With some shaving off of fluff one could halve that 3 years. With even more aggressive shaving off, maybe one more halve. But thats it. And that implies: - You are working full (and over) time just to learn - You have a bunch of intelligent and dedicated teachers calibrating your progress and your learning-curve - You have at least normal intelligence - You dont suffer from excessive delusions [Just in case you think the last insulting, let me tell you about myself: When I was doing my first programming class, my 'goal' was to write an Ada compiler. This is called a delusion] It may help you to have a look at the area as seen for example here: http://ai.stanford.edu/users/sahami/CS2013/strawman-draft/cs2013-strawman.pdf -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
On Tuesday, February 11, 2014 10:19:53 PM UTC+5:30, Walter Hughey wrote: This newcomer apologizes for -- this crap came from you -. Firstly, on the behalf of the list, Apologies for uncalled for and unhelpful rudeness I suppose what you mean by top posting is replying to an email by entering a reply at the top when according to your policies and procedures - a person should reply at the bottom of the email - like this. IF/WHEN I am on this site, I shall do my utmost best to change the way I and the people I normally work with to reply at the bottom, Assuming Gisle Vanem this is what you mean and what you want. See http://en.wikipedia.org/wiki/Posting_style Most people here prefer interleaved posting with significant trimming. In other contexts eg corporates, often the culture is the opposite: top-posting with strictly NO trimming. And one more suggestion: Use text mode for your posts not html I hope I have not totally destroyed all of everybody's systems with my inappropriate and thoughtless disregard for the sanctity of this site. May be it be best I not reply/ask for help/or in any way be involved in this site. No you have done no such thing and I hope you wont generalize one instance to the whole community -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
In article b2db52b0-d7f7-43dd-9ddf-86feb109e...@googlegroups.com, ngangsia akumbo ngang...@gmail.com wrote: Please i have a silly question to ask. How long did it take you to learn how to write programs? I've been working on it for 40 years. I'll let you know when I get there. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
On 2/11/2014 7:21 PM, ngangsia akumbo wrote: Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem Here's one way to learn: Start with a manual (the online Python and Tkinter manuals are fine) and a computer. While (true): Write some code using skills that you have plus at least one new thing you've never done before that you will master and add to your skills. If you're not having fun: break To start, a total beginner might try things that take 10 minutes and 3 lines of code. Over time the skills he has will keep increasing and he'll find himself writing longer programs that take more time to write and produce more interesting outputs. The key is to have fun. If you find this work interesting and absorbing, you'll learn quickly and you'll enjoy all the time that you spend on it. You might get good enough in just a few months to try some very significant and useful programs. You won't be ready to write commercial software, but you'll be on your way. If you find it uninteresting, boring, or impossible to understand, then programming might not be the right thing for you. That doesn't mean you aren't smart. I've met some very smart people who don't like programming and aren't good at it. There are already too many programmers who don't really like programming and just learned it because they thought they could get good jobs. Most of them wind up with relatively bad jobs and are not respected by their colleagues. Don't join that crowd. Best of luck. Alan -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
2014-02-11 20:24 GMT-04:30 Mark Lawrence breamore...@yahoo.co.uk: To become a master thinker take a degree in philosophy. On the other hand to master tkinter search for a tutorial that you can follow. Or if you're feeling brave help out with tkinter or IDLE issues on the bug tracker at bugs.python.org :) That's a good option too! Once you know the basics, try this book -- http://inventwithpython.com/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
Hello! Well, I got the knowledge at college, it took me a year to know the basics (But I guess it can take less if you work hard on it). I began with C, then C++ and right now I'm with Python (I use PHP too). That said, there are some interesting resources out there that you can use to learn. Codeacademy is a very good one[1]. Best of luck with your endeavor :) [1] http://www.codecademy.com 2014-02-11 19:51 GMT-04:30 ngangsia akumbo ngang...@gmail.com: Please i have a silly question to ask. How long did it take you to learn how to write programs? What is the best way i can master thinker? I know the syntax but using it to write a program is a problem -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On Feb 11, 2014, at 6:51 PM, Christopher Welborn cjwelb...@live.com wrote: I think because 1 is evenly divisible by 10 exactly 0 times with a 1 remainder. I mean int(1 / 10) == 0, with a 1 remainder. The same is true for all numbers leading up to 10. Actually I think I get it now. I think I was not really looking at it as 1/10 more like the other way around. -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On Wed, Feb 12, 2014 at 2:30 PM, Scott W Dunning swdunn...@cox.net wrote: On Feb 11, 2014, at 6:36 PM, Chris Angelico ros...@gmail.com wrote: The real question is: What do you expect that symbol to mean? Its actual meaning is quite simple. In long division, dividing one number by another looks like this: Yeah I understand what the % means. It just confused me that 1%10 was 1. In my thought process it just didn’t work. 1/10= .1 and I just didn’t see where the remainder of 1 came in. Ah, yes. When Python 2 - Python 3 changed the meaning of / the meaning of % got tied instead to //. But if you think about it, with the floating-point result you're describing there, it simply makes no sense to even ask what the remainder is. So, if you're going to use %, use //, and then it all makes sense. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python programming
ngangsia akumbo ngang...@gmail.com writes: Please i have a silly question to ask. How long did it take you to learn how to write programs? Please clarify what you mean by “how to write programs”. I could write programs perhaps ten minutes after beginning to learn; but learning how to write programs *well* is a learning journey which continues thirty years later. So, what are you asking? What level of skill do you want to attain, how would you describe the goal? -- \ “In general my children refuse to eat anything that hasn't | `\ danced on television.” —Erma Bombeck | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
Rustom Mody rustompm...@gmail.com writes: On Tuesday, February 11, 2014 10:19:53 PM UTC+5:30, Walter Hughey wrote: I suppose what you mean by top posting is replying to an email by entering a reply at the top That's right. Top-posting is wasteful of the reader's time while it also omits a lot of contextual information. See http://en.wikipedia.org/wiki/Posting_style Most people here prefer interleaved posting with significant trimming. It's worth pointing out that you will likely find the “interleaved posting with trimmed quotations” to be *acceptable* virtually everywhere on the internet. So it's a good practice to adopt for all such forums. In other contexts eg corporates, often the culture is the opposite: top-posting with strictly NO trimming. I've never found a corporation that objects to the sensible conversation-style, minimal-quotes-for-context interleaved posting style. And one more suggestion: Use text mode for your posts not html Yes, especially for technical forums where you'll need to frequently show *exactly* what text you mean, without unexpected rendering differences. -- \ “Generally speaking, the errors in religion are dangerous; | `\those in philosophy only ridiculous.” —David Hume, _A Treatise | _o__) of Human Nature_, 1739 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple % question
On Feb 11, 2014, at 6:36 PM, Chris Angelico ros...@gmail.com wrote: The real question is: What do you expect that symbol to mean? Its actual meaning is quite simple. In long division, dividing one number by another looks like this: Yeah I understand what the % means. It just confused me that 1%10 was 1. In my thought process it just didn’t work. 1/10= .1 and I just didn’t see where the remainder of 1 came in. -- https://mail.python.org/mailman/listinfo/python-list
singleton ... again
playing a bit with subject. pros and cons of this approach? did i create bicycle again? :-) class myclass(object): class_instance = None def __new__(cls, *args, **kwargs): if myclass.class_instance == None: return object.__new__(cls) return myclass.class_instance def __init__(self, some): if self.__class__.class_instance == None: # init blocker self.__class__.class_instance = self self.member = some def __del__(self): self.__class__.class_instance = None one_class = myclass(1) print(id(one_class), one_class.member ) two_class = myclass(2) print(id(two_class), two_class.member) -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Can I make it that if C = int(sys.argv[3]) But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 -- https://mail.python.org/mailman/listinfo/python-list