[OT?]gmane not updating

2013-04-06 Thread breamoreboy
The gmane site is online but none of the Python lists I subscribe to have been 
updated for over 24 hours.  I fired off an email yesterday evening to larsi + 
gmane at gnus dot org but I've no idea whether there's anybody to read it, or 
even if it's actually been delivered :(  Is there anybody lurking who could 
stir the embers to get things rolling?

TIA.

Mark Lawrence
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: generator/coroutine terminology

2015-03-12 Thread breamoreboy
On Thursday, March 12, 2015 at 1:35:48 PM UTC, Rustom Mody wrote:
 This is more a question about standard terminology/conventions than about 
 semantics - of course assuming I understand :-)
 
 Say I have a simple yielding function:
 
 def foo(x):
yield x+1
yield x+2
 
 And I have
 
 g = foo(2)
 
 If I look at type, g's type is 'generator' whereas foo is just plain-ol 
 'function.'
 
 Whereas in informal usage we say foo is a generator.
 
 So the question:
 What should we call foo and what should we call g?
 
 Same applies when foo is a 'coroutine' ie
 something having yield used in an rhs and used with '.send' from outside:
 What to call foo and what to call foo(x)?

Try the glossary https://docs.python.org/3/glossary.html

If this comes out badly please free to shout as I'm on gg :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Canopy editor-Variables browser and help

2015-08-23 Thread breamoreboy
On Saturday, May 2, 2015 at 8:50:22 PM UTC+1, lbertolotti wrote:
 Can I:
 1.Enable a variable browser in Canopy editor similar to the Spyder editor?
 2.Writing a function say log( gives me the function help, but I can't read 
 the whole documentation
 3.Eclipse had a auto-complete, can I enable this in Canopy?
 4.Perhaps I should try using another editor? I was having some problems with 
 Spyder pythonpath...

What do the Canopy docs at http://docs.enthought.com/canopy/ tell you?

If you've used Eclipse why not give PyDev a try?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-21 Thread breamoreboy
On Tuesday, July 21, 2015 at 4:04:30 AM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 9:17:11 PM UTC-5, Rustom Mody wrote:
 
 
  List of python committers:
  -
   11081 Guido van Rossum
  [snip: long list]
 
 Thanks for posting this list of names. I had put in a pyFOIA
 request for this data a few years ago, but to my surprise, was
 flat out denied. I'm not sure how exhaustive this list may be,
 but publicly displaying the commit hierarchy within the Python
 community is very import for those who may want to get involved.
 
 [Talking to Mark Lawrence, Rustom said:]
  So... May I humbly ask where are your precious commits??
 
 Thanks for putting Mark in his place. He has been brow
 beating folks on this list (myself included) for years, and
 i'll bet he now feels as tiny as D'Aprano did -- when GvR
 scolded him for disrespecting a Noob on Python-ideas.
 

Read on, oh great stupid one.

   Yeah, i was watching! 
 
   I'M *ALWAYS* WATCHING!
 
   ಠ_ಠ
 
 Now that Mark's lack of commit cred has been exposed, we can
 safely ignore his hollow and hypocritical bullying. And now
 that he has been de-fanged, he will be forced to seek employment
 elsewhere. Hmm, my suggestion is that he market himself as an
 on-call peanut butter removal service. A venture that will
 no doubt be successful, seeing that he has two heads up on
 his competition!

Ever heard the saying engage brain before putting mouth into gear?  It was 
actually Rustom who posted inaccurate data as only core-devs have commit 
rights.  It would appear that your knowledge of the current development process 
is as good as your knowledge of European geography.  I would say enjoy your 
future in the peanut butter removal service but it is quite clear that you 
haven't the skills needed to make it happen.  In the mean time I'll quite 
happily carry on contributing to the Python community as best I can.

Oh, and while I think about it, you'd better put that shovel down, or the hole 
will only get deeper.

Have a nice day :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread breamoreboy
On Sunday, July 19, 2015 at 10:27:58 PM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 3:36:21 PM UTC-5, bream...@gmail.com wrote:
  Wrong, not all programmers need the patches as a lot of
  people couldn't care two hoots about 2.7.  
 
 Well you should. Because apparently, you're incapable of
 recognizing that Py2 and Py3 are existentially joined at the
 hip! The world of language survival is more complex than your
 selfish desires.

Wrong again, 2.7 doesn't have all the goodies now poring into 3.x, so there is 
nothing in 2.7 to make me care.  Further as I'm a one man band I do what I 
like, so having canned it several years back, as have many core devs, it's 
staying canned.  Selfish desires, very funny, I'll have to remember that one, 
you really are excelling yourself.

 
 If you're unable to draw parallels between py2 and py3,
 it's only because your focused is far too narrow. Negative
 perception of py2 translates to negative perception of py3.

I have no negative perception of 2.7, it simply no longer interests me, to 
repeat in the same way that it no longer interests some core devs.

 
 Python is the sum of all it's parts. Not merely the small
 part (or rattle) that you happen to find amusing. And since
 py3 is the smallest part of Python, and py2 is the largest,
 you would be wise to consider the consequences of a failed,
 or even perceived failure, of Py2.

2.7 is pretty much rock steady Eddie, so it is never going to be a perceived 
failure, let alone an actual failure.

 
 If you change the diapers in Py3 nursery but refuse to change 
 them in Py2 nursery, you might alleviate the your diaper rash, 
 but other babies poop will always smell worse than your own!

I'll repeat, those who want 2.7 supported do the work, can it get any simpler?  
You can support it, or are you still too busy working on your fork, 
RickedPython?  I'm not interested in it, I'm wouldn't touch it even if someone 
offered to pay me, end of story.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread breamoreboy
On Monday, July 20, 2015 at 1:49:58 AM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 7:28:28 PM UTC-5, Mark Lawrence wrote:
 
  Thank goodness for that as you make no sense at all. As
  for this ivory tower nonsense, [...]
 
 Cecil, don't pay too much attention to Mark, he's a glory
 hound. He's like the Python community version of Cerberus --
 you know, the three headed dog guarding the entrance to the
 Greek underworld. 
 
 Every time i defeat him, and drag him out through an opening in
 the caverns of code, and take him to a secret grove owned
 by D'Aprano, he always escapes and returns to guard the
 entrance again -- he's very loyal!
 
 He won't allow you to enter because you're still alive, and
 as such, you still have the capacity to feel emotions like
 compassion. These emotions are forbidden in the underworld!!!
 
 But don't worry, his bark is worse than his bite, and he is
 just the first of many daemons you must defeat on your quest
 to challenge the benevolent Hades.

Gosh you don't half spout some rubbish.  Your total number of victories over me 
is zero, although I personally come here to give or get knowledge, not look for 
such things.

As for the cobblers about Cerburus and challenging the benevolent Hades would 
you be kind enough to:-

a) list just how many Python bugs you have worked on

b) state how much work you intend doing on the planned core workflow 
improvements

For the latter you can find the relevant PEPs easily enough for yourself, or 
just like Cecil do you expect someone to do that for you as well?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread breamoreboy
On Sunday, July 19, 2015 at 8:13:50 PM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 1:44:25 PM UTC-5, bream...@gmail.com wrote:
  No, it's simply that nobody can force volunteers to back
  port something when they're just not interested in doing
  the work, for whatever reason.  Hence my statement above,
  of which you have focused on the last eight words.
 
 Well i argue that the free labor *WOULD* exists *IF* the
 patching mechanism were more inclusive and intuitive.
 

More inclusive?  Any man and his dog can get an account on the issue tracker? 
 Perhaps it isn't intuitive, but then reading the development guide tends to 
help.

All in all though I have to admit that overall it's a really onerous task.  
Once you've produced the patch you have to go to all the trouble of logging on 
to the issue tracker, finding the appropriate issue and uploading the patch.  
You may even be inclined to make a comment.  In this case this entire process 
could take as much as two whole minutes.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread breamoreboy
On Sunday, July 19, 2015 at 8:29:06 PM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 2:02:12 PM UTC-5, Ian wrote:
  Poor analogy. Babies need others to change their diapers
  for them because they're not capable of doing it for
  themselves.
 
 Duh! That was the point of his analogy, Ian. *ALL* Python
 programmers need the patches. Whether or not they possess
 the skill to create them is irrelevant.
 

Wrong, not all programmers need the patches as a lot of people couldn't care 
two hoots about 2.7.  I'm one of them.  If a programmer can't create a patch 
then they're in the wrong job.

 But the baby is not the only victim if the diapers are not
 changed. Imagine the foul odors that rumors of bugginess
 will emit into the household, and if unchecked long enough,
 out into the neighborhood.
 
 A some point a social worker will be dispatched, and the
 baby will be taken away to a home that provides the
 necessary sanitary conditions. But not before the parents
 will be thrown in prison, ridiculed, and forgotten. The end
 result is a broken family Ian.
 
 Is any of this sinking in?

No because as always it's complete dross.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread breamoreboy
On Sunday, July 19, 2015 at 7:28:15 PM UTC+1, Rick Johnson wrote:
 On Sunday, July 19, 2015 at 12:55:06 PM UTC-5, Mark Lawrence wrote:
  I don't think so, I know.  If they want the patches that
  badly and can't do it themselves they'll have to grin and
  bear it, or do a bit of begging, or pay somebody to do it
  for them. 
 
 It's all about the effing money then? So the barriers are not a
 bug, but a feature? Mr. Gates would be *SO* proud!

No, it's simply that nobody can force volunteers to back port something when 
they're just not interested in doing the work, for whatever reason.  Hence my 
statement above, of which you have focussed on the last eight words.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Silly question about pip

2015-09-10 Thread breamoreboy
On Wednesday, September 9, 2015 at 10:06:31 AM UTC+1, wxjm...@gmail.com wrote:
> Le mardi 8 septembre 2015 21:02:31 UTC+2, wxjm...@gmail.com a écrit :
> > Le mardi 8 septembre 2015 20:18:20 UTC+2, Irmen de Jong a écrit :
> > > On 8-9-2015 17:54, wxjmfa...@gmail.com wrote:
> > > > win7 / py433
> > > > 
> > > > How to downgrade from the latest pip (7.1.2) to
> > > > the previous one?
> > > > I'm sorry, I do not remember the numerous msgs
> > > > I saw when updating. (Yesterday)
> > > > 
> > > > (I'm serious)
> > > > 
> > > > Now, what?
> > > > 
> > > 
> > > I think:
> > > 
> > > $ pip install --upgrade pip==7.0.0
> > > 
> > > 
> > > would do the trick, where you substitute the required version number for 
> > > 7.0.0.
> > > 
> > > 
> > > Irmen
> > 
> > Addendum (your question)
> > 
> > > pip install --upgrade pip
> > 
> > which probably selects the latest version
> 
> 
> ---
> > pip install --upgrade pip==6.0.8
> 
> is indeed a valid command
> except I'm seeing the same previous mess.

The minor snag is we're not seeing your mess.  However as I'm getting really 
good vibes from my crystal ball today, I'd guess that you're getting a known 
problem on Windows with a permissions error, but the pip upgrade has actually 
worked fine.  Am I close?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unacceptable behavior

2016-04-10 Thread breamoreboy
On Sunday, April 10, 2016 at 2:54:45 PM UTC+1, Jeff Schumaker wrote:
> On Thursday, April 7, 2016 at 2:50:32 AM UTC-4, Ethan Furman wrote:
> > On 04/05/2016 01:05 PM, Thomas 'PointedEars' Lahn wrote:
> > 
> >  > | >>> from email import ID10T
> > 
> > Thomas, as has been pointed out to you in previous threads it is not 
> > necessary to be rude to be heard.
> > 
> > You are hereby placed in moderation for the Python List mailing list.
> > 
> > Every one else:  If you see offensive posts from Thomas on the usenet 
> > side, please just ignore them.  I have no desire to see his posts in 
> > your replies.
> > 
> > --
> > ~Ethan~
> > Python List Owners
> 
> Ethan,
> 
> As a new member of this group, I am not sure on how to report unacceptable 
> behavior. If this is not the correct way, I apologize.
> 
> Please check the following thread:
> 
> Find the number of robots needed to walk through the rectangular grid
> 
> I believe there was some unnecessary rudeness on the part of one of the 
> respondants to the original post
> 
> Jeff

I'm been through the entire thread and haven't got the faintest idea what 
you're talking about. Or are you in the camp that believes when someone is too 
bone idle to do any work for themselves, and turns up here asking for us to 
write all of their code for them, we should kill the fatted calf, roll out the 
red carpet, and then write the code?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unacceptable behavior

2016-04-10 Thread breamoreboy
On Sunday, April 10, 2016 at 3:03:37 PM UTC+1, Chris Angelico wrote:
> On Sun, Apr 10, 2016 at 11:54 PM, Jeff Schumaker  
> wrote:
> > As a new member of this group, I am not sure on how to report unacceptable 
> > behavior. If this is not the correct way, I apologize.
> >
> > Please check the following thread:
> >
> > Find the number of robots needed to walk through the rectangular grid
> >
> > I believe there was some unnecessary rudeness on the part of one of the 
> > respondants to the original post
> 
> My guess is you're talking about Mark Lawrence, and yes, I agree; he's
> been fairly vitriolic.
> 
> The standard way to report abusive behaviour on mailing lists is to
> contact the owner. For python-list@python.org, that's
> python-list-ow...@python.org, although the corresponding newsgroup
> isn't really 'owned' in the same way.
> 
> ChrisA

You were wrong, care to have another go?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to minimize the need of run time checks?

2016-08-14 Thread breamoreboy
On Sunday, August 14, 2016 at 7:09:47 AM UTC+1, Paul Rubin wrote:
> Steven D'Aprano writes:
> > If the Python community rallies around this "record" functionality and
> > takes to it like they took too namedtuple
> 
> I like namedtuple and I think that it's a feature that they're modified
> by making a new copy.  I know that has overhead but it's palpably
> bug-avoidant.  I've used them extensively in some programs and they took
> a considerable burden off my mind compared to using something like
> structs or records.

You might find this https://glyph.twistedmatrix.com/2016/08/attrs.html an 
interesting read.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread breamoreboy
On Friday, August 12, 2016 at 2:31:01 PM UTC+1, Michael Torrie wrote:
> On 08/12/2016 05:07 AM, Steven D'Aprano wrote:
> > The first time I ever compiled a full-sized application (not a particular
> > large one either, it was a text editor a little more featureful than
> > Notepad) it took something like nine hours to compile on a Mac SE (this was
> > circa 1990). How mad would I have been if, eight hours and thirty minutes
> > into the compilation, the compiler suddenly stopped with an error caused by
> > a mistyped variable name?
> 
> Surely this application was built using a build system, even back then,
> that would allow compilation to resume and not rebuild object files that
> were already built.

Are you one of those extremely lucky people who worked on projects in which the 
header files never, ever changed?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: can't add variables to instances of built-in classes

2016-07-20 Thread breamoreboy
On Wednesday, July 20, 2016 at 10:48:23 PM UTC+1, Lawrence D’Oliveiro wrote:
> On Thursday, July 21, 2016 at 12:11:09 AM UTC+12, Steven D'Aprano wrote:
> 
> > [long irrelevant rant deleted]
> 
> Just because I pointed out what a load of nonsense you were spouting about 
> __slots__, by giving a counterexample of their usefulness? Man, your pride 
> must be hurt...

I hereby request that the moderators take this idiot offline as he's managed to 
insult two highly respected members of this community in no time at all, those 
of course being Steven D'Aprano and Peter Otten.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP Request: Advanced Data Structures

2016-07-16 Thread breamoreboy
On Saturday, July 16, 2016 at 11:15:04 PM UTC+1, Shrey Desai wrote:
> I have found it slightly frustrating that Python does not have built-in 
> support for advanced data structures (Linked Lists, Stacks/Queues, BST) in 
> its distribution. Many computer science students, developers, and software 
> engineers rely on these data structures; having the data structures be a part 
> of the distribution and be maintained by the Python community would be 
> immensely useful. 
> 
> Currently, we are required to write our own modules that represent these data 
> structures and rigorously test/refactor them before we can actually use them. 
> This gets annoying because instead of spending time USING the "correct" 
> version of the data structure, we have to spend time creating them in the 
> first place.
> 
> Programming languages like Java have support for Linked Lists, for example, 
> which makes it easy to just use it instead of trying to create it over again. 
> As a computer science undergraduate student, I don't want to spend time 
> writing the module but instead I want to work with it, play around with it, 
> and do problems with it. 
> 
> I know Python currently has a Queue module, but this can definitely be 
> expanded. There are other more advanced data structures out there, like AVL 
> trees, splay trees, and tries, but I think that would be overkilll. Having 
> these data structures above would be immensely useful.
> 
> I'm looking to create a PEP for this issue and some people that would be 
> willing to 1) vouch for this idea and 2) co-author the draft. Eventually, we 
> would be co-developers for the project as well.
> 
> Who's in?

Thanks but no thanks :)  I find the structures listed here 
http://kmike.ru/python-data-structures and here 
https://pypi.python.org/pypi/sortedcontainers more than adequate for my needs.

Cheers.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: can't add variables to instances of built-in classes

2016-07-19 Thread breamoreboy
On Tuesday, July 19, 2016 at 3:54:12 AM UTC+1, Lawrence D’Oliveiro wrote:
> On Tuesday, July 19, 2016 at 11:12:52 AM UTC+12, bream...@gmail.com wrote:
> >
> > On Monday, July 18, 2016 at 10:48:15 PM UTC+1, Lawrence D’Oliveiro wrote:
> >>
> >> 
> >> When you have lots of read/write properties, I find __slots__ to be a good
> >> idea.
> > 
> > Please explain why, thank you.
> 
> I was trying something like
> 
> ctx.dashes = ((0.1, 0.03, 0.03, 0.03), 0)
> 
> and wondering why it wasn’t working...

This makes no sense to me at all.  You appear to be trying to create a tuple, 
which contains a tuple and an integer.  You then say it doesn't work, but imply 
that using __slots__ fixes the problem.  So please explain exactly what you 
were trying to achieve, the exact error you got, with the complete traceback, 
and how using __slots__ fixed the problem.

Cheers.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Ned Batchelder: Loop Like A Native

2016-08-06 Thread breamoreboy
A couple or three years old but this is well worth seeing for anybody, 
regardless of your Python expertise. http://nedbatchelder.com/text/iter.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ned Batchelder: Loop Like A Native

2016-08-08 Thread breamoreboy
On Sunday, August 7, 2016 at 2:26:48 AM UTC+1, Ned Batchelder wrote:
> On Saturday, August 6, 2016 at 9:21:24 PM UTC-4, Lawrence D’Oliveiro wrote:
> > On Sunday, August 7, 2016 at 11:36:06 AM UTC+12, Ned Batchelder wrote:
> > 
> > > Didn't we already do this debate?
> > 
> > I understand. You want to discuss loops, just not *those* sorts of loops...
> 
> I didn't post this link here.  I'm merely pointing out that your concern
> about multiple ways to exit loops sounds like exactly what was discussed
> here two months ago.  Is there any reason to think there is new material
> to discuss?
> 
> --Ned.

Thank you Ned for being far more diplomatic than I would have been.  My round.  
When can you get over https://bearbeerfamily.co.uk/the-saxon-bear/ ? :)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner help

2017-02-05 Thread breamoreboy
On Sunday, February 5, 2017 at 11:27:19 PM UTC, pha...@u.rochester.edu wrote:
> Hi everyone. I'm new to python and have hit a bit of a wall with an 
> assignment I'm working on. I created a number of classes and instantiated 
> them, now I need to create a list out of them. I am looking for something 
> more elegant than appending each object to the list as I instantiate it. I 
> tried setting up an if loop, but didn't get far with it. Any suggestions?

If loop, for heavens sake :)

Try one of these beasties instead 
https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] "Immutable Builder" Pattern and Operator

2017-01-23 Thread breamoreboy
On Monday, January 23, 2017 at 2:11:53 PM UTC, M.-A. Lemburg wrote:
> On 23.01.2017 14:28, Soni L. wrote:
> > 
> > 
> > On 23/01/17 11:18 AM, M.-A. Lemburg wrote:
> >> On 23.01.2017 14:05, Soni L. wrote:
> >>> Yeah but the dotequals operator has many other benefits:
> >>>
> >>> long_name .= __call__  # cast to callable
> >>> long_name .= wrapped  # unwrap
> >>> etc
> >>>
> >>> And it also looks neat.
> >> I don't see this an being a particular intuitive way of writing
> >> such rather uncommon constructs.
> >>
> >> The syntax is not clear (what if you have an expression on the RHS)
> >> and it doesn't save you much in writing (if long_name is too long
> >> simply rebind it under a shorter name for the purpose of the code
> >> block).
> > 
> > It's literally sugar for repeating the name and moving the dot to the
> > right. I think it's clearer than most other compound operators in that
> > it doesn't affect precedence rules.
> > 
> > `x += y`, for any code `y`, is equivalent to `x = x + (y)`, not `x = x +
> > y`.
> > 
> > `x .= y`, for any code `y`, is equivalent to `x = x . y`, not `x = x .
> > (y)`.
> 
> Well, then please consider these:
> 
> x .= y + z
> x .= y * z
> x .= y.z
> x .= y.z()
> 
> >> Also note that rebinding different objects to the same name
> >> in the same block is often poor style and can easily lead to
> >> hard to track bugs.
> >>
> > 
> > Rebinding different objects to the same name in rapid succession
> > is fine.
> 
> Not in my book :-)
> 
> It may be fine if the object type stays the same or
> in those few cases, where you want to accept multiple
> different types for a parameter and then coerce these
> to a type that you use in the rest of the code block.
> 
> But even in those cases, debugging becomes easier if
> you keep the original binding in place (since you then
> know where the new values originated).
> 
> This is not good style...
> 
> x = 'abc'
> x = len(x)
> x = [x, 1]
> x = ''.join(str(a) for a in x)
> print (x)
> 
> -- 
> Marc-Andre Lemburg
> eGenix.com
> 

The wrong list methinks :)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is it possible to get the Physical memory address of a variable in python?

2017-01-23 Thread breamoreboy
On Monday, January 23, 2017 at 5:59:42 PM UTC, Sourabh Kalal wrote:
> how we can access the value from using id..
> like x=10
> id(x)
> 3235346364
> 
> how i can read value 10 using id 3235346364

What are you trying to achieve here?  If you'd explain that rather than how 
you're trying to achieve it you're likely to get better answers.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python

2017-01-25 Thread breamoreboy
On Wednesday, January 25, 2017 at 2:15:16 PM UTC, murphyc...@gmail.com wrote:
> Need help

Please read this http://www.catb.org/~esr/faqs/smart-questions.html and then 
this http://sscce.org/ before trying again.

Kindest regards.

Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: problems installing pylab

2017-02-22 Thread breamoreboy
On Tuesday, February 21, 2017 at 3:55:40 PM UTC, Robert William Lunnon wrote:
> Dear Python
> 
> I am trying to install pylab alongside python 3.6. However when I type
> 
> python -m pip install pylab
> 
> I get the message
> 
> No module named site
> 
> In the documentation [documentation for installing python modules in
> python 3.6.0 documentation] it says: The above example assumes that the
> option to adjust the system PATH environment variable was selected when
> installing python.
> 
> How do I do this?
> 
> I am running Windows 10
> 
> Looking forward to hearing from you
> 
> Bob

If you actually need matplotlib I suggest that you read this 
http://stackoverflow.com/questions/11469336/what-is-the-difference-between-pylab-and-pyplot

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CSV

2017-02-22 Thread breamoreboy
On Wednesday, February 22, 2017 at 5:55:47 PM UTC, Braxton Alfred wrote:
> Why does this not run?  It is right out of the CSV file in the Standard Lib. 
> 
> Python ver 3.4.4, 64 bit.
> 
> import csv
> """ READ EXCEL FILE """
> filename = 'c:\users\user\my documents\Braxton\Excel\personal\bp.csv'
> with open (filename, newline = ' ') as bp:
> dialect = csv.excel
> reader = csv.reader(bp)
> for row in reader:
> print (row)
> 
> Marc

Of course it will run, assuming that there are no syntax errors.

Besides that using raw strings or forward slashes will probably help.

Of course we don't actually know as you haven't shown us the actual error that 
you get, and our crystal balls broke down long ago owing to over use.

You might like to read http://www.catb.org/~esr/faqs/smart-questions.html and 
then http://sscce.org/ or even http://stackoverflow.com/help/mcve and then ask 
again.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-19 Thread breamoreboy
On Saturday, February 18, 2017 at 6:03:37 PM UTC, Wildman wrote:
> On Sat, 18 Feb 2017 09:38:32 -0800, TTaglo wrote:
> 
> > i = 1
> > f = open ('rosalind_ini5(1).txt')
> > for line in f.readlines():
> > if i % 2 == 0:
> > print line
> > i += 1
> > 
> > 
> > How do i get output without breaks between the lines?
> > 
> > Result:
> > 
> > Other things just make you swear and curse
> > 
> > When you're chewing on life's gristle, don't grumble give a whistle
> > 
> > This will help things turn out for the best
> > 
> > Always look on the bright side of life
> 
> In Python 3 you can do this:
> 
> print(line, end="")
> 
> For Python 2 use this:
> 
> import sys
>   .
>   .
>   .
> sys.stdout.write(line)
> 
> Don' forget...
> f.close()
> 
> -- 
>  GNU/Linux user #557453
> The cow died so I don't need your bull!

For Python 2, strictly from memory:-

from __future__ import print_function

print(line, end="")

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


How coding in Python is bad for you

2017-01-23 Thread breamoreboy
The article is here http://lenkaspace.net/index.php/blog/show/111

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The Joys Of Data-Driven Programming

2016-08-21 Thread breamoreboy
On Sunday, August 21, 2016 at 11:18:49 PM UTC+1, Marko Rauhamaa wrote:
> Lawrence D’Oliveiro :
> 
> > On Monday, August 22, 2016 at 2:20:39 AM UTC+12, Marko Rauhamaa wrote:
> >> ... can heartily recommend SCons.
> >
> > It’s Python 2 only, not Python 3.
> 
> And? SCons is very good, definitely beats make. It also illustrates the
> use of a real programming language for special applications (as opposed
> to ad hoc rules).
> 
> The flawed thinking behind rules is often expressed like this: We want
> rules because not everybody is a programmer.
> 
> However, with rules, not even a programmer knows how to configure the
> thing.
> 
> 
> Marko

Some people clearly disagree 
http://catherinedevlin.blogspot.co.uk/2009/06/dont-need-no-stinking-rules-engine.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python application launcher (for Python code)

2017-02-25 Thread breamoreboy
On Friday, February 24, 2017 at 1:54:39 AM UTC, Deborah Swanson wrote:
> Michael Torrie wrote, on February 23, 2017 7:43 AM
> > 
> > On 2017-02-22 09:49 PM, Deborah Swanson wrote:
> > > Didn't even look. Visual Studio has always been pricey, and it never
> 
> > > occurred to me that they might have a free or cheap version now.
> > 
> > You can get the full edition of Visual Studio, called Visual Studio 
> > Community Edition for free.  They still offer Visual Studio Express,
> but 
> > I think they recommend the full community edition to most people now. 
> > The biggest downside to the VS Community Edition is that it has to
> phone 
> > home and log in to MS's developer web site from time to time to stay 
> > active.  Sigh. MS almost gets it, but not quite.
> 
> Another free version of Visual Studio, wonders never cease!
> 
> As for it phoning home, I won't use it for long, and then I might not
> ever use it again. Wonder what value they think this has, other than
> giving them a nosecount of how many active copies there are at any given
> time.

As an alternative to Visual Studio Community Edition, which takes forever and a 
day to download and install, you might like to give Visual Studio Code a try 
https://code.visualstudio.com/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Would like some thoughts on a grouped iterator.

2016-09-05 Thread breamoreboy
On Monday, September 5, 2016 at 10:42:27 AM UTC+1, Peter Otten wrote:
> Antoon Pardon wrote:
> 
> > I need an interator that takes an already existing iterator and
> > divides it into subiterators of items belonging together.
> > 
> > For instance take the following class, wich would check whether
> > the argument is greater or equal to the previous argument.
> > 
> > class upchecker:
> > def __init__(self):
> > self.prev = None
> > def __call__(self, arg):
> > if self.last is None:
> > self.prev = arg
> > return True
> > elif arg >= self.last:
> > self.prev = arg
> > return True
> > else:
> > self.prev = arg
> > return False
> > 
> > So the iterator I need --- I call it grouped --- in combination with
> > the above class would be used someting like:
> > 
> > for itr in grouped([8, 10, 13, 11, 2, 17, 5, 12, 7, 14, 4, 6, 15, 16, 19,
> > 9, 0, 1, 3, 18], upchecker()):
> > print list(itr)
> > 
> > and the result would be:
> > 
> > [8, 10, 13]
> > [11]
> > [2, 17]
> > [5, 12]
> > [7, 14]
> > [4, 6, 15, 16, 19]
> > [9]
> > [0, 1, 3, 18]
> > 
> > Anyone an idea how I best tackle this?
> 
> I always start thinking "There must be an elegant way to do this" and then 
> end with a clumsy wrapper around itertools.groupby().
> 
> $ cat grouped.py
> from itertools import groupby
> 
> 
> class Check:
> def __init__(self, check):
> self.first = True
> self.prev = None
> self.toggle = False
> self.check = check
> 
> def __call__(self, item):
> if self.first:
> self.first = False
> else:
> if not self.check(self.prev, item):
> self.toggle = not self.toggle
> self.prev = item
> return self.toggle
> 
> 
> def grouped(items, check):
> return (g for k, g in groupby(items, Check(check)))
> 
> 
> if __name__ == "__main__":
> def upchecker(a, b):
> return a < b
> 
> items = [
> 8, 10, 13, 11, 2, 17, 5, 12, 7, 14, 4, 6, 15, 16, 19, 9, 0, 1, 3, 18
> ]
> for itr in grouped(items, upchecker):
> print(list(itr))
> 
> $ python grouped.py
> [8, 10, 13]
> [11]
> [2, 17]
> [5, 12]
> [7, 14]
> [4, 6, 15, 16, 19]
> [9]
> [0, 1, 3, 18]

As usual you beat me to it, but I'd spell "upchecker" as "from operator import 
lt" :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: listdir

2016-09-05 Thread breamoreboy
On Monday, September 5, 2016 at 4:34:45 PM UTC+1, Rustom Mody wrote:
> So what do you get when you replace the if-else with a simple: print(file)  ?
> 
> [And BTW dont use the variable name “file” its um sacred]

Only in Python 2, it's gone from the built-ins in Python 3 
https://docs.python.org/3/whatsnew/3.0.html#builtins

Kindest regards.

Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread breamoreboy
On Tuesday, September 6, 2016 at 10:06:34 PM UTC+1, Yang, Gang CTR (US) wrote:
> Hi,
> 
> I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 
> 2008 R2) and tried the python --version command. Surprisingly, the command 
> reported 2.5.4. What's going on?
>  
> Gang Yang
>

You'll need to change your environment settings.  All the details are here 
https://docs.python.org/3/using/windows.html

Kindest regards.

Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-14 Thread breamoreboy
On Wednesday, September 14, 2016 at 9:00:04 PM UTC+1, MRAB wrote:
> On 2016-09-14 18:43, Dale Marvin via Python-list wrote:
> > On 9/14/16 12:20 AM, Steven D'Aprano wrote:
> >> On Wednesday 14 September 2016 16:54, Rustom Mody wrote:
> >>
> >>> everything we know will be negated in 5-50-500 years
> >>
> >> I'm pretty sure that in 5, 50, 500 or even 5000 years, the sun will still 
> >> rise
> >> in the east, water will be wet, fire will burn, dogs will have mammary 
> >> glands
> >> and frogs[1] won't, and the square root of 100 will still be 10.
> >>
> >> Isaac Asimov once wrote:
> >>
> >> When people thought the earth was flat, they were wrong. When people
> >> thought the earth was spherical, they were wrong. But if you think that
> >> thinking the earth is spherical is just as wrong as thinking the earth
> >> is flat, then your view is wronger than both of them put together.
> >
> >> http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
> >>
> >> [1] Assuming that there are any frogs left by then.
> >>
> >
> > Funny, Asimov's professors must have taught him the same false history
> > that I was taught at college. There's much evidence that medieval
> > scholars did not believe the earth was flat.
> >
> > 
> >
> Where does it say that he thought that _medieval_ scholars did not 
> believe the earth was flat?

It is so blantantly obvious that the world is not flat I find this discussion 
flabbergasting.  Anybody who has tried to take any form of vehicle up, or 
probably more dangerously down, any form of hill knows that.  As for the raving 
lunatics who make their living by riding up and down these 
http://www.bbc.co.uk/news/in-pictures-37348004, well need I say more?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-14 Thread breamoreboy
On Tuesday, September 13, 2016 at 9:57:38 PM UTC+1, Richard Grigonis wrote:
> It would help newbies and prevent confusion.

I entirely agree.  All together now "foreach is a jolly good fellow...".

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python3 regex?

2016-09-10 Thread breamoreboy
On Saturday, September 10, 2016 at 4:12:17 AM UTC+1, Doug OLeary wrote:
> Hey;
> 
> Long term perl ahderent finally making the leap to python.  From my reading, 
> python, for the most part, uses perl regex.. except, I can't seem to make it 
> work...
> 
> I have a txt file from which I can grab specific titles via a perl one-liner:
> 
> $ perl -ne 'print if (m{^("?)[1-9]*\.})' tables
> 1. ${title1}
> 2. ${title2}
> "3. ${title3}",,,
> 4. one more title
> 5. nuther title
> 6. and so on...,,
> ...
> 25. last title
> 
> I can't seem to get the same titles to appear using python:
> 
> 
> $ python -V
> Python 3.5.2
> $ python
> Python 3.5.2 (default, Jul  5 2016, 12:43:10) 
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> import re
> >>> with open('tables','rt') as f:
>   data = f.read()
> 
> printing data results in the output I would expect..
> 
> Trying to compile a regex and display the results does not show the same 
> results I get from perl.  
> 
> >>> regex = r'^("?)[1-9]*\.'
> >>> re.search(regex, data)
> >>>
> 
> >>> p = re.compile(r'^("?)[1-9]*\.')
> >>> p
> re.compile('^("?)[1-9]*\\.')
> >>> p.findall(data)
> 
> I've tried any number of options shown on the net all with the same result.  
> Can someone point out what I'm messing up?
> 
> Thanks
> 
> Doug

I'm no regex expert but would this third party module 
https://pypi.python.org/pypi/regex help?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread breamoreboy
On Saturday, October 8, 2016 at 12:07:47 PM UTC+1, Rustom Mody wrote:
> On Saturday, October 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote:
> > This is the result when I copy and paste it one line at a time :
> > 
> > >>> rect_x = 50
> > >>> rect_y = 50
> > >>> while not done: 
> > >>> 
> >  for event in ...
> 
> 
> There's sure something strange about your formatting
> 
> you want something like this I think:
> 
> rect_x = 50
> rect_y = 50
> while not done:
> for event in pygame.event.get():
> if event.type == pygame.QUIT:
> done = True
> 
> On a related note in addition to Steven's 2 suggestions
> - paste 1 line at a time
> - Write the code in a py file
> 
> you could also try it out without Idle
> ie start python at your shell (or terminal or cmd.exe or whatever)
> And try it there

The easiest way is to use the ipython %paste magic command.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to read maple .m file into Python?

2016-10-09 Thread breamoreboy
On Sunday, October 9, 2016 at 10:00:26 PM UTC+1, Ho Yeung Lee wrote:
> i saved a list of matrix of algebra into .m file in maple
> How to read and import into Python for sympy to use?

I'd start here 
http://www.maplesoft.com/support/help/Maple/view.aspx?path=UserManual/Chapter11 
which was the first hit I got on google for "read .m maple file with python".

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Parlez-vous Python?

2016-08-25 Thread breamoreboy
Well the language certainly is getting mentioned all over the place 
https://yougov.co.uk/news/2016/08/23/parlez-vous-python/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is duck-typing misnamed?

2016-08-27 Thread breamoreboy
This should go to Python ideas as it would involve a substantial change to the 
docs.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error numpy install

2016-08-27 Thread breamoreboy
On Saturday, August 27, 2016 at 5:45:58 PM UTC+1, GP wrote:
> I have installed numpy using the command pip install numpy from command 
> prompt and I am getting the following error:
> Traceback (most recent call last):
>   File "", line 1, in 
> import numpy
>   File 
> "C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\__init__.py",
>  line 180, in 
> from . import add_newdocs
>   File 
> "C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\add_newdocs.py",
>  line 13, in 
> from numpy.lib import add_newdoc
>   File 
> "C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\lib\__init__.py",
>  line 8, in 
> from .type_check import *
>   File 
> "C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\lib\type_check.py",
>  line 11, in 
> import numpy.core.numeric as _nx
>   File 
> "C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\__init__.py",
>  line 14, in 
> from . import multiarray
> ImportError: cannot import name 'multiarray'
> 
> I have also tried to install multiarray but it says: "Could not find a 
> program that satisfies the requirement multiarray(from versions)
> 
> Any suggestions on how to install

This has been reported a lot over the last couple of years.  I've always 
overcome any numpy problems by downloading the appropriate version from 
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and then using pip install 
against the local file name.  HTH.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is duck-typing misnamed?

2016-08-29 Thread breamoreboy
On Monday, August 29, 2016 at 12:08:26 PM UTC+1, Ben Finney wrote:
> Michael Torrie writes:
> 
> > Umm no, she was actually a witch.  Which makes the scene even funnier.
> > "Fair caught," she says at the end.
> 
> She says [0] “It's a fair cop”, which is using the term “cop” to mean
> the arrest or sentence, asserting that it's justified.
> 
> Hence, the British term “copper”, meaning a police officer: the one who
> does the cop (the capture or arrest) for a crime.
> 

Also used in the Dead Bishop sketch.

Klaus: It's a fair cop, but society's to blame.

Detective: Agreed. We'll be charging them too. 

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need help for the print() function with a better order

2016-10-03 Thread breamoreboy
On Sunday, October 2, 2016 at 2:12:39 AM UTC+1, 38016...@gmail.com wrote:
> I am trying to print a simple decision tree for my homework.
> The answer must keep in this format:
> 
> Top 7,4,0.95
> career gain = 100
>   1.Management 2, 3, 0.9709505944546686
>   2.Service 5, 1, 0.6500224216483541
> location gain = 100
>   1.Oregon 4, 1, 0.7219280948873623
>   2.California 3, 3, 1.0
> edu_level gain = 100
>   1.High School 5, 1, 0.6500224216483541
>   2.College 2, 3, 0.9709505944546686
> years_exp gain = 100
>   1.Less than 3 3, 1, 0.8112781244591328
>   2.3 to 10 2, 1, 0.9182958340544896
>   3.More than 10 2, 2, 1.0
> 
> Here is my code:
> features={'edu_level':['High School','College'],'career':
> ['Management','Service'],'years_exp':['Less than 3','3 to 10','More than 
> 10'],'location':['Oregon','California']}
> 
> print('Top 7,4,0.95')
> for key in features:
> print('{} gain = {}'.format(key,100))
> attributes_list=features[key]
> kargs={}
> for i in range(len(attributes_list)):
> kargs[key]=attributes_list[i]
> low=table.count('Low',**kargs)
> high=table.count('High',**kargs)
> print('\t{}.{} {}, {}, 
> {}'.format(i+1,attributes_list[i],low,high,entropy(low,high)))
> 
> I set all the gain as 100 now.But actually the gain must calculate with the 
> data below.
> For example, the career gain need the data of 'Management' and 'Service'.
> I don't know how to do.
> or Anyone can provide me a better logic?

This code cannot run as neither count nor entropy are defined.

You can loop around the features like this:-

for key, attributes_list in features.items():

'iteritems' as suggested by Peter Pearson is Python 2 only.

You can loop around your attributes with:-

for attribute in attributes_list:

If you need the index in the loop use the enumerate function 
https://docs.python.org/3/library/functions.html#enumerate

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is that forwards first or backwards first? (Re: unintuitive for-loop behavior)

2016-10-03 Thread breamoreboy
On Monday, October 3, 2016 at 12:53:55 PM UTC+1, Marko Rauhamaa wrote:
> Gregory Ewing:
> 
> > Turns out the only difference between first and reverse on that model
> > is whether you lift up a little ring on the shaft of the gear lever
> > prior to engagement.
> >
> > Who came up with *that* brilliant piece of user interface design I
> > don't know. It seems specifically designed to encourage velocity sign
> > errors when starting off...
> 
> Well, it could be worse. This layout is pretty traditional:
> 
> 1  3  5
> |  |  |
> +--+--+
> |  |  |
> 2  4  R
> 
> 
> Marko

There was the shift on the steering column on the 2CV, but then there's also 
this.


Traditional Italian military vehicle layout.

 1  3  5
 |  |  |
 +--+--+
 |  |  |
 2  4  F



Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is that forwards first or backwards first? (Re: unintuitive for-loop behavior)

2016-10-03 Thread breamoreboy
On Monday, October 3, 2016 at 5:41:23 PM UTC+1, BartC wrote:
> On 03/10/2016 16:03, wrote:
> > On Monday, October 3, 2016 at 12:53:55 PM UTC+1, Marko Rauhamaa wrote:
> >> Gregory Ewing:
> >>
> >>> Turns out the only difference between first and reverse on that model
> >>> is whether you lift up a little ring on the shaft of the gear lever
> >>> prior to engagement.
> >>>
> >>> Who came up with *that* brilliant piece of user interface design I
> >>> don't know. It seems specifically designed to encourage velocity sign
> >>> errors when starting off...
> >>
> >> Well, it could be worse. This layout is pretty traditional:
> >>
> >> 1  3  5
> >> |  |  |
> >> +--+--+
> >> |  |  |
> >> 2  4  R
> 
> >
> > There was the shift on the steering column on the 2CV, but then there's 
> > also this.
> >
> > 
> > Traditional Italian military vehicle layout.
> >
> >  1  3  5
> >  |  |  |
> >  +--+--+
> >  |  |  |
> >  2  4  F
> >
> > 
> 
> I don't get it. Shouldn't it be:
> 
>R  R  R
>|  |  |
>+--+--+
>|  |  |
>R  R  R
> 
> ?
> 
> -- 
> Bartc
> 
> (It's OK, I'm Italian...)

A very poor design, what happens if the enemy attack from the rear? :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is a mechanism equivalent to "trace variable w ..." in Tcl for Python?

2016-09-30 Thread breamoreboy
On Friday, September 30, 2016 at 7:16:10 PM UTC+1, Les Cargill wrote:
> A really interesting design approach in Tcl is to install a callback
> when a variable is written to. This affords highly event-driven 
> programming.
> 
> Example ( sorry; it's Tcl  ) :
> 
> 
> namespace eval events {
>   set preRPM -1
>   proc handleRPM { args } {
>   # do stuff to handle an RPM change here
>   variable ::motor::RPM
>  variable preRPM
>   puts "RPM changed from $preRPM to $RPM
>   set preRPM $RPM
>  }
> }
> 
> ...
> 
> trace variable ::motor::RPM w ::events::handleRPM
> 
> ...
> 
> set ::motor::RPM 33.33
> 
> What is an equivalent mechanism in Python?
> 
> Thanks in advance.
> 
> -- 
> Les Cargill

Perhaps you could pinch the idea, or even the code, from tkinter?  E.g. see the 
section "Variable tracing" at 
http://stupidpythonideas.blogspot.co.uk/2013/12/tkinter-validation.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Counting words in a string??

2016-09-30 Thread breamoreboy
On Friday, September 30, 2016 at 8:12:47 PM UTC+1, Jake wrote:
> On Friday, 30 September 2016 19:49:57 UTC+1, srinivas devaki  wrote:
> > On Oct 1, 2016 12:10 AM, "Jake" wrote:
> > >
> > > Hi, I need a program which:
> > > 1) Asks the user for a sentence of their choice (not including
> > punctuation)
> > > 2) Ask the user which word they would like to know is repeated
> > > 3) Print out to the user how many times the word came up which they chose
> > from their sentence.
> > >
> > 
> > typical home work assignment, even though stop asking for programs and
> > start asking how to make the same.
> > 
> > anyway if you ever try to write code for this you have to split you
> > sentence and use a dict for counting
> > 
> > Python has Counter from collections but it is a little bit slower when
> > compared to defaultdict for this kind of purpose.
> > 
> > Regards
> > Srinivas Devaki
> > Senior (final yr) student at Indian Institute of Technology (ISM), Dhanbad
> > Computer Science and Engineering Department
> > ph: +91 9491 383 249
> > telegram_id: @eightnoteight
> 
> --
> Could you make the program for me or provide an outline?

We'll start work as soon as your cheque made payable to the Python Software 
Foundation has been cashed.  It works a bit like the Monty Python "Blackmail" 
sketch, the higher the grade you want, the more you have to pay.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Nested for loops and print statements

2016-09-26 Thread breamoreboy
On Monday, September 26, 2016 at 9:57:52 PM UTC+1, Cai Gengyang wrote:
> Ok it works now:
> 
> >>>for row in range(10):
>   for column in range(10):
>print("*",end="")
> 
>  
> 
> 
> but how is it different from ---
> 
> >>> for row in range(10): 
>for column in range(10): 
>   print("*",end="") 
>
> SyntaxError: inconsistent use of tabs and spaces in indentation 
> 
> Why does the example on top work and the example below doesn't work ? The 
> only difference is that the "print" statement is one space different from 
> each other. Forgive me if i can't explain things clearly over the forum 
> 

Perhaps you'd be more comfortable on the tutor mailing list 
https://mail.python.org/mailman/listinfo/tutor

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: inplace text filter - without writing file

2016-10-02 Thread breamoreboy
On Sunday, October 2, 2016 at 6:19:14 AM UTC+1, Sayth Renshaw wrote:
> 
> I just can't quite get it.
> 
> def return_files(file_list):
> for filename in sorted(file_list):
> file = os.path.join(dir_path, filename)
> print(file)
> with open(file) as fd:
> print(fd)
> for fileItem in fd:
> print(fileItem)
> for line in fileItem:
> print(line[0])
> if 

Re: Byte code descriptions somewhere?

2016-10-01 Thread breamoreboy
On Saturday, October 1, 2016 at 11:57:17 PM UTC+1, Cem Karan wrote:
> Hi all, I've all of a sudden gotten interested in the CPython interpreter, 
> and started trying to understand how it ingests and runs byte code.  I found 
> Include/opcode.h in the python sources, and I found some basic documentation 
> on how to add in new opcodes online, but I haven't found the equivalent of an 
> assembly manual like you might for x86, etc.  Is there something similar to a 
> manual dedicated to python byte code?  Also, is there a manual for how the 
> interpreter expects the stack, etc. to be setup so that all interactions go 
> as expected (garbage collections works, exceptions work, etc.)?  Basically, I 
> want a manual similar to what Intel or AMD might put out for their chips so 
> that all executables behave nicely with one another.
> 
> Thanks,
> Cem Karan

Further to Ben Finney's answer this 
https://docs.python.org/devguide/compiler.html should help.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to process syntax errors

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 3:15:40 PM UTC+1, mr.pune...@gmail.com wrote:
> Hi 
> 
> Is there any way to capture syntax errors and process them ? I want to write 
> a function which calls every time whenever there is syntax error in the 
> program.
> 
> For example, 
> 
> inside example.py 
> 
> I just mention below line 
> 
> 
> Obj = myClass()
> Obj xyz
> 
> Obj is instance of a class. But there is syntax error on xyz. So I want to 
> grab that error and process.
> 
> Regards, Puneet

Simple, catch it in your IDE, no need to try and get clever.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 5:25:46 PM UTC+1, Nuen9 wrote:
> > Hi!
> > 
> > Could it be, "Nuen9", that you would like to find a split where the 
> > split sums are close to each other? In other words, you define the 
> > number of splits (in your example: 3) and the algortihm should test all 
> > possible combinations and select the split where the sum differences are 
> > smallest.
> > 
> > Best,
> > Kimmo
> 
> Yes it is, I want example python code for finding my answers but I don't code 
> my answers. please help me.

Awfully sorry but we don't write your code for you.  I suggest that you read 
any Python tutorial and try running code at an interactive prompt, then when 
you run into problems ask a specific question about a specific problem.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie Need Help On Regex!

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 3:58:56 PM UTC+1, infos...@gmail.com wrote:
> Hey guys!
>  
> I am new to learning regex in python and I'm wondering how do I use regex in 
> python to store the integers(positive and negative) i want into a list!
>  
> For e.g.
>  
> This is the data in a list.
>  
> [u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', 
> u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=5,Y=5)', 
> u'\x1b[0m[\x1b[1m\x1b[10m\xbb\x1b[0m\x1b[36m]\x1b[0m : ']
>  
> How do I extract the values of A and B and store them in a variable I want 
> using regex?
>  
> Thank you and appreciate it :)

What makes you think you need a regex?  Why don't you write some code and when 
you have problems, post it here.  Then we'll give you some answers.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread breamoreboy
On Tuesday, October 25, 2016 at 11:02:47 AM UTC+1, BartC wrote:
> On 25/10/2016 07:39, Steven D'Aprano wrote:
> 
> >> I gather that non-blocking keyboard input functions aren't the easiest 
> >> thing
> >> to implement.  They seem to depend on the operating system.  Still, ease of
> >> use is a primary goal of Python, and the need for this feature must be
> >> common.
> >
> >
> > Not really. I think that lots of people think they need it, but once they 
> > write
> > a little utility, they often realise that it's not that useful.
> 
> > If you (generic you, not you specifically) are telling the user "press any 
> > key
> > to continue", then you probably shouldn't. *Any* key may not do anything. 
> > E.g.
> > if the user hits the Shift key. A much better interface is to specify a
> > specific key, and ignore anything else... in which case, why not specify the
> > Enter key?
> >
> > raw_input('Press the Enter key to continue... ')
> 
> Which doesn't work on Python 3. So even here, making it easy by using 
> line-input, it's not so straightforward.
> 

Just get this http://pythonhosted.org/six/ or similar.
-- 
https://mail.python.org/mailman/listinfo/python-list


Why are there so many Python Installers? Windows only :)

2016-11-07 Thread breamoreboy
Hi folks, an interesting blog from Steve Dower giving the history of the little 
beasties http://stevedower.id.au/blog/why-so-many-python-installers/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Why I took October off from OSS volunteering

2016-11-10 Thread breamoreboy
http://www.snarky.ca/why-i-took-october-off-from-oss-volunteering
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to sort this without 'cmp=' in python 3?

2016-10-14 Thread breamoreboy
On Saturday, October 15, 2016 at 12:53:48 AM UTC+1, sohca...@gmail.com wrote:
> On Friday, October 14, 2016 at 4:35:08 PM UTC-7, 38016...@gmail.com wrote:
> > nums=['3','30','34','32','9','5']
> > I need to sort the list in order to get the largest number string: 
> > '953433230'
> > 
> > nums.sort(cmp=lambda a,b: cmp(a+b, b+a), reverse=True)
> > 
> > But how to do this in python 3?
> > 
> > Thank you
> 
> You don't need a lambda in this case.
> 
> Sort the strings in reverse order:
> nums.sort(reverse=True)
> 
> Create a string:
> biggestNum = ''.join(nums)
> 
> Or in a single line, which doesn't change the original value of nums:
> biggestNum = ''.join(sorted(nums, reverse=True))

No, you've made exactly the same mistake that I did :(

>>> nums=['3','30','34','32','9','5']
>>> wants='953433230'
>>> nums.sort(reverse=True)
>>> result = ''.join(nums)
>>> result == wants
False
>>> result
'953432303'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Without compilation, how to find bugs?

2016-10-14 Thread breamoreboy
On Friday, October 14, 2016 at 12:06:36 AM UTC+1, pozz wrote:
> I come from the C language, that is a compiled and strongly typed 
> language.

Python is compiled and dynamically and strongly typed but C is compiled and 
statically and weakly typed.

> 
> All the tricks have a common goal: to discover bugs as soon as possible, 
> mostly during compilation process. Indeed I usually find some bugs 
> during compilation (or static analysis). It seems to me very important.

As others have all ready mentioned there are plenty of static analysis tools 
for Python.

> 
> Now I'm learning Python and it appears to me very simple, but at the 
> same time highly dangerous. For example, I can write a function that 
> accepts two arguments and call it with only one argument. I can execute 
> the script without any problem and I will not notice the bug until I 
> test exactly the erroneous line of code (the call with only one argument).

On the other hand some errors occur far less frequently in Python than in C, 
for example off-by-one, or the memory management being done for you.

> 
> However, I think the language interpreter could emit the error before 
> launching the script even without executing the wrong instruction, 
> because it perfectly knows how many arguments the function wants and 
> that one instruction calls it with a wrong number of arguments.
> 
> Are the things exactly how I understood, or do I miss something in Python?

You've missed plenty but please stick with it, you'll learn :)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Inplace shuffle function returns none

2016-10-18 Thread breamoreboy
On Tuesday, October 18, 2016 at 9:25:19 PM UTC+1, Sayth Renshaw wrote:
> So why can't i assign the result slice to a variable b?
> 
> It just keeps getting none. 
> 
> Sayth

You are misunderstanding something that is fundamental in Python, namely that 
anything that is done inplace *ALWAYS* returns None as a warning that the 
operation has been done inplace, so you're never going to get anything back.  
All you need do is change your original code as follows:-

from random import shuffle

a = [1,2,3,4,5]
shuffle(a)
b = a[:3]
print(b)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: constructor classmethods

2016-11-02 Thread breamoreboy
On Wednesday, November 2, 2016 at 1:47:00 PM UTC, stes...@gmail.com wrote:
> Hi
> 
> I was hoping to canvas opinion on using classmethods as constructors over 
> __init__.
> 
> We've got a colleague who is very keen that __init__ methods don't contain 
> any logic/implementation at all, and if there is any, then it should be moved 
> to a create() classmethod.
> 
> As a concrete example, one change proposed was to go from this:
> 
> ```
> def __init__(self, ...):
> self.queue = Queue.Queue()
> 
> to this:
> 
> def __init__(self, queue):
> self.queue = queue
> 
> @classmethod
> def create(cls, ...):
> return cls(Queue.Queue())
> 
> ```
> 
> The rationale is that it decouples the class from the queue implementation 
> (no evidence or suggestion that we would actually ever want to change impl in 
> this case), and makes testing easier.
> 
> I get the underlying principal, and it's one that a strict OOp approach would 
> suggest, but my gut feeling is that this is not a pythonic approach at all.
> 
> What do people feel about this?
> 
> Thanks
> 
> Steve

I suggest that you read this 
https://docs.python.org/3/reference/datamodel.html#object.__new__ before you do 
anything.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Data base help

2016-10-09 Thread breamoreboy
On Sunday, October 9, 2016 at 7:56:57 PM UTC+1, Risat Haque wrote:
> Hey, i have a data base filled with numbers from a recent drone flight. IT 
> contains, alt, long, lat, and time.
> In python, i want to ask the user to put in a time : 
> askTime = (input("Choose a time (HourMinSec):"))
> 
> With this, I need it to search through the entire data base to find that 
> number. 
> 
> ("UTC: 8:58:24 lat: 50.97 long: -114.05  Alt: 1047.40m  SOG: 1.04 km/h") 
> 
> EX: 
> 
> Choose a time (HourMinSec):8:58:24
> Data: UTC: 8:58:24 lat: 50.97 long: -114.05  Alt: 1047.40m  SOG: 1.04 km/h"
> 
> How can I do this?

I'd use strptime[1] to check the input then search your database, whatever that 
may be, based on that.

[1] https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Function to take the minimum of 3 numbers

2016-10-09 Thread breamoreboy
On Sunday, October 9, 2016 at 2:41:41 PM UTC+1, BartC wrote:
> On 09/10/2016 13:01, Cai Gengyang wrote:
> > I'm moving on to chapter 9 
> > (http://programarcadegames.com/index.php?lang=en=lab_functions) of 
> > programarcadegames for the time being and going back to chapter 8 later 
> > (its just fucking frustrating and doesn't seem to work for the time being 
> > and I have a very bad temper).
> >
> > At least for chapter 9, I got the first part correct at first try --- 
> > define a function that takes and prints the smallest of 3 numbers. I pasted 
> > it here for reference and discussion. The code can also be further modified 
> > to include a clause that says that if two numbers tie for smallest, choose 
> > any of the two numbers. (I will attempt to do it and then post it here 
> > again for future discussion with users here
> >
> >
>  def min3(a, b, c):
> > min3 = a
> > if b < min3:
> > min3 = b
> > if c < min3:
> > min3 = c
> > if b < c:
> > min3 = b
> > return min3
> >
>  print(min3(4, 7, 5))
> > 4
> >
> 
> The exercise says you must use an if/elif chain. The first thing that 
> comes to mind is:
> 
> def min3(a,b,c):
>  if a<=b and a<=c:
>  return a
>  elif b<=a and b<=c:
>  return b
>  else:
>  return c
> 
> The bit about numbers tying for smallest is not meaningful; the caller 
> can't tell if a minimum value of 42 came from a, b or c.
> 
> -- 
> Bartc

The Pythonic way

if b >= a <= c:
...

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread breamoreboy
On Sunday, October 16, 2016 at 12:27:00 PM UTC+1, k.ade...@gmail.com wrote:
> Help me!, I would like to find split where the split sums are close to each 
> other?
> 
> I have a list is
> 
> test = [10,20,30,40,50,60,70,80,90,100]
> 
> ​and I would like to find split where the split sums are close to each other 
> by number of splits = 3 that ​all possible combinations and select the split 
> where the sum differences are smallest.
> 
> Please example code or simple code Python.
> 
> Thank you very much
> 
> K.ademarus

We do not write code for you.  I'd suggest you start here 
https://docs.python.org/3/library/itertools.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to python

2016-10-17 Thread breamoreboy
On Monday, October 17, 2016 at 8:51:52 PM UTC+1, Bill Cunningham wrote:
> I just installed python I might start with 3. But there is version 2 out 
> too. So far I can '3+4' and get the answer. Nice. I typed the linux man page 
> and got a little info. So to learn this language is there an online 
> tutorial? I am interested in the scripting too.
> 
> Bill

If you can all ready program I recommend http://www.diveintopython3.net/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wrong release date in 3.6 whats new docs?

2016-12-14 Thread breamoreboy
On Wednesday, December 14, 2016 at 2:09:22 PM UTC, Nick Sarbicki wrote:
> Afternoon everyone.
> 
> Might be missing something obvious but the 3.6 What's New docs point to the
> release date being the 12th.
> 
> https://docs.python.org/3.6/whatsnew/3.6.html#what-s-new-in-python-3-6
> 
> I got the team excited about Friday's release so that caused some confusion
> here.
> 
> Guessing it's a typo?

Are you confusing the date on which the what's new was updated with the release 
schedule here https://www.python.org/dev/peps/pep-0494/ ?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using namedtuples field names for column indices in a list of lists

2017-01-09 Thread breamoreboy
On Monday, January 9, 2017 at 5:34:12 PM UTC, Tim Chase wrote:
> On 2017-01-09 08:31, breamoreboy wrote:
> > On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
> > > I usually wrap the iterable in something like
> > > 
> > >   def pairwise(it):
> > > prev = next(it)
> > > for thing in it:
> > >   yield prev, thing
> > >   prev = thing
> > 
> > Or from
> > https://docs.python.org/3/library/itertools.html#itertools-recipes:-
> > 
> > def pairwise(iterable):
> > "s -> (s0,s1), (s1,s2), (s2, s3), ..."
> > a, b = tee(iterable)
> > next(b, None)
> > return zip(a, b)
> > 
> > This and many other recipes are available in the more-itertools
> > module which is on pypi. 
> 
> Ah, helpful to not have to do it from scratch each time.  Also, I see
> several others that I've coded up from scratch (particularly the
> partition() and first_true() functions).
> 
> I usually want to make sure it's tailored for my use cases. The above
> pairwise() is my most common use case, but I occasionally want N-wise
> pairing

def ntuplewise(iterable, n=2):
args = tee(iterable, n)
loops = n - 1
while loops:
for _ in range(loops):
next(args[loops], None)
loops -= 1
return zip(*args)

> 
>   s -> (s0,s1,…sN), (s1,s2,…S{N+1}), (s2,s3,…s{N+2}), …
> 
> or to pad them out so either the leader/follower gets *all* of the
> values, with subsequent values being a padding value:
> 
>   # lst = [s0, s1, s2]
>   (s0,s1), (s1, s2), (s2, PADDING)

Use zip_longest instead of zip in the example code above.

>   # or
>   (PADDING, s0), (s0, s1), (s1, s2)

Haven't a clue off of the top of my head and I'm too darn tired to think about 
it :)

> 
> but it's good to have my common cases already coded & tested.
> 
> -tkc

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for WEB-page !?

2017-01-05 Thread breamoreboy
On Thursday, January 5, 2017 at 11:53:51 PM UTC, Victor Porton wrote:
> Ionut Predoiu wrote:
> 
> > I am a beginner in programming language.
> > I want to know what version of Python I must to learn to use, beside of
> > basic language, because I want to integrate in my site 1 page in which
> > users to can made calculus based on my formulas already write behind (the
> > users will only complete some field, and after push "Calculate" button
> > will see the results in form of: table, graphic, and so on ...). Please
> > take into account that behind will be more mathematical
> > equations/formulas, so the speed I think must be take into account.
> 
> Consider PyPi. I never used it, but they say, it is faster than usual 
> CPython interpreter.
> 

Really?  I'd strongly contrast the Python Package Index 
https://pypi.python.org/pypi with the Python implementation pypy at 
http://pypy.org/ :)

> -- 
> Victor Porton - http://portonvictor.org

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-03 Thread breamoreboy
On Tuesday, January 3, 2017 at 8:08:37 PM UTC, Uri Even-Chen wrote:
> Thank you, I'll consider to update our requirements to latest versions of
> all packages. Last time I checked in 22th December 2016 and all our
> requirements were the latest versions. In the meantime we can keep using
> Python 3.5. By the way, Travis CI tests passed with the same requirements
> and Python 3.6 (and 3.5 and 3.4). How did it install the requirements
> there? Does it depend on the operating system?
> 
> I see now that Python 3.6.0 was released on 2016-12-23.
> 
> By the way we use Ubuntu 16.04 in production with Python 3.5.2, so it's not
> that important to support Python 3.6 right now. What are the reasons to
> upgrade Python to 3.6?
> 
> Thanks,
> Uri.
> 
> 
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Website: http://www.speedysoftware.com/uri/en/
>   
>     
> 


Go here http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow to get what you need.

In all my years of downloading from this site I've never, ever had a problem.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


How Best to Coerce Python Objects to Integers?

2017-01-03 Thread breamoreboy
Hi all, I'd suggest that this 
http://blog.pyspoken.com/2017/01/02/how-best-to-coerce-python-objects-to-integers/
 is not one of the greatest articles ever written about Python exception 
handling.  Other opinions are welcome.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using namedtuples field names for column indices in a list of lists

2017-01-09 Thread breamoreboy
On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
> On 2017-01-08 22:58, Deborah Swanson wrote:
> > 1) I have a section that loops through the sorted data, compares two
> > adjacent rows at a time, and marks one of them for deletion if the
> > rows are identical.
> > 
> > I'm using 
> > 
> > for i in range(len(records)-1):
> > r1 = records[i]
> > r2 = records[i+1]
> > if r1.xx = r2.xx:
> > .
> > .
> > and my question is whether there's a way to work with two adjacent
> > rows without using subscripts?  
> 
> I usually wrap the iterable in something like
> 
>   def pairwise(it):
> prev = next(it)
> for thing in it:
>   yield prev, thing
>   prev = thing
> 
>   for prev, cur in pairwise(records):
> compare(prev, cur)
> 
> which I find makes it more readable.
> 
> -tkc

Or from https://docs.python.org/3/library/itertools.html#itertools-recipes:-

def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return zip(a, b)

This and many other recipes are available in the more-itertools module which is 
on pypi.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-06 Thread breamoreboy
On Tuesday, January 3, 2017 at 8:08:37 PM UTC, Uri Even-Chen wrote:
> Thank you, I'll consider to update our requirements to latest versions of
> all packages. Last time I checked in 22th December 2016 and all our
> requirements were the latest versions. In the meantime we can keep using
> Python 3.5. By the way, Travis CI tests passed with the same requirements
> and Python 3.6 (and 3.5 and 3.4). How did it install the requirements
> there? Does it depend on the operating system?
>
> I see now that Python 3.6.0 was released on 2016-12-23.
>
> By the way we use Ubuntu 16.04 in production with Python 3.5.2, so it's not
> that important to support Python 3.6 right now. What are the reasons to
> upgrade Python to 3.6?
>
> Thanks,
> Uri.
>
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Website: http://www.speedysoftware.com/uri/en/
>   
>     
> 


Go here http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow to get what you need.

In all my years of downloading from this site I've never, ever had a problem.

Kindest regards.

Mark Lawrence.

-- 
https://mail.python.org/mailman/listinfo/python-list


How Best to Coerce Python Objects to Integers?

2017-01-06 Thread breamoreboy
Hi all, I'd suggest that this http://blog.pyspoken.com/2017/01/02/how-best-to-c 
oerce-python-objects-to-integers/ is not one of the greatest articles ever 
written about Python exception handling.  Other opinions are welcome.

Kindest regards.

Mark Lawrence.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: When will they fix Python _dbm?

2016-12-06 Thread breamoreboy
On Tuesday, December 6, 2016 at 9:35:19 PM UTC, Ian wrote:
> On Mon, Dec 5, 2016 at 7:45 AM, clvanwall wrote:
> > I have been a Perl programmer for 15+ years and decided to give Python a 
> > try.  My platform is windows and I installed the latest 3.5.2. Next I 
> > decided to convert a perl program that uses a ndbm database since according 
> > to the doc on python, it should be able to work with it.  Needless to say, 
> > I get: dbm.error: db type is dbm.ndbm, but the module is not available
> > Searching on Python Bug Tracker shows _dbm missing back in 03-03-2012!  
> > That's a long time for a bug to be left open.
> 
> Are you referring to http://bugs.python.org/issue14185? That's on
> Linux platforms and it has to do with building Python, not using it.
> 
> The dbm.ndbm documentation specifically says that it provides an
> interface to the *Unix* ndbm library:
> https://docs.python.org/3/library/dbm.html#module-dbm.ndbm. I don't
> think that this module is part of the standard Windows distribution of
> Python. You might be able to find a third-party distribution of the
> module using a Windows port of ndbm, or you could try to build it
> yourself.

How about http://www.gnu.org/software/gdbm/gdbm.html

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 8:33:49 PM UTC+1, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 10:23:27 μ.μ. UTC+3, ο χρήστης 
> bream...@gmail.com έγραψε:
> > On Sunday, March 26, 2017 at 4:11:54 PM UTC+1, Νίκος Βέργος wrote:
> > > Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> > > 
> > > > The database wrapper won't do substitution into the middle of a string
> > > > like that. Either concatenate the literal %'s on in the SQL statement
> > > > or add them to the string before you pass it in, i.e. '%' + domain +
> > > > '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> > > 
> > > I just tried:
> > > 
> > > domain = '.'.join( host.split('.')[-2:] )
> > > domain = '%' + domain + '%'
> > > 
> > > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> > > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> > > ''', 
> > >   
> > >   
> > >   
> > > (pID, domain, ref, 
> > > location, useros, browser, lastvisit, domain) )
> > > 
> > > 
> > > and i received no error in the error_log but
> > > ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> > > manual that corresponds to your MariaDB server version for the right 
> > > syntax to use near '(pagesID, host, ref, location, useros, browser, 
> > > visits) VALUES (1, '%cyta.gr%', ' at line 1")
> > > 
> > > which you can see at http://superhost.gr
> > > 
> > > You said somethign about concatenating the literal % in the SQL to which 
> > > i didnt actually i understand how to implement.
> > 
> > I knew that I had a sense of deja vu about this 
> > https://mail.python.org/pipermail/python-list/2013-June/649809.html
> > 
> > Kindest regards.
> > 
> > Mark Lawrence
> 
> Since i'm incopetent as you suggest i'am show us your level of skills and 
> expertise and provide a solution, otherwise you are also what you claim of me.

*plonk*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 4:11:54 PM UTC+1, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> 
> > The database wrapper won't do substitution into the middle of a string
> > like that. Either concatenate the literal %'s on in the SQL statement
> > or add them to the string before you pass it in, i.e. '%' + domain +
> > '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> 
> I just tried:
> 
> domain = '.'.join( host.split('.')[-2:] )
> domain = '%' + domain + '%'
> 
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> ''', 
>   
>   
>   
> (pID, domain, ref, location, 
> useros, browser, lastvisit, domain) )
> 
> 
> and i received no error in the error_log but
> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> manual that corresponds to your MariaDB server version for the right syntax 
> to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> (1, '%cyta.gr%', ' at line 1")
> 
> which you can see at http://superhost.gr
> 
> You said somethign about concatenating the literal % in the SQL to which i 
> didnt actually i understand how to implement.

I knew that I had a sense of deja vu about this 
https://mail.python.org/pipermail/python-list/2013-June/649809.html

Kindest regards.

Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 3:11:50 PM UTC+1, Ian wrote:
> On Sun, Mar 26, 2017 at 7:39 AM, MeV wrote:
> > On Sunday, March 26, 2017 at 6:34:30 AM UTC-7, Νίκος Βέργος wrote:
> >> with import cgitb; cgitb.enable()
> >>
> >> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> >> manual that corresponds to your MariaDB server version for the right 
> >> syntax to use near '(pagesID, host, ref, location, useros, browser, 
> >> visits) VALUES (1, 'cyta.gr', '' at line 1")
> >>
> >> that is all i get form error. error_log doesnt produce errors when iam 
> >> trying
> >>
> >> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> >> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE %s''',
> >>
> >>
> >>
> >>  (pID, domain, ref, 
> >> location, useros, browser, lastvisit, domain) )
> >>
> >> WHY the valued aren't getting substituted wi the aeguments i give it in to 
> >> work with?
> >
> > The % construct is Python 2 and no longer supported in Python 3. You should 
> > read up on the "{}" and format method.
> >
> > https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting
> 
> Rubbish, it works just fine in Python 3:
> 
> Python 3.6.0 (default, Jan  1 2017, 22:51:19)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> '%s %s' % ('Hello', 'world')
> 'Hello world'
> 
> And contrary to popular belief, it's not even deprecated (although use
> of the newer format method is encouraged). What's more, in this case
> it's part of the PEP 249 DBAPI specification:
> https://www.python.org/dev/peps/pep-0249/#paramstyle. As far as I know
> pymysql and DBAPI libraries in general don't even accept "{}".

There was quite a chat about the issue of deprecated or not 
http://www.gossamer-threads.com/lists/python/dev/969817

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


PyPy2.7 and PyPy3.5 v5.7 - two in one release

2017-03-21 Thread breamoreboy
Hopefully this 
https://morepypy.blogspot.co.uk/2017/03/pypy27-and-pypy35-v57-two-in-one-release.html
 is rather more interesting for some than blatant trolling about spaces vs tabs.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and the need for speed

2017-04-11 Thread breamoreboy
On Tuesday, April 11, 2017 at 2:32:34 PM UTC+1, Steve D'Aprano wrote:
> On Tue, 11 Apr 2017 07:00 pm, breamoreboy wrote:
> 
> > While we're at it how do we go about changing this
> > https://www.python.org/community/lists/ which states that
> > "comp.lang.python is a high-volume Usenet open (not moderated) newsgroup
> > for general discussions and questions about Python."?
> 
> Change it to what, and why?
> 
> As it is, it is correct. comp.lang.python is a high-volume Usenet
> unmoderated newsgroup for general discussions related to Python.
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

So we should be welcoming back the RUE who I see is still spewing his bile?  
What exactly do Tim Golden and Ethan Furman moderate on?  You can be pedantic 
about what is a newsgroup, or mailing list, or whatever, but to me they're one 
and the same thing.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Temporary variables in list comprehensions

2017-04-02 Thread breamoreboy
On Sunday, April 2, 2017 at 1:08:17 AM UTC+1, Robert L. wrote:

> I don't believe in western morality, i.e. don't kill civilians or children
> The only way to fight a moral war is the Jewish way: Destroy their holy sites.
> Kill men, women, and children (and cattle). --- Rabbi Manis Friedman
> web.archive.org/web/20090605154706/http://www.momentmag.com/Exclusive/2009/2009-06/200906-Ask_Rabbis.html
> archive.org/download/DavidDukeVideo/TheZionistMatrixOfPowerddhd.ogv

Completely agree with Steven D'Aprano so would the moderators please ban Robert 
L with immediate effect.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make use of .egg files?

2017-04-05 Thread breamoreboy
On Wednesday, April 5, 2017 at 2:00:41 PM UTC+1, David Shi wrote:
> Can anyone explain please.
> Regards.
> David

Egg files are old, wheels are the new thing http://pythonwheels.com/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: read in a list in a file to list

2017-04-08 Thread breamoreboy
On Saturday, April 8, 2017 at 7:32:52 PM UTC+1, john polo wrote:
> Hi,
> 
> I am using Python 3.6 on Windows 7.
> 
> I have a file called apefile.txt. apefile.txt's contents are:
> 
> apes =  "Home sapiens", "Pan troglodytes", "Gorilla gorilla"
> 
> I have a script:
> 
> apefile =  open("apefile.txt")
> apelist =  apefile.read()
> for ape in apelist:
> print("one of the apes is " + ape)
> apefile.close()
> 
> The output from the script does not print the ape names, instead it 
> prints each letter in the file. For example:
> 
> one of the apes is a
> one of the apes is p
> one of the apes is e
> 
> What should I do instead to get something like
> 
> one of the apes is Home sapiens
> one of the apes is Pan troglodytes
> one of the apes is Gorilla gorilla
>  
> John

I'll start you off.

with open("apefile.txt") as apefile:
for line in apefile:
doSomething(line)

String methods and/or the csv module might be used here in doSomething(line), 
but I'll leave that to you so that you can learn.  If you get stuck please ask 
again, we don't bite :)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and the need for speed

2017-04-10 Thread breamoreboy
On Monday, April 10, 2017 at 1:25:48 PM UTC+1, Mikhail V wrote:
> 
> Still I miss some old school features in Python, e.g. "goto" statement would
> be very useful in some cases. I know it is considered bad style
> to use goto, but in some cases it is just most natural thing to use.
> 

http://entrian.com/goto/
https://pypi.python.org/pypi/goto-statement

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python and the need for speed

2017-04-08 Thread breamoreboy
I've an idea that http://www.mos6581.org/python_need_for_speed is a week late 
for April Fool's but just in case I'm sure that some of you may wish to comment.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and the need for speed

2017-04-11 Thread breamoreboy
On Tuesday, April 11, 2017 at 9:26:14 AM UTC+1, Tim Golden wrote:
> On 11/04/2017 00:33, Chris Angelico wrote:
> > If he does, it might be the final thing that gets him banned from the
> > mailing list.
> 
> A meta-note, since I happen to have seen this email come up.
> 
> I don't know about the other list moderators, but I don't personally 
> follow every sprawling thread and post on the look-out for offensive 
> behaviour. Can I suggest, if anyone believes that there is a case for 
> suspending someone from the list, that they email the List Owner whose 
> address is at the bottom of:
> 
>https://mail.python.org/mailman/listinfo/python-list
> 
> and point out the behaviour they believe merits suspension or a warning 
> or whatever. We can then confer between ourselves and decide what action 
> to take.
> 
> Thanks
> 
> TJG

While we're at it how do we go about changing this 
https://www.python.org/community/lists/ which states that "comp.lang.python is 
a high-volume Usenet open (not moderated) newsgroup for general discussions and 
questions about Python."?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Command Line Arguments

2017-04-17 Thread breamoreboy
On Friday, April 14, 2017 at 2:44:09 PM UTC+1, Bernd Nawothnig wrote:
> On 2017-04-13, Jason Friedman wrote:
> >> I have this code which I got from https://www.tutorialspoint.
> >> com/python/python_command_line_arguments.htm The example works fine but
> >> when I modify it to what I need, it only half works. The problem is the
> >> try/except. If you don't specify an input/output, they are blank at the end
> >> but it shouldn't be.
> >>
> >> import getopt
> >> import sys
> >
> > I am guessing you are wanting to parse command-line arguments rather than
> > particularly wanting to use the getopt module.
> > If I am correct you might want to spend your time instead learning the
> > argparse module:
> > https://docs.python.org/3/library/argparse.html
> > https://docs.python.org/3/howto/argparse.html
> 
> He should switch to argparse in any case because getopt is no longer
> supported and does only receive bugfixes.
> 
> Bernd
> 
> -- 
> Die Antisemiten vergeben es den Juden nicht, dass die Juden ‘Geist’
> haben – und Geld. Die Antisemiten – ein Name der
> ‘Schlechtweggekommenenen’ [Friedrich Nietzsche]

optparse is deprecated, not getopt.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Command Line Arguments

2017-04-17 Thread breamoreboy
On Saturday, April 15, 2017 at 6:45:51 PM UTC+1, Grant Edwards wrote:
> On 2017-04-14, Bernd Nawothnig wrote:
> 
> > He should switch to argparse in any case because getopt is no longer
> > supported and does only receive bugfixes.
> 
> In my book, "receiving bug fixes" means it's still supported.
> 
> --
> Grant

Just to reinforce what I said before, optparse is deprecated, not getopt.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regular Expressions, Speed, Python, and NFA

2017-04-17 Thread breamoreboy
On Friday, April 14, 2017 at 4:12:27 PM UTC+1, Malik Rumi wrote:
> I am running some tests using the site regex101 to figure out the correct 
> regexs to use for a project. I was surprised at how slow it was, constantly 
> needing to increase the timeouts. I went Googling for a reason, and solution, 
> and found Russ Cox’s article from 2007: 
> https://swtch.com/~rsc/regexp/regexp1.html . I couldn’t understand why, if 
> this was even remotely correct, we don’t use NFA in Python, which led me here:
> 
> https://groups.google.com/forum/#!msg/comp.lang.python/L1ZFI_R2hAo/C12Nf3patWIJ;context-place=forum/comp.lang.python
>  where all of these issues were addressed. Unfortunately, this is also from 
> 2007. 
> 
> BTW, John Machin in one of his replies cites Navarro’s paper, but that link 
> is broken. Navarro’s work can now be found at 
> http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.21.3112=rep1=pdf
>  But be forewarned, it is 68 pages of dense reading. I am not a computer 
> science major. I am not new to Python, but I don’t think I’m qualified to 
> take on the idea of creating a new NFA module for Python.  
> 
> I am not a computer science major. I am not new to Python, but I don’t think 
> I’m qualified to take on the idea of creating a new NFA module for Python.  
> Nor am I entirely sure I want to try something new (to me) like TRE. 
> 
> Most threads related to this topic are older than 2007. I did find this 
> https://groups.google.com/forum/#!searchin/comp.lang.python/regex$20speed%7Csort:relevance/comp.lang.python/O7rUwVoD2t0/NYAQM0mUX7sJ
>  from 2011 but I did not do an exhaustive search. 
> 
> The bottom line is I wanted to know if anything has changed since 2007, and 
> if there is a) any hope for improving regex speeds in Python, or b) some 3rd 
> party module/library that is already out there and solves this problem? Or 
> should I just take this advice?
> 
> 
> Thanks.

Check out https://pypi.python.org/pypi/regex and for a little light background 
reading please see http://bugs.python.org/issue2636

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderating the list [was: Python and the need for speed]

2017-04-17 Thread breamoreboy
On Thursday, April 13, 2017 at 10:31:22 AM UTC+1, Tim Golden wrote:
> On 13/04/2017 03:39, Jason Friedman wrote:
> >>
> >> However, it's simply a technical fact: the thing which we moderate is the
> >>> mailing list. We can control which posts make it through from the 
> >>> newsgroup
> >>> by blocking them at the gateway. But the posts will continue to appear on
> >>> comp.lang.python which is, as the description says, unmoderated.
> >>>
> >>
> >> TJG
> >
> >
> > Thank you, Tim and Ethan and the other moderators, for performing that
> > function.
> > It makes the reading experience more pleasant for me.
> >
> 
> I looked, for the first time in a long while, at the GG mirror of the 
> newsgroup. Hadn't realised how much of that really nasty all-caps spam 
> we were blocking. (We set up some gateway rules when that started to 
> become a problem so we just don't see it on the mailing list).
> 
> Most of the time we're just binning run-of-the-mill spam. Doesn't take 
> too much effort if you keep on top of it, but it piles up quickly enough 
> if you leave it for a bit!
> 
> TJG

I routinely set all of the upper-case crap to "violent content" on GG just as a 
matter of principle.  There's even been a couple of English versions lately but 
the filters have stopped them, well done :-)

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hi! i need some help with a program in python on Raspberry pi3.

2017-04-17 Thread breamoreboy
On Friday, April 14, 2017 at 3:27:29 PM UTC+1, Kasper wrote:
> every time i run the program i get this messeage:
> 
> Traceback (most recent call last):
>   File "smartmirror.py", line 159, in get_weather
> temprature2 = "%S%S" % (str(int(weather_obj['currently']['temperature'])),
> degree_sign)
> KeyError: 'currently'
> Error: 'currently'. Cannot get weather.
> 
> How do i fix that?
> 
> Here is the program:
> 
> r = requests.get(weather_req_url)
> weather_obj = json.loads(r.text)
> 
> degree_sign= u'\N{DEGREE SIGN}'
> temperature2 = "%s%s" % 
> (str(int(weather_obj['currently']['temperature'])), degree_sign)

Find the correct name for the key by printing out `weather_obj`.  At least I 
think so, as the line above does not match the line that you've given.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bigotry (you win, I give up)

2017-04-21 Thread breamoreboy
On Friday, April 21, 2017 at 10:08:08 AM UTC+1, Antoon Pardon wrote:
> Op 20-04-17 om 17:25 schreef Rustom Mody:
> > But more importantly thank you for your polite and consistent pointing out 
> > to
> > Ben Finney that his religion-bashing signature lines [many of them] and his 
> > claims to wish this list be welcoming are way out of sync.
> 
> I don't know. I think a concept like welcoming is too complex, to draw such
> simple conclusions. First of all we have to make a choice about the public we
> want to be welcoming to. I'm rather confident we can agree we don't want to
> be welcoming to bigots on this list.
> 
> Then feeling welcome is not a boolean, people can feel welcome to a different
> degree and there are many factors at work. If people tend to react in a 
> friendly
> manner to there co-participants, people generally should feel welcome. A 
> statment
> in a signature that isn't addressing anyone personnaly may give rise to some
> irritation but shouldn't make this list feel unwelcome to someone.
> 
> Do you think critising any idea in one's signature is enough to conclude that
> this person doesn't wish this list to be welcoming?
> 
> -- 
> Antoon.

Talking of signatures another of Robert L's beauties landed three or so hours 
ago.  He really is a right little charmer :-(

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bigotry (you win, I give up)

2017-04-21 Thread breamoreboy
On Friday, April 21, 2017 at 2:33:03 PM UTC+1, Ethan Furman wrote:
> On 04/21/2017 03:38 AM, breamoreboy wrote:
> 
> > Talking of signatures another of Robert L's beauties landed three or so 
> > hours ago.  He really is a right little charmer :-(
> 
> Not on the Python Mailing List.
> 
> --
> ~Ethan~

I'm seen one message this morning via gmane.comp.python.general but that and a 
few more can be seen on GG.  I'm pretty thick skinned but I find the signatures 
completely revolting.  Keep him out please!!!

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Read a text file into a Pandas DataFrame Table

2017-04-13 Thread breamoreboy
On Thursday, April 13, 2017 at 9:15:18 AM UTC+1, David Shi wrote:
> Dear All,
> Can anyone help to read a text file into a Pandas DataFrame Table?
> Please see the link below.
> http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22=sequence_release=text
> 
> Regards.
> David

http://pandas.pydata.org/pandas-docs/stable/io.html#io-read-csv-table
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Reading structured text file (non-CSV) into Pandas Dataframe

2017-04-13 Thread breamoreboy
On Thursday, April 13, 2017 at 11:09:23 AM UTC+1, David Shi wrote:
> http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22=sequence_release=text
> The above is a web link to a structured text file.  It is not a CSV.
> How can this text file be read into a Pandas Dataframe, so that further 
> processing can be made?
> Looking forward to hearing from you.
> Regards.
> David

http://pandas.pydata.org/pandas-docs/stable/io.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Rawest raw string literals

2017-04-20 Thread breamoreboy
On Thursday, April 20, 2017 at 4:59:48 PM UTC+1, Grant Edwards wrote:
> On 2017-04-20, Mikhail V wrote:
> > Quite often I need raw string literals for concatenating console commands.
> > I want to input them exactly as they are in python sources.
> >
> > There is r"" string, but it is obviously not enough because e.g. this:
> > s = r"ffmpeg -i  "\\server-01\D\SER_Bigl.mpg" "
> 
>s = r'ffmpeg -i  "\\server-01\D\SER_Bigl.mpg" '
> 
> Does that do what you want?
> 
> -- 
> Grant Edwards   grant.b.edwardsYow! And then we could sit
>   at   on the hoods of cars at
>   gmail.comstop lights!

I find this:-

s = r"ffmpeg -i  '\\server-01\D\SER_Bigl.mpg' "

vastly superior.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Looping [was Re: Python and the need for speed]

2017-04-17 Thread breamoreboy
On Tuesday, April 18, 2017 at 2:09:19 AM UTC+1, Paul Rubin wrote:
> Ben Bacarisse writes:
> > ?  I get "AttributeError: 'itertools.dropwhile' object has no attribute
> > 'next'" from your example.
> 
> Hmm, .next() worked ok for me in Python 2.7.5.  Not sure what happened.
> Maybe something went wrong with my paste.  Oh well.
> 

PEP 3114 -- Renaming iterator.next() to iterator.__next__() 
https://www.python.org/dev/peps/pep-3114/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bigotry (you win, I give up)

2017-04-19 Thread breamoreboy
On Thursday, April 20, 2017 at 12:41:58 AM UTC+1, Ethan Furman wrote:
> On 04/19/2017 03:58 PM, Ben Finney wrote:
> > Ethan Furman writes:
> >
> >> […] asking that you be courteous to those who come here to discuss
> >> Python.
> >
> > On that we can agree. Let's be courteous to people here, and keep
> > discussing Python.
> 
> Will you be filtering your signature lines, then?  Because you cannot 
> simultaneously be courteous to someone and mock 
> their beliefs.
> 
> --
> ~Ethan~

This is getting ludicrous.  Ben has been using these signatures for years and 
nobody has said a word.  Why is it that somebody deliberately starts a thread 
to cause trouble when there is nothing at all to discuss, the moderators leap 
in, but when people like the RUE keep spewing their crap it takes years to get 
something done?  Please don't give me the nonsense about "the RUE wasn't 
directly attacking anybody".  He was attacking the entire community with his 
highly insulting dross, and especially the person responsible for writing PEP 
393 and its inplementation.  By the way he's still at it.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to obtain an up-to-date document of tkinter

2017-04-19 Thread breamoreboy
On Thursday, April 20, 2017 at 1:09:45 AM UTC+1, Mok-Kong Shen wrote:
> How could one obtain an up-to-date document of tkinter. I ask this
> question because apparently there are stuffs of tkinter that
> worked in Python 3.5 but no longer in Python 3.6.1.
> 
> M. K. Shen

https://docs.python.org/3/library/tkinter.html

Can you please state what worked in 3.5 but doesn't in 3.6?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: spam issue

2017-03-02 Thread breamoreboy
On Thursday, March 2, 2017 at 4:08:44 PM UTC, Andrew Zyman wrote:
> Why is this group have such an obscene number of spam posts ?
> I'm subscribed to a few other google groups and this is the only one that has 
> this issue.

The bulk having lots of block capitals and in Italian?  Been happening for 
years.  Just use gmane, gives you access to hundreds of Python lists and 
thousands of others in one hit.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Elastic Search

2017-04-07 Thread breamoreboy
On Friday, April 7, 2017 at 9:16:51 PM UTC+1, Keith Anthony wrote:
> I need some insightful examples of elastic search, using REGEX ...
> And using REST.

What was wrong with the hits that you got from your search engine of choice?

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bigotry and hate speech on the python mailing list

2017-04-17 Thread breamoreboy
On Monday, April 17, 2017 at 10:11:58 AM UTC+1, Rurpy wrote:
> A couple weeks ago a frequent poster here (Steve D'Aprano) called another 
> participant an "ugly american" [*1].  This was followed just a couple weeks 
> later with another post from Mr. D'Aprano attacking a participant as "an old 
> man" who can't understand new technology, a blatant example of ageism [*2].
> 
> The PSF's Diversity statement [*3] explicitly calls out "age" and "national 
> origin" as examples of personal attributes NOT to be used as verbal weapons.  
> It is also neither "considerate" or "respectful" as described in the PSF Code 
> of Conduct [*4] to use national origin or age to attack someone.  In both 
> cases it is reasonable to believe that some Americans or older people will, 
> after reading Mr. D'Aprano's posts, feel uncomfortable posting to this list 
> or responding to Mr. D'Aprano specifically on other issues, because they 
> might well be attacked on the same grounds.  Further, failure to censure Mr. 
> D'Apano's comments communicates that bigotry is acceptable here which 
> understandably would give pause to members of other groups often subject to 
> bigotry.
> 
> I posted a message in objection [*5] that got no response, I would like to 
> think because it got lost in a long thread, not because bigotry is acceptable 
> here and the CoC is just window dressing.
> 
> I also believe the PSF is registered in the US as a tax exempt organization 
> which means it has a legal obligation not to permit discrimination against 
> people based on national origin or age (and other distinctions).
> 
> Would someone from the PSF please publicly clarify exactly why the two cases 
> cited are being treated as acceptable discourse in this list?
> 
> I am not trying to create a controversy for its own sake; when I first 
> started reading this list many years ago I was appalled by rudeness displayed 
> to newcomers coupled with instant anger by the regulars towards non-regulars 
> at the slightest hint of rudeness (even imagined) towards them.  A decade 
> later things have not changed much.  If I posted a remark about "dirty 
> Chinese" (c.f. "ugly American") I would be (justifiably) slammed and likely 
> ejected from the list.  Or if claims that not understanding new tech is a 
> product of age are ok, then why can't I say disparagingly that someone 
> "programs like a girl"?  When a popular poster here says such things, it is 
> not only given a pass, it is actually defended!  
> 
> I am not personally in favor of censorship; the best response to hate speech 
> is a reasoned counter argument IMO.  But if you are going to have a CoC, it 
> must be applied even-handedly.  You cannot apply it when you want to 
> unpopular posters and ignore it when it comes to a one of the clique of 
> regulars.
> 
> 
> [*1] https://mail.python.org/pipermail/python-list/2017-April/720531.html
> [*2] https://mail.python.org/pipermail/python-list/2017-April/721106.html
> [*3] https://www.python.org/community/diversity/
> [*4] https://www.python.org/psf/codeofconduct/
> [*5] https://mail.python.org/pipermail/python-list/2017-April/721135.html

As William Shakespeare put it "Much Ado About Nothing".

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to do pd.read_csv with consecutive spaces or semi-colon as delimiters?

2017-04-18 Thread breamoreboy
On Tuesday, April 18, 2017 at 10:25:51 AM UTC+1, David Shi wrote:
> Any way to do that?
> The link to a sample dataset is as follows:
> http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22=sequence_release=text
> Looking forward to hearing from you.
> Regards.
> David

After less than one minute searching I found 
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html.  
It's the last time I do this for you as your repeated questions show no attempt 
at trying anything for yourself.  You haven't even had the common courtesy to 
respond when I have given you links in response to those questions.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   >