[issue44920] Support UUIDv6, UUIDv7, and UUIDv8 from the new version of RFC4122
New submission from Steve Simmons : Three new types of UUIDs have been proposed in the latest draft of the next version of RFC4122. Full text of that draft is in [1] (published 21 April 2021; draft period ends 21 Oct 2021). Support for these should be included in uuid.py for Python 3.11, with backport for 3.9 and 3.10. The timetable for Python 3.11 should fit with the end of the IETF draft period. Implementation should be similar to the existing UUID classes in uuid.py, the prototypes in [2], or even parts of my own uuid6 version [3]. [1] https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format [2] https://github.com/uuid6/prototypes/tree/main/python [3] https://github.com/stevesimmons/pyuuid6/blob/main/uuid6.py -- components: Library (Lib) messages: 399624 nosy: stevesimmons priority: normal severity: normal status: open title: Support UUIDv6, UUIDv7, and UUIDv8 from the new version of RFC4122 type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue44920> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Users banned
On 16/07/2018 03:13, Devin Jeanpierre wrote: On Sun, Jul 15, 2018 at 5:09 PM Jim Lee wrote: That is, of course, the decision of the moderators - but I happen to agree with both Christian and Ethan. Banning for the simple reason of a dissenting opinion is censorship, pure and simple. While Bart may have been prolific in his arguments, he never spoke in a toxic or condescending manner, or broke any of the rules of conduct. I cannot say the same for several who engaged with him. +1000 It seems to me like the python-list moderators are rewarding people for being bullies, by banning the people they were bullying. The behavior on the list the past few days has been unforgivably toxic, and that has nothing to do with the behavior of Bart et al. -- Devin +1 Seems to me Bart is being banned for "being a dick" and "talking rubbish" (my words/interpretation) with irritating persistence. Wonder how many of the non-banned members have been guilty of the same thing in one way or another. Steve Simmons -- https://mail.python.org/mailman/listinfo/python-list
Re: JSON confusion
On 17/08/2016 17:49, Jon Ribbens wrote: On 2016-08-17, Steve Simmons <square.st...@gmail.com> wrote: I'm trying to write a small utility to find the closest railway station to a given (UK) postcode but the result is in JSON and I'm not familiar with it. I've got as far as extracting the JSON object and I can print the first level elements ("success" and "result") but I've totally confused myself about how to delve into the rest of the data structure. Can anyone point me to a 'how-to' for tackling a fairly complex SJON object or give me some pointers. ... or maybe point out if I'm taking an unnecessarily complex approach. Initially, I'm Looking to extract 'stationname', 'distance' and one or two of the coordinate pairs. To be honest, I'd rather have some hints rather than the whole solution otherwise I'll not learn anything :-) SteveS It's not clear what the problem is. Yes, that was the problem! I wasn't sure if I was being stupid (yes!) about the Python or the JSON. Turns out, it was a bit of both ;-) Does this help: print(p_json["result"][0]["stationname"]) print(p_json["result"][0]["latlong"]["coordinates"]) ? Yes, immensely. (To extract an item from a JSON object you index it with a string, e.g. ["foo"]; to extract an item from an array you use an integer, e.g. [0].) Thanks very much, hopefully that'll set me on my way. SteveS -- https://mail.python.org/mailman/listinfo/python-list
JSON confusion
I'm trying to write a small utility to find the closest railway station to a given (UK) postcode but the result is in JSON and I'm not familiar with it. I've got as far as extracting the JSON object and I can print the first level elements ("success" and "result") but I've totally confused myself about how to delve into the rest of the data structure. Can anyone point me to a 'how-to' for tackling a fairly complex SJON object or give me some pointers. ... or maybe point out if I'm taking an unnecessarily complex approach. Initially, I'm Looking to extract 'stationname', 'distance' and one or two of the coordinate pairs. To be honest, I'd rather have some hints rather than the whole solution otherwise I'll not learn anything :-) SteveS def main(): import urllib import urllib.request import urllib.parse import urllib.response import json url ='https://data.gov.uk/data/api/service/transport/naptan_railway_stations/postcode?postcode=CT16+1ez=2' req = urllib.request.urlopen(url) req_json = req.read() str_json = req_json.decode("utf-8") p_json = json.loads(str_json) print(p_json) print ('==') print(repr(p_json)) print('SUCCESS: ',repr(p_json['success'])) print ('==') print('RESULT : ',repr(p_json['result'])) if __name__ =="__main__": main() -- https://mail.python.org/mailman/listinfo/python-list
Re: Slightly OT - using PyUIC from Eclipse
On 01/05/2014 02:50, Steven D'Aprano wrote: On Thu, 01 May 2014 01:49:25 +0100, Steve Simmons wrote: html head meta content=text/html; charset=UTF-8 http-equiv=Content-Type /head body bgcolor=#FF text=#00 br div class=moz-cite-prefixOn 30/04/2014 23:49, Fabio Zadrozny wrote:br /div blockquote cite=mid:CANXBEFrqndqCeT-9Hgqz7jRCZcmp8nz4VE+ebf-BKsYr54qQqQ @mail.gmail.com type=cite And that's about where I stopped reading. I'm sorry Steve, but you're writing to a programmer's forum here, and you should be sending in plain text, not so-called rich text (actually HTML code, as you can see). At the very least, if you absolutely must send HTML code, you should instruct your mail program to also send plain text. People are reading this via Usenet and email and possibly using other ways as well. Depending on how they are receiving your post, sending HTML may be considered rude and a breach of etiquette (e.g. text-based news groups typically ban binary attachments, including HTML), or their client may not support HTML, or they may simply choose not to receive or read such posts. (Pure HTML is one of the most reliable signs of spam email.) So I'm afraid that I have no idea what you were trying to say in your post. Manually deciphering the message from the markup was too painful. I'm not likely to be the only one. If you would care to try again using plain text, you may get a better response rate. Mea Culpa. Ironic really, the post was to thank Fabio for resolving my problem (posted correctly in plain text) and saying that I was too tired to make the required fix. Obviously too tired to hit 'plain text' instead of 'RTF' in my mail format drop-down too. Anyways, a plain text Thank you to Fabio for fixing my issue; a Thank you to Mark Harris for putting my encoded text through the transmogrifier and an apology to the rest of the list members. Steve -- https://mail.python.org/mailman/listinfo/python-list
Slightly OT - using PyUIC from Eclipse
I'm trying to set up a new dev environment using Windows 7; Eclipse (Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an issue getting PyUIC to generate a python Qt class from within Eclipse. I'm using the following setup process (from Google Groups) modified to match my PyQt5 configuration: 1. Click Run - External Tools - External Tools Configurations ... 2. In the resulting dialog, click 'New' icon in the top left 3. Under 'Name' put 'PyUIC' 4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or the path to your Python executable (probably C:\Python25\Python.exe) 5. Under 'Arguments' enter 'C:\Program Files\Python\2.5\Lib\site- packages\PyQt4\uic\pyuic.py ${resource_loc}' substituting the path to your PyQt4 installation - be sure also to include the double quotes 6. Change to the 'Common' tab and check 'File' under 'Standard Input/ Output' and enter '${resource_loc}.py' 7. Change to the 'Build' tab and uncheck 'Build before launch' 8. Change to the 'Refresh' tab and check 'Refresh resources upon completion' 9. Click 'Apply' then 'Run' and I'm getting the following traceback: Traceback (most recent call last): File D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py, line 28, in module from .driver import Driver SystemError: Parent module '' not loaded, cannot perform relative import I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving me an error message, so I guess I've either mis-transcribed or there's a difference in the directory structure betwee PyQt4 PyQt5. I'm more interested to learn how to read the traceback (insightfully) and track it to the source of the problem, although it would be good to have it working too!! Steve Simmons PS Also posted to PyQT list. -- https://mail.python.org/mailman/listinfo/python-list
Re: Slightly OT - using PyUIC from Eclipse
On 30/04/2014 23:49, Fabio Zadrozny wrote: On Wed, Apr 30, 2014 at 8:39 AM, Steve Simmons square.st...@gmail.com wrote: I'm trying to set up a new dev environment using Windows 7; Eclipse (Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an issue getting PyUIC to generate a python Qt class from within Eclipse. I'm using the following setup process (from Google Groups) modified to match my PyQt5 configuration: 1. Click Run - External Tools - External Tools Configurations ... 2. In the resulting dialog, click 'New' icon in the top left 3. Under 'Name' put 'PyUIC' 4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or the path to your Python executable (probably C:\Python25\Python.exe) 5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site- packages\PyQt4\uic\pyuic.py" "${resource_loc}"' substituting the path to your PyQt4 installation - be sure also to include the double quotes 6. Change to the 'Common' tab and check 'File' under 'Standard Input/ Output' and enter '${resource_loc}.py' 7. Change to the 'Build' tab and uncheck 'Build before launch' 8. Change to the 'Refresh' tab and check 'Refresh resources upon completion' 9. Click 'Apply' then 'Run' and I'm getting the following traceback: Traceback (most recent call last): File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py", line 28, in module from .driver import Driver SystemError: Parent module '' not loaded, cannot perform relative import I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving me an error message, so I guess I've either mis-transcribed or there's a difference in the directory structure betwee PyQt4 PyQt5. I'm more interested to learn how to read the traceback (insightfully) and track it to the source of the problem, although it would be good to have it working too!! Steve Simmons PS Also posted to PyQT list. -- https://mail.python.org/mailman/listinfo/python-list The problem is that a main module cannot perform relative imports on Python. To overcome that limitation, Python created a workaround to execute a module with: python -m 'module.name' So, If you execute Python as: python -m PyQt5.uic.pyuic (instead of "python C:\Program Files\Python\2.5\Lib\site-packages\PyQt5\uic\pyuic.py") it should work. If you want, you can read an answer on http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-time for more details on why it doesn't work and the other way does... Cheers, Fabio Thanks Fabio, just what I needed. I've started to read the SO posts and relevant PEP but my brain is fried (it is 01:45 here) so I'll have a better read in the morning and 'play' with some modules so that I properly understand what's going on. Regards Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On 11/12/2013 11:45, Chris Angelico wrote: And then, shortly after the beginning of the story, you need to introduce the villain. Thanks, jmf, for taking that position in our role-play storytelling scenario! A round of applause for jmf, folks, for doing a brilliant impression of the uninformed-yet-fanatical Knight Templar villain! ChrisA Oi! You!! I'll have you know I'm a bona fide Knight of the Temple and we're not (all) villains! If I catch you calling us villains again, I'll slide up behind you in the mud and dig you with my ceremonial sword! ;-) SteveS -- https://mail.python.org/mailman/listinfo/python-list
Re: Trouble with Multi-threading
On 11/12/2013 11:37, Steven D'Aprano wrote: When did this forum become so intolerant of even the tiniest, most minor breaches of old-school tech etiquette? [... Giant Snip...] Well said Steven. I've only been member of this list for (maybe) a year, mainly lurking to learn about Python and I also feel that the balance between quality answers and sniping/arguing has definitely tilted in the wrong direction. I'd very much like to see the original mood restored. SteveS -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On 11/12/2013 13:02, Chris Angelico wrote: On Wed, Dec 11, 2013 at 10:33 PM, Steve Simmons square.st...@gmail.com wrote: On 11/12/2013 11:45, Chris Angelico wrote: And then, shortly after the beginning of the story, you need to introduce the villain. Thanks, jmf, for taking that position in our role-play storytelling scenario! A round of applause for jmf, folks, for doing a brilliant impression of the uninformed-yet-fanatical Knight Templar villain! ChrisA Oi! You!! I'll have you know I'm a bona fide Knight of the Temple and we're not (all) villains! If I catch you calling us villains again, I'll slide up behind you in the mud and dig you with my ceremonial sword! ;-) Mister Simmons, Mister Simmons! We are not for one moment doubting your sincerity. It's just your intelligence that's in question. [1] [1] http://www.thegoonshow.net/scripts_show.asp?title=s06e19_the_jet_propelled_guided_naafi ChrisA Attempting to atone for pointing people to TVTropes... or maybe to be hung for a sheep rather than a lamb OK, We'll call it a draw. [2 - or is that 1?] SteveS [2 - or is that 3? Three shall be the number...] http://montypython.50webs.com/scripts/Holy_Grail/Scene4.htm -- https://mail.python.org/mailman/listinfo/python-list
Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !
By the same logic the plural of spouse is spice and most men that have had more than one wife will tell you that, whilst it may be the expectation, it ain't necessarily so ;-) On 23/11/2013 16:44, Dennis Lee Bieber wrote: On Fri, 22 Nov 2013 23:42:44 -0700, Ian Kelly ian.g.ke...@gmail.com declaimed the following: On Fri, Nov 22, 2013 at 8:47 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Rice is the plural of rouse Not according to the dictionary. But it does seem a more likely candidate for a hypothetical back formation than "ri", which perhaps was your point. Mice/Mouse Rice/*Rouse -- https://mail.python.org/mailman/listinfo/python-list
Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !
On 23/11/2013 17:35, Chris Angelico wrote: On Sun, Nov 24, 2013 at 3:35 AM, Tim Chase python.l...@tim.thechases.com wrote: Mice/Mouse Rice/*Rouse Wordplay is one of my worst vouse. ;-) Yeah, some people can come up with bad puns in a trouse. ChrisA Well! That wasn't very nouse! -- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
On 13/11/2013 19:27, superchromix wrote: hi all, I've been thinking about learning Python for scientific programming.. but all of these flame war type posts make the user community look pretty lame. How did all of these nice packages get written when most of the user interaction is this?? Can anyone tell me, is there another newsgroup where the discussion is more on python programming? thanks Sadly, I'm inclined to agree with you but this is a relatively recent development. I joined this group about a year ago and, while it wasn't all 'sweetness and light', it was a lot better than '. . . . this' - in fact I'd say it was pretty good, I certainly got treated well and got quality answers to my (few) questions. Right now, we have a 'help vampire' who has demanded an inordinate amount of time from the list members - and not in a polite or well structured way. The members of this list have responded in various ways, ranging from continuing to help through to kill-file on the offending person. The discourse around how to deal with this issue has degenerated into some unfortunate and vitriolic debate. As far as I can see, it remains possible to post sensible, well constructed questions and get sensible well-considered answers - just let the intense arguments pass you by and focus on your own issues and their resolutions and you'll be fine on this list. There are plenty of very capable Pythonistas ready to help. Some basic advice (not wanting to teach you to suck eggs): - Include relevant info on your environment (OS; version of Python; any specialist libraries in use; etc) - Come to the list with a clear description of what you are trying to do - Preferably include a code sample that displays the problem - Include the trace-back if you are getting one - Try to avoid using Google Groups as your 'reader' Welcome! Ignore the BS and Enjoy :-) Steve S -- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
Ferrous Cranus nikos.gr...@gmail.com wrote: Τη Πέμπτη, 7 Νοεμβρίου 2013 12:11:20 π.μ. UTC+2, ο χρήστης Mark Lawrence έγραψε: On 06/11/2013 21:26, Νίκος Γκρ33κ wrote: Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε: Okey let the hacker try again to mess with my database!!! He is done it twice, lets see if he will make it again! I'am waiting! No luck yet mighty one? :) So you're proud of the fact that you've only been hacked twice (that you know of)? You think you've prevented this happening again. Pride comes before a fall! Unfortunately for you I suspect that you've so irritated someone here by your behaviour that your latest comment is like waving a red flag at a bull. I sincerely hope that this time she destroys your site, as it seems likely that this is the only way in which you will learn. Cruel to be kind. So she is a SHE! How do you know that the person hacked into my DB is a female? As for the state of my databases: 1. Hacker wasnt able to mess with my first database so to add bogus webpages into it as it can be seen from here: http://superhost.gr/?show=stats 2. Unfortunately though he did manage to add arbitrary information to my other database that i store my clients, the tasks i made for them and the payment. Well done i have to say! but i think i know how she(if indeed a female) did it. I think i can prevent this for happening again as i did with (1) -- https://mail.python.org/mailman/listinfo/python-list Really? REALLY? ??? Please tell me you aren't storing details of customers and payments on your Web server. I thought we had heard the worst of you but you just keep it coming. SteveS Sent from a Galaxy far far away-- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Nov 7, 2013 at 2:20 PM, Denis McMahon denismfmcma...@gmail.com wrote: I think the hacker is a figment of Nick's imagination, or rather a consequence of his broken python code corrupting his data. Unless the Python installation on Nikos' system has become self-aware and is actively objecting to his code, I think that messages like Read a manual and Learn to code inserted into a database (as seen in the images that Nikos linked earlier) would normally suggest a hacker. -- https://mail.python.org/mailman/listinfo/python-list I must say that I kinda like the idea of Nick's computer gagging on his code and sending him messages pleading that he educated himself. Steve S Sent from a Galaxy far far away-- https://mail.python.org/mailman/listinfo/python-list
Re: To whoever hacked into my Database
On 06/11/2013 16:40, Alister wrote: On Wed, 06 Nov 2013 17:25:04 +0200, Νίκος Γκρ33κ wrote: Okey let the hacker try again to mess with my database!!! He is done it twice, lets see if he will make it again! I'am waiting! (sorry every one I tried not to reply to Nicos but finally lost it) :-) Sometimes it just has to be done. Oh, and BTW you missed out don't expose too much of your production code to a group of techs that you have irritated, insulted and abused. SteveS -- https://mail.python.org/mailman/listinfo/python-list
Re: Cookie aint retrieving when visiting happens from a backlink.
On 25/10/2013 16:34, Chris Angelico wrote: Do you understand: 1) what cookies are? 2) how the browser receives them? 3) how the server gets them back? 4) when #3 happens and when it does not? If not, go to Wikipedia and start reading. If you get to the end of Wikipedia without comprehending this, go back to the beginning and start over. ChrisA Chris, You truly are a saint! I simply cannot believe the level of restraint you have shown during this exchange (unless of course you have bought tickets to Greece in order to deal with this issue in person and 'with extreme prejudice'). As for the OP - Nick, I think your utterly ignorant rudeness to Chris will have alienated the entire membership of this list and you should seriously consider a carefully worded apology. This list does not exist to teach you how to run a website or to write software for it. This list does not exist to explain every single aspect of network and web technology to someone who openly admits that they prefer to get answers from list members without doing any personal research. This list exists to provide mutual to support members in their personal usage of and research into Python. Most importantly, any contribution comes free of charge and you should recognise this gift and remember to use 'please and thank you' instead of 'don't be lazy'. If you want to be respected by this group, you need to substantially change your attitude and start to do some research of your own before posting questions on this or any other list. Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Code golf challenge: XKCD 936 passwords
Chris Angelico ros...@gmail.com wrote: On Tue, Oct 8, 2013 at 5:48 PM, sprucebond...@gmail.com wrote: And if we were actually trying then that filename should just be /w. Would get rid of another 19 chars. I'm working this on the assumption that the dictionary file already exists (that's where it is on my Debian Linux systems, for instance) and shouldn't be moved :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list Typical MUD Master - making up rules as you go along :-) Sent from a Galaxy far far away-- https://mail.python.org/mailman/listinfo/python-list
Re: Stack Overflow moderator “animuson”
Steven D'Aprano st...@pearwood.info wrote: On Wed, 10 Jul 2013 07:55:05 +, Mats Peterson wrote: A moderator who calls himself “animuson” on Stack Overflow doesn’t want to face the truth. He has deleted all my postings regarding Python regular expression matching being extremely slow compared to Perl. That's by design. We don't want to make the same mistake as Perl, where every problem is solved by a regular expression: http://neilk.net/blog/2000/06/01/abigails-regex-to-test-for-prime-numbers/ so we deliberately make regexes as slow as possible so that programmers will look for a better way to solve their problem. If you check the source code for the re engine, you'll find that for certain regexes, it busy-waits for anything up to 30 seconds at a time, deliberately wasting cycles. The same with Unicode. We hate French people, you see, and so in an effort to drive everyone back to ASCII-only text, Python 3.3 introduces some memory optimizations that ensures that Unicode strings work correctly and are up to four times smaller than they used to be. You should get together with jmfauth, who has discovered our dastardly plot and keeps posting benchmarks showing how on carefully contrived micro- benchmarks using a beta version of Python 3.3, non-ASCII string operations can be marginally slower than in 3.2. Additionally my account has been suspended for 7 days. Such a dickwad. I cannot imagine why he would have done that. -- Steven -- http://mail.python.org/mailman/listinfo/python-list :-) Thank you. Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Important features for editors
Νίκος ni...@superhost.gr wrote: Στις 4/7/2013 11:34 πμ, ο/η Dave Angel έγραψε: On 07/04/2013 03:59 AM, Νίκος wrote: Στις 4/7/2013 10:32 πμ, ο/η cutems93 έγραψε: I am researching on editors for my own reference. I found that each of them has some features that other don't, but I am not sure which features are significant/necessary for a GOOD editor. What features do you a good editor should have? Keyboard shortcuts? Extensions? Thanks! Min Download Sublime Text v3 Is a great editor When possible, it's polite to supply a link to the page where it's described or can be downloaded. In this case, http://www.sublimetext.com/ It looks pretty good on the web page. The main negatives I can see are: It costs $70 per user It can only be purchased with Paypal, which I won't use. It's available for OS/X, Linux and Windows, with a single purchase The eval/demo is not time-limited (currently) The positives It can be customized, apparently in Python The simple customizations are specified by JSON files Current download is version 2, but there's a version 3 beta, and if you buy now, you won't have an upgrade fee. .. Note that the OP didn't ask which is a good editor, but which features make a good editor. I'll post a response to that in a little while. If you guys want to use it i can send you a patch for it. I know its illegal thing to say but it will help you use it without buying it. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list Boy oh boy! You really are a slow learner Nicos. You have just offered to commit a crime and to include dozens of others in that crime ON A PUBLIC FORUM. Please think before you post. Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Important features for editors
rusi rustompm...@gmail.com wrote: On Thursday, July 4, 2013 7:03:19 PM UTC+5:30, Steve Simmons wrote: Boy oh boy! You really are a slow learner Nicos. You have just offered to commit a crime and to include dozens of others in that crime ON A PUBLIC FORUM. Please think before you post. For the record Steve, let me say, I find Robert Kern's objection barely sufficient. And yours less than that. Note that you are not objecting to the crime but to the public expression of it. Just look at your objection from the angle of a police officer, and you will see that it can certainly be construed as abetment/collusion (or whatever is the legalistic jargon. Obviously IANAL) For the sake of covering my own arse let me say: 1. I have earlier described Nikos as a petty-criminal and consider myself justified. 2. I have earlier described condoning him as collusion and I reiterate that claim. And I add 3. The collective actions of this list will help determine further whether he climbs or descends the criminal ladder. Beyond that I reiterate what I said earlier in this thread: These discussions 'in-band' are counter-productive. Setting up something like an invite-only yahoo or google group or some such to discuss this is free and takes 5 minutes. I would have offered to do it but some people like Joshua Landau seem to think I am interested in world (aka Python-list) domination so not offering. I was actually going to suggest that Steven d'Aprano do it. However before I could do that, he said (in CoC thread) that policing is not possible. Saddens me... So I am suggesting you do it. If I am invited I will contribute my 2c. If not, no objection: I dont consider myself a very important member of this list. And yes: I hope you will consider rewording your objection, if not anything to cover your own you-know-what-where!! -- http://mail.python.org/mailman/listinfo/python-list Rusi, Frankly, I don't give a tinkers cuss whether Nicos gets a visit from the police, FAST or the Greek secret service. Like too many others, I gave him some advice and within 24 hours he has demonstrated that he didn't see any value in that advice. Fair enough, it's not my problem. For my part, I have pointed out the folly of his ways and now reiterated, maybe too politely, that he has let himself down again. Robert Kern had already given him a blunt response that such communication is unwelcome and I felt no need to reinforce it. If the police or any other authority are 'on my trail' they are welcome to visit my house where they will find absolutely no trace of any kind of crime (unless they check how badly I've ignored the need to redecorate). And just for the record, the lack of evidence of crime will not be because I covered it up really well but because there ain't none guv. I absolutely agree that the ongoing debate about Nicos' behaviour and the finer points of how various members of this list have reacted has become more than a little tiresome and it is high time it moved to another medium. However, with no guidelines in place and no sanctions available, any discussion - on or off list - had precious little value. I still think the CoC idea has some merit but with just a few notable exceptions the response has been pretty lukewarm. Likewise, I don't contribute much to this list - as a newcomer to python I don't have to much to offer - but I mostly enjoy being a small part of it and I would be happy to make a contribution to the CoC if I felt that the end result would be both useful and welcomed. Steve Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Important features for editors
To Rurpy and cutems93, My apologies too. I reacted before I thought about creating a new thread. To your question: One thing that I don't use daily but find very useful to have in an editor is 'Hex View' (or better yet a 'Hex Editor'). Whilst it has been 'dissed' recently on this list, I like Notepad++ for everyday editing but if I'm head-down in a particular language, I prefer to be in an IDE. Steve On Thu, Jul 4, 2013 at 4:56 PM, ru...@yahoo.com wrote: On 07/04/2013 08:24 AM, MRAB wrote: On 04/07/2013 14:22, Tim Chase wrote: On 2013-07-04 05:02, Dave Angel wrote: [snip an excellent list of things to look for in an editor] It's 2013, yet Unicode support is merely a nice-to-have? I agree that this is pretty important. Even if you don't have to deal with Unicode today, the chances are good that you will need to, if only in an occasional way, in the future. One thing not mentioned (sorry if I missed it) that I use more than many of the features that have been mentioned is some form of advanced search/replace. I.e. something that can do regular expression searches and replaces including multiline ones. Another feature I find necessary is very fast start up time since I open an editor hundreds of times a day. Because advanced features and fast startup seem to be mutually exclusive, I often use two editors, a simple but quick starting one like Gedit on Linux or Notepad on Windows for 90% of routine editing and Emacs for the the other 10% when I need to do something more powerful. But as a disclaimer I should add that I do not spend 8+ hours a day doing nothing but programming so YMMV. BTW, the group is currently having a problem both with trolls and with regulars here that bite at every baited hook that drifts past their screen. There seems to nothing to be done other than ignore the obnoxious posts but I am sorry they have infiltrated your discussion. Hopefully this comment won't add to the problem. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Python list code of conduct
On 03/07/2013 12:50, rusi wrote: On Wednesday, July 3, 2013 6:09:35 AM UTC+5:30, Ben Finney wrote: Dennis Lee Bieber writes: So who would enforce any rules? Ideally, this community is healthy enough for us to enforce the code of conduct of our host, through social convention among us all. Thanks Ben for that. Lets not stymie Steve Simmons original suggestion for a CoC by making it into a formal CoC and then saying its impossible. There is a good deal of informal enforcement already. Consider eg: - Mark's footnote reminding about GG problems and their solutions link - Steven's brusque 'cut-the-crap' type responses - Your own prompt STOPs to racist/sexist etc posts etc So we may take and welcome Steve Simmons' call to expand that list. I certainly welcome the suggestion. Thanks Rusi - and everyone else that provided feedback. I understand (and had already anticipated) that this type of group can't and probably shouldn't be moderated in the more draconian sense of the word but there's no reason why we couldn't create some behavioural and technical guidelines. I had it in mind to move to a few (?!) paragraphs that read well when considered as a single document but that were also suitable to cut'n'paste into a response - much as Mark puts his GG warning in every mail. The aim would be to put a considered response in a first reply that tells the OP 'this is what you need to do to get a sensible answer'. We have this for GG code fragments and I see no reason why we can't have it for bad language; bad attitude; unreasonable expectations; thread high-jacking; top posting; and all the other sins we expect Noobs (and some long standing members!) to avoid. I guess I should have said this up front but let me say it now: I completely 'get' that this won't fix the Trolls or the dyed-in-the-wool pedants or recidivist high-jackers but it may put some buffering between: Newb: I want you to do my homework and I have to give it in tomorrow morning and Pythonista: you're a dick If there's enough support for the general idea, I'm happy to make a decent sized contribution but if there isn't - Nuff said. Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 03/07/2013 15:12, feedthetr...@gmx.de wrote: Am Mittwoch, 3. Juli 2013 12:00:14 UTC+2 schrieb Νίκος: Στις 3/7/2013 12:45 μμ, ο/η Chris Angelico έγραψε: ] You have betrayed the trust of all your customers. ... I just received a call form on of my customers asking me to explain your mail ... Of course i should have give you the root pass(it was indeed stupid), but you violated my trust. You should have been clear that you didnt want to help and not asking me via private mail for the root pass. May i cite: Am Dienstag, 4. Juni 2013 19:12:41 UTC+2 schrieb Νικόλαος Κούρας: Τη Τρίτη, 4 Ιουνίου 2013 8:09:18 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Wed, Jun 5, 2013 at 3:02 AM, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: I'm willing to let someone with full root access to my webhost to see thigns from the inside. ... You need to read up on what happens when you enter Dummy Mode and give someone full root access to your web host. You really REALLY need to understand what that means before you offer random strangers that kind of access to someone else's data. * * I've half a mind to take you up on your offer, then go look for personal and private info from your clients, and email it to them (along with a link to this thread) to point out what's going on. * * ChrisA I know what full root access mean. I also trust you. ... Am Mittwoch, 5. Juni 2013 00:12:26 UTC+2 schrieb Chris Angelico: The call is strong... I could rule the galaxy alongside my father... I've searched my feelings, and I know this to be true! * * Okay. I accept. I'll **do as I promised.** Might be interesting, and educative - for someone, at least. * * [emphasis added for those, who do not want to read the whole post] Any questions? +1000 I missed a few key posts on this thread and was wondering what happened between Chris and Nicos - thanks for the summary :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 03/07/2013 16:44, Chris Angelico wrote: On Thu, Jul 4, 2013 at 1:36 AM, Νίκος ni...@superhost.gr wrote: I will *not* give away my root pass to anyone for any reason but i will open a norla user account for someone if i feel like trusting him and copy my python file to his homr dir to take alook from within. Well... well... baby steps. That's something at least. That's still a huge level of access, though; with a non-root account on your server, I would be able to - I think - read all your customers' code. You would have to chroot the user you give, and if you're going to do that, you may as well just give the code as a .py file. Really, you need to have a MUCH stronger respect for shell access, even non-root. ChrisA Nicos A hard lesson learnt, I think. I have read most of the responses to your posts but kept my contributions to a minimum. Here's my advice to you: 1. Don't trust ANYBODY on the internet unless you have thought carefully about what you are being offered. 2. Do seriously consider following advice from this list, especially the advice to read external references and documents - obviously subject to point 1 :-) 3. Don't EVER compromise security for some real or imagined deadline - your customers will probably grumble if you are late but they will likely sue you if you compromise their data. They'll definitely sue if you compromise their money in any way. Chris taught you a valuable lesson - hard but valuable. 4. Take a few hours out and re-read your recent threads. Pick out the constructive advice you have ignored and follow up on it. It may take days or even weeks to get your head around it but IMHO there is huge value to be gained from the exercise. You have taken some big strides over the past several weeks, supported by some *very* patient experts, but it is clear you still have plenty to learn - pause, read, digest, reflect and then move forward. Take care Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Νίκος ni...@superhost.gr wrote: Στις 1/7/2013 12:31 μμ, ο/η Steve Simmons έγραψε: I don't know about the other members of this list but I am becoming increasingly disturbed by the rudeness and especially the foul language that is being perpetrated on this thread. Please, if you have any decency at all, continue the rest of this exchange by private email and allow python list members to continue discussing and helping each other with the python language and is adjuncts. Leave us in peace to enjoy our favoured language and let us see no more of your filth. Sent from a Galaxy far far away I have kept in quite more than 2 weeks while kept reading any mail in this list especially the endless conversation and numerous name callings against me. You should know that i'm fed up reading this. If i'm provoked i will respond. it is not in my intentons to troll the list or talk dirty, but also i cannot withstand anymore people talk down to me like that, when the only thing i doid was to ask some questions, which in turn helped us all. Especially i cant stand people which never to spend 5 mins to reply, but they are devoted a couple of weeks to belittle me instead. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list I understand some of your frustrations, just as I understand the frustrations of those who have tried to help in spite of your sometimes poor understanding of the etiquette expected on this list. On no account do I understand or endorse your continued loutish use of bad language so I repeat my request that you move the rest of this offensive conversation onto a private channel such as email. The majority of people on this list are probably as sick of this thread as I am but choose not to challenge you. Please leave. Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Python list code of conduct
Erm, It probably isn't the best time to start this post but I was wondering... Does this list have a code of conduct or a netiqeutte (sp?) statement/requirement? If not, should it? Is the membership of this list presently in the right frame of mind to create one or update any existing one? The reason I ask is that it seems to me that if we (the current membership of the list) could agree to a set of preferred/required behaviours we would at least have a framework by which to measure unwelcome posts. And, more importantly, to guide newcomers in understanding that we are enthusiasts who choose to discuss Python and *voluntarily* help solve problems with Python for the less experienced members. [Runs for cover] Steve Simmons Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Νίκος ni...@superhost.gr wrote: Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε: So shut your piehole and start proving yourself useful in this list. Or sod off. Preferably do the latter. Oh we do have illusions of grandeur, don't we? You are in no position to judge who is useful on this list or not. I'am not waste any more time explaining my self to you since you have already made up your mind and you refuse to believe that ni was actually trying to solve my problems first and then asked and then tried to apply the solutions, which in my my 2 last problems i was the one who actually solve the problem. Its easier to say to you fuck off retard. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list I don't know about the other members of this list but I am becoming increasingly disturbed by the rudeness and especially the foul language that is being perpetrated on this thread. Please, if you have any decency at all, continue the rest of this exchange by private email and allow python list members to continue discussing and helping each other with the python language and is adjuncts. Leave us in peace to enjoy our favoured language and let us see no more of your filth. Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
Giorgos Tzampanakis giorgos.tzampana...@gmail.com wrote: On 2013-06-13, dieter wrote: ... Anyway, my real question is how to go about debugging memory leak problems in Python, particularly for a long running server process written with Twisted. I'm not sure how to use heapy or guppy, and objgraph doesn't tell me enough to locate the problem. Analysing memory leaks is really difficult: huge amounts of data is involved and usually, it is almost impossible to determine which of the mentioned objects are leaked and which are rightfully in use. In addition, long running Python processes usually have degrading memory use - due to memory fragmentation. There is nothing you can do against this. Therefore: if the leak seems to be small, it may be much more advicable to restart your process periodically (during times where a restart does not hurt much) rather than try to find (and fix) the leaks. Only when the leak is large enough that it would force you to too frequent restarts, a deeper analysis may be advicable (large leaks are easier to locate as well). Am I the only one who thinks this is terrible advice? -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ -- http://mail.python.org/mailman/listinfo/python-list No you are not alone. Ignoring a bug is only sensible if you absolutely understand what is going wrong - and by the time you understand the problem that well, you probably have enough understanding to fix it. If tools are available (as the OP knows), then learn them and use them to find/fix the bug. Steve S Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Why do Perl programmers make more money than Python programmers
Fábio Santos fabiosantos...@gmail.com wrote: - 1) The memory gain for many of us (usually non ascii users) just become irrelevant. sys.getsizeof('maçã') 41 sys.getsizeof('abcd') 29 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or ascii typographers !) import timeit timeit.timeit('abcd'*1000 + 'a') 2.186670111428325 timeit.timeit('abcd'*1000 + '€') 2.9951699820528432 timeit.timeit('abcd'*1000 + 'œ') 3.0036780444886233 timeit.timeit('abcd'*1000 + 'ẞ') 3.004992278824048 timeit.timeit('maçã'*1000 + 'œ') 3.231025618708202 timeit.timeit('maçã'*1000 + '€') 3.215894398100758 timeit.timeit('maçã'*1000 + 'œ') 3.224407974255655 timeit.timeit('maçã'*1000 + '’') 3.2206342273566406 timeit.timeit('abcd'*1000 + '’') 2.991440344906 3) Python is pround to cover the whole unicode range, unfortunately it breaks the BMP range. Small GvR exemple (ascii) from the the bug list, but with non ascii characters. # Py 3.2, all chars timeit.repeat(a = 'hundred'; 'x' in a) [0.09087790617297742, 0.07456871885972305, 0.07449940353376405] timeit.repeat(a = 'maçãé€ẞ'; 'x' in a) [0.10088136800095526, 0.07488497003487282, 0.07497594640028638] # Py 3.3 ascii and non ascii chars timeit.repeat(a = 'hundred'; 'x' in a) [0.11426985953005442, 0.10040049292649655, 0.09920834808588097] timeit.repeat(a = 'maçãé€ẞ'; 'é' in a) [0.2345595188256766, 0.21637172864154763, 0.2179096624382737] There are plenty of good reasons to use Python. There are also plenty of good reasons to not use (or now to drop) Python and to realize that if you wish to process text seriously, you are better served by using corporate products or tools using Unicode properly. jmf This is so off-topic that, after reading this, I feel I have just returned from the Moon. OTOH, it would seem like you know the Portuguese word for apple, so I also feel home. I am so confused. -- http://mail.python.org/mailman/listinfo/python-list Good to see jmf finally comparing apples with apples :-) Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Comparison Style
Chris Angelico ros...@gmail.com wrote: With the sort of thinking you're demonstrating here, you should consider a job working with Spike Milligna (the well known typing error). Errr , I think you'll find that he's joined the choir invisibule. Mind you, he did say he was ill! Sent from a Galaxy far far away -- http://mail.python.org/mailman/listinfo/python-list
Re: Comparison Style
llanitedave llanited...@veawb.coop wrote: On Thursday, April 25, 2013 11:31:04 AM UTC-7, Steve Simmons wrote: Chris Angelico ros...@gmail.com wrote: With the sort of thinking you're demonstrating here, you should consider a job working with Spike Milligna (the well known typing error). Errr , I think you'll find that he's joined the choir invisibule. Mind you, he did say he was ill! Sent from a Galaxy far far away Did you ever hear him sing? He's better off in the choir inaudible. As am I... -- http://mail.python.org/mailman/listinfo/python-list The Ying Tong song - a classic of its time. But eminently suited to the chorally challenged. Sent from a Galaxy far far away-- http://mail.python.org/mailman/listinfo/python-list
Re: Performance of int/long in Python 3
On 02/04/2013 10:43, Mark Lawrence wrote: On 02/04/2013 10:24, jmfauth wrote: On 2 avr, 10:35, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote: So what? Who cares if it takes 0.2 second to insert a character instead of 0.1 second? That's still a hundred times faster than you can type. - This not the problem. The interesting point is that they are good and less good Unicode implementations. jmf The interesting point is that the Python 3.3 unicode implementation is correct, that of most other languages is buggy. Or have I fallen victim to the vicious propaganda of the various Pythonistas who frequent this list? Mark, Thanks for asking this question. It seems to me that jmf *might* be moving towards a vindicated position. There is some interest now in duplicating, understanding and (hopefully!) extending his test results, which can only be a Good Thing - whatever the outcome and wherever the facepalm might land. However, as you rightly point out, there is only value in following this through if the functionality is (at least near) 100% correct. I am sure there are some that will disagree but in most cases, functionality is the primary requirement and poor performance can be managed initially and fixed in due time. Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance of int/long in Python 3
On 02/04/2013 15:03, Steven D'Aprano wrote: On Tue, 02 Apr 2013 11:58:11 +0100, Steve Simmons wrote: It seems to me that jmf *might* be moving towards a vindicated position. There is some interest now in duplicating, understanding and (hopefully!) extending his test results, which can only be a Good Thing - whatever the outcome and wherever the facepalm might land. Some interest now? Oh please. http://mail.python.org/pipermail/python-list/2012-September/629810.html Mark Lawrence even created a bug report to track this, also back in September. http://bugs.python.org/issue16061 I'm sure you didn't intend to be insulting, but some of us *have* taken JMF seriously, at least at first. His repeated overblown claims of how Python is destroying Unicode, his lack of acknowledgement that other people have seen string handling *speed up* not slow down, and his refusal to assist in diagnosing this performance regression except to repeatedly quote the same artificial micro-benchmarks over and over again have lost him whatever credibility he started with. This feature is a *memory optimization*, not a speed optimization, and yet as a side-effect of saving memory, it also saves time. Real-world benchmarks of actual applications demonstrate this. One or two trivial slowdowns of artificial micro-benchmarks simply are not important, even if they are genuine. I believe they are genuine, but likely operating system and hardware dependent. First off, no insult intended and I haven't been part of this list long enough to be fully immersed in the history of this so I'm sure there are events of which I am unaware. However, it seems to me that, for whatever reason, JMF has reached the end of his capacity (time, capability, patience, ...) to extend his benchmarks into a more credible test set - i.e. one that demonstrates an acceptably 'real life' profile with a marked drop in performance. As a community we have choices. We can brand him a Troll - and some of his behaviour may mandate that - or we can put some additional energy into drawing this 'disagreement' to a more amicable and constructive conclusion. My post was primarily aimed at recognising the work that people like Mark, Neil and others have done to move the problem forward and was intended to help shift the focus to a more productive approach. Again, my apologies if it was ill timed or ill-directed. Steve Simmons -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance of int/long in Python 3
On 02/04/2013 15:12, Mark Lawrence wrote: I've already raised an issue about performance and Neil Hodgson has raised a new one. Recognised in a separate post To balance this out perhaps we should have counter issues asking for the amount of memory being used to be increased to old levels and the earlier buggier behaviour of Python to be reintroduced? Swings and roundabouts? I don't think I came anywhere near suggesting that we should regress correct functionality or memory usage improvements. I just don't believe that we can't have good performance alongside it. Steve S -- http://mail.python.org/mailman/listinfo/python-list
Re: PSF News: Guido van Rossum quitting Python to develop new, more difficult to learn, language.
It's in recognition of the gap between English and French - it helps you to bridge it. Mark Lawrence breamore...@yahoo.co.uk wrote: On 01/04/2013 16:30, Pierre O'Dee wrote: Some features have already been hinted at for the new language. No Unicode -- BAUDOT is expected to be the new character encoding. --Pierre O'Dee, self-appointed spokesman for the PSF This is excellent news, no unicode means no chance of any performance regressions whilst implementing stupid things like memory savings and correctness. One question, why use a character encoding that's named after a very famous French actress? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list -- Sent from my Android phone with K-9 Mail. Please excuse my brevity.-- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
On 22/02/2013 22:37, piterrr.dolin...@gmail.com wrote: So far I am getting the impression that Python is a toy language of some kind (similar to Basic of the early 80's), not really suitable for serious work. The only difference between these languages (admittedly, a serious one) is the existence of extensive libraries. Otherwise there would be no good reason for Python to exist. Nevertheless, it does exist and I have to learn it. As long as someone is paying for my time, that's OK with me. As with any comparison between languages, some of what you say is right and some not so much. I'm working with Python because I wanted to and, although I'm in a similar place on the learning curve, I think its OK. My first exposure to Python was when my son came home with a project to map Gaussian distributions in Python. The problem wasn't well defined and the lessons on Python were either poor or not absorbed by my son. Nevertheless, we got stuck in and, within the two weeks available, made a decent stab at delivering some results. Now I'm writing (in my spare time) an application to take images of passports via a specialist camera, read the Machine Readable Zone, check data on the new RFID passports and store it in a searchable database ('serious work' in my estimation). I chose Python for the job in spite of the fact that the supplier of the camera doesn't support Python. Why Python? Because I found it approachable (similar to Basic); readable - if you write it properly (similar to Basic); because it has an excellent well supported range of libraries (unlike Basic); because it has a choice of excellent GUI tool-sets (unlike Basic), because it is supported by an absolute gold-mine of enthusiastic hackers - in the best sense of the word (unlike Basic); because it is portable (arguably unlike Basic) and because I thought it had the shallowest learning curve amongst some of the supported options (C/C++, Java, Delphi, FoxPro - yes really). I get the impression that you are a developer of some experience on a single language. I wouldn't call myself a developer but I have written, modified and/or debugged software in upwards of 20 languages and, from that perspective, I would say that the second language you learn is probably the hardest for the simple reason that you have to put away a bunch of learned prejudices and learn a whole new set. After three or four, you start to see the commonalities and differences and 'get' why they exist and you find yourself with a new set of learned prejudices :-) but you also gain the perspective that some languages are good at 'this' while others are good at 'that'. If it is any consolation, I'm still struggling with 'pass-by-object-pointer' (or whatever it is called) and finding the 'Pythonic Way' to do things but I'm still liking it. My main message to you would be : don't approach Python with a negative attitude, give it a chance and I'm sure you'll come to enjoy it. Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
On 23/02/2013 16:51, Chris Angelico wrote: Steve, why do you say you're not a developer? A score of languages under your belt, choosing to write code in your spare time, and speaking competently on the comparative merits of different languages and why you made the decision you made - sounds like you're every bit a coder. Don't run yourself down so! :)ChrisA I guess I was a developer back in 1972 when I did 15 months worth of COBOL and for a while in the late 70's when I was coding in assembler for ICL machines (24 bit words!) but since then, I've never done enough with any one language to be able to code without 'the book' open in front of me, so I'd feel a bit of a fraud if I called myself a developer. However, what I have done has taught me every computer works in the same way, from the Raspberry Pi all the way back to those 32Kb 'mainframes' of the 70's and that a compiler/linker or interpreter goes through a very similar process for any language on any architecture, although I'm sure someone will reply to this post to tell me that the Gargleflup 3000 model 6.78.009B was COMPLETELY different or to ask why I hadn't mentioned the Zurp language if I was so damn knowledgeable. ;-) I suppose that if I had to label myself, it would be 'IT Generalist' but I've been doing that for over 40 years so I suppose I'm a Specialist Generalist :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
On 23/02/2013 18:32, Gene Heskett wrote: I am here because I was hoping some knowledge leakage would help me to understand python, but at my age I am beginning to have to admit the level of abstraction is something I may never fully grok. If I ever find a python book that literally starts at square one, it _will_ come home with me though. But I have too many hobbies too, I have a BP rifle that needs a trip to the range this afternoon for some exercise. :) Cheers, Gene I'm using Rapid GUI Programming with Python Qt (Mark Summerfield ISBN 978-0-13-235418-9) - it fits for me because I needed something that covered GUI development but also had an intro to the language. The first 3 chapters are a Python intro at a sensible level for experienced coders (none of this 'here is the keyboard, there is the screen' nonsense) so it is enough to get you going with Python. The rest is about Qt/PyQt, taught via manageable examples and giving a fairly well thought out dialogue (monologue?) of what each line/function does. It was useful enough for me to want to carry the hardback version with me on my 'commute' from the UK to Nigeria where I am currently working. I've also got two books by Wesley Chun, (Core Python Programming Core Python Applications Programming) on my Kindle . I can't give you a sensible verdict on those two because, while I've finally settled to reading fiction on the Kindle, I still like to have a real book when it comes to reference works (on any subject) so they haven't had the usage that Summerfield has. Oh, and you're never too old for anything but most things take longer - gives you more time to enjoy them ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
Dear Mr D'Aprano, I thank you for your post but I must complain in the strongest possible terms that it was not enclosed in the correct delimeters. It should have been enclosed in a humour... /humour pair (or humor.../humor if you are American). I was drinking coffee at the time I started reading your post and, entirely due to your negligent lack of proper delimiters, much of my coffee is now irretrievably resident in my keyboard. My lawyers will be in touch... On 22/02/2013 11:26, Steven D'Aprano wrote: On Thu, 21 Feb 2013 14:40:37 -0800, piterrr.dolinski wrote: With Python, I am having to do this code code ## if (some condition): code code ## I prefer this: # WARNING WARNING WARNING IF STATEMENT AHEAD BEWARE BEWARE BEWARE if something(): do(stuff) # WHEW IF STATEMENT FINISHED!!! WE SURVIVED, THANK THE GODS!!! That way I can be sure that people reading it will know it is an if and not a for or while, just in case the actual code wasn't clear enough. I am nervous about using variables out of the blue, without having to declare them. I feel your pain. I'm nervous about declaring variables out of the blue, without having to declare that I'm about to declare them. I live in hope that some day I will find a language that lets me write: FORWARD VARS: int x; double y; str s; VARS: int x; float y; str s; and have the compiler catch my error in declaring y as a float instead of a double. Then I will be one step closer to my dream of not having to understand the code I write. For example, when I write i = 0 it is perfectly OK to Python without 'i' being declared earlier. How do I know that I haven't used this variable earlier and I am unintentionally overwriting the value? I find I constantly have to use the search facility in the editor, which is not fun. Some people suggest that functions should be small enough to read over in a glance, or at least a couple of glances. They even say that variable names should be meaningful, so you can tell whether a variable has been used from context. I say, fi to that! Programming should be a challenge! It should be exciting! Which is why I never use functions, and always use the same single-letter variable with a cryptographic hash to distinguish them. i048b8497cf86dab9dade2ce6beddf13a = [] i048b6497cd85d9b9da2a3ce6bdedf167 = 42 *wink* I'm not going to apologise for taking the piss, although I do hope you will take it in the spirit it is intended: constructive criticism rather than abuse. The reality is, these problems you are running into are not problems in practice, and the solutions you are used to, like braces, are visually noisy and not terribly effective. You would probably think differently of { } if they were spelled BEGIN and END like in Pascal. Braces have one, and only one, advantage: if you pass code through a noisy environment that deletes whitespace at will, you can recover the structure of the code from the braces. Python does not have that advantage, and sometimes it is a pain, e.g. when people email code using a broken mail client that deletes spaces. But then, if you passed C code through something that deleted the braces, you'd be royally screwed too. The solution to that is to stop having tools that think that whitespace isn't significant. Of course it is significant, it is significant to the human reader, who is about a hundred billion trillion times more important than the compiler. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
On 22/02/2013 15:26, Duncan Booth wrote: Rui Maciel rui.mac...@gmail.com wrote: Chris Angelico wrote: On Fri, Feb 22, 2013 at 10:58 PM, Rui Maciel rui.mac...@gmail.com wrote: Mitya Sirenef wrote: Looks very unclear and confusing to me. Whether it's C# or ruby or anything else, most devs don't indent like that; The Go programming language makes that style mandatory. [citation needed] What do you mean by that style? The OP's style with the 'if' indented? I just checked out golang.org for examples, and they're written in OTBS. Read Mitya Sirenef's post, specifically the bit I've replied to. Do you believe that post was talking about the indentation of the keyword 'if' relative to the statements in the same block, or did you think it was talking about the placement of the opening brace on the same line as the `if` statement? I believe that Mitya was talking about the former but that you assumed the latter. Oooh, this is making my head spin. Are you saying that the OP's question about proper indentation has resulted in an incorrectly answered post due to poor indentation of a reference to the indentation of another reference? Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a graphical GUI builder?
On 21/02/2013 11:08, Chris Angelico wrote: On Thu, Feb 21, 2013 at 8:20 PM, PythonAB pyt...@rgbaz.eu wrote: On 21 feb 2013, at 04:45, Michael Torrie wrote: On 02/20/2013 12:44 AM, Steve Simmons wrote: 2. Qt isn't 'free' (depending on what you are going to be doing with it) - read the licensing rules. How so? It's LGPL. You can't get much freer than that. Both in terms of code and developer freedom, and proprietary freedom. well that can be discussed... (BSD, MIT, Apache, CDDL) You can argue about which is the best license to use (I don't personally like the GPL and LGPL, and don't use them on my creations), but Steve's description that its free status depends on what you're doing with it implies a fairly major violation of the principles of software freedom, which I would expect *all* the popular open-source licenses to be correct on. ChrisA I downloaded my copy when Qt was in Nokia's hands at which time there was a paid for license for commercial development and a 'free' community license. I thought that situation remained but if things have changed since the change of ownership (guardianship?), then I apologise for being out of date - as so many parts of me are :-) Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python venerable?
On 20/02/2013 12:03, Albert Hopkins wrote: On Tue, Feb 19, 2013, at 11:10 PM, Gene Heskett wrote: [...] And even us old (78) farts are calling things Kewl now. 78??? Is that the year you were born or the years since you were born? -a Yeah, 2078 - Marty McFly, Back From the Future. Kewl !! ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a graphical GUI builder?
On 19/02/2013 23:19, Rex Macey wrote: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to build GUIs. I see that there is TKinter, which is a scripting function to build GUIs. To be clear, I'm looking for a graphical interface to build GUIs. Thanks. Take a look at Qt (and PyQt) - this includes QtDesigner, a nice GUI design/generation tool. Three caveats: 1. Read and Re-read the response from Chris Angelico - IME he knows what he is talking about and I'm just in the process of learning first hand what he is telling you (I'm writing an application in Python with PyQt). 2. Qt isn't 'free' (depending on what you are going to be doing with it) - read the licensing rules. 3. QtDesigner isn't Visual Studio and creating a GUI in Qt/PyQt tends to be a process of GUI design, GUI code generation and integration with your 'business logic.' There's no round-trip-engineering, so if you mess with your GUI code after generating it, it isn't easy to get it back into QtDesigner. Steve Simmons -- http://mail.python.org/mailman/listinfo/python-list
Best approach to OO Style (only slightly off topic)?
I'm relatively new to OO (and Python and QT ) and I am learning as I go along. As I slowly come up to speed, I have some questions about the best approach to program/module structure so I'm looking for some pointers (URL's or replies). I have copied some code from 'Rapid GUI Programming with Python and Qt' (Great book!) and am now modifying/extending it with my own. The original code (Image Changer - Chp 6) is a single class that contains code for both UI creation/management and functional code. I have created a second class for my own code and I'm on the brink of adding calls from one class to the other and vice-versa. At this point, I began to wonder what a 'correctly structured' OO program should look like. Should I separate GUI logic from 'business' logic? Should everything be in one class? Should my main() be carrying the high level logic? Anyinput most welcome. I looked briefly at the MVC model which answers my question at a high level but itrepresents another learning curve that I'm reluctant to add to my current challenge. Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: handling return codes from CTYPES
Duncan, Mike, MRAB, Thank you. New technology set, same forgotten lesson - RTFM (all of it!). Thanks also for the clarification on discarding objects and Garbage Collection. Looks like I'll have to turn a large chunk of my previous understanding of (mainframe) languages 'inside out'. I'm just wondering how often I'll have to chant it isn't a variable, it's a name bound to an object before I can write a chunk of code without spending ages pondering why it isn't working. I already like Python for its clean design but I think it'll be a while before I love it completely. Steve On 21/01/2013 11:11, Duncan Booth wrote: Tell the function what type to return before you call it: InitScanLib = sLib.InitScanLib InitScanLib.restype = c_short See http://docs.python.org/2/library/ctypes.html#return-types You can also tell it what parameter types to expect which will make calling it simpler. -- http://mail.python.org/mailman/listinfo/python-list
handling return codes from CTYPES
PY33, Win7, Python Newbie, Not homework:-) I'm trying to use some 'C' DLLs from Python using ctypes and I have a minor issue with the return valuesbut I am new to Python; ctypes and using DLLs so I am at the bottom of so many learning curves, I'm not sure where or how to find my mistake. When I call the DLL, I am expecting a return of 1 (success) or a negative number (one of a set of error conditions)the return value is specified as 'short' in the DLL call specification - short InitScanLib (const char * szLicense). What I get back is either a 1 or something like 65535. This implies that I am receiving the expected value (-1) but 'something' is being lost in the translation. The code is asper the snippet below: from ctypes import * sLib = cdll.slib lic_key = c_char_p(asdfghjkl.encode(encoding='utf_8', errors='strict')) initResult = sLib.InitScanLib(lic_key.value) print(InitScanLib Result: , initResult) InitScanLib Result: 65535 I've tried declaring initResult as c_short by: inserting... initResult = c_short(0) ... before the call to sLib.InitScanLib but I still get the same response (65535). Interactively, I can see ... c_short(65535) c_short(-1) c_short(-1) c_short(-1) It's not a critical issue because I only want the return value to lookupa textual error message but I do want to understand what's going on. Any input appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: handling return codes from CTYPES
Mike, Thanks for your response - I was puzzled by one part of it though... On 21/01/2013 15:14, Mike C. Fletcher wrote: That's because you've just discarded the object you created I (mis?)understood from the ctypes documentation that ' initResult = c_short(0)' would result in the creation of a ctypes 'short' called initResult and that this object would be mutable. On that basis, I expected the following statement ' initResult = initScanLib( ... )' would assign the result of the call to initResult. So, I can understand that I am not using the correct approach but I don't understand how I discarded the object I created. Can you clarify please? Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: please i need explanation
I read the question as I've got this function and it does what I expect but I don't understand the code. On that basis... The function creates a factorialfor the input number 'n' (i.e. 1*2*3*4.*n) The first 2 lines checks to see that the input is less than 2 and, if so, returns a value of 1 The rest of the code counts down from n to 1 multiplying f by n at each iteration. If I guessed the right question, reply to the post for further clarification. Steve On 11/01/2013 16:33, kwakukwat...@gmail.com wrote: -Original Message- From: K. Elo Sent: Friday, January 11, 2013 3:56 AM To: python-list@python.org Subject: Re: please i need explanation Hi! Since there is no stated question, I need to guess: n -= 1 (instead of f -= 1) should work. Or maybe the question was a totally different one... -Kimmo 11.01.2013 17:35, kwakukwat...@gmail.com wrote: def factorial(n): if n2: return 1 f = 1 while n= 2: f *= n f -= 1 return f please it works.but don’t get why the return 1 and the code below. -- http://mail.python.org/mailman/listinfo/python-list
Help accessing COM .dll from Python
First time post - be gentle with me :-) I am trying to write a Python script to access a scanning device. I have an SDK for the scanner but the documentation is a bit limited and the supplier doesn't support Python (but Python is the best option for me in the current circumstances). The SDK revolves around a .dll file that is described as a 'COM Object' but the text also implies that it can be accessed directly - "If you dont use the COM interface in your application and use the SDK files directly like in VC++ then you dont need to install these files on the destination computer". If I look inside the .dll (thanks PE Explorer!), I see DllCanUnload, DllGetClassObject, DllRegisterServer and DllUnregisterServer in the 'Export' view. If I look at the 'Import' view, I can see the names of a bunch of .dll files and the names of the functions/methods I want to call. So I concluded that DllGetClassObject would be my friend. However, I've read various tutorials on using .dll and COM (ctypes, comtypes, and the Python documentation) and I've ended up more confused than when I started. I expected to be using COM but all the examples seem to revolve around automating excel or outlook. I'd be really grateful for some hints on what direction I should be headed and a pointer to a relevant tutorial. Simmo -- http://mail.python.org/mailman/listinfo/python-list
Re: Help accessing COM .dll from Python
Gunther - Sorry about that, hoping this response comes through as plain text. Chris - Thanks for the translation and the response. Unfortunately, I don't speak 'C', and I think the learning curve for Python + COM should be slightly less steep. The scanner is supplied by Card Scanning Solutions (CSSN in USA) and their docs are accessible from http://www.cardscanning.com/developers.php. -- http://mail.python.org/mailman/listinfo/python-list