RE: does the order in which the modules are placed in a file matters ?

2015-12-16 Thread Dan Strohl
ches using "as" etc...) Note, using * is dis-recommended, though pretty often done, for more information on using *, see: https://docs.python.org/2/tutorial/modules.html#importing-from-a-package Dan Strohl -Original Message- From: Python-list [mailto:python-list-bounces+d

RE: Question on keyword arguments

2016-02-18 Thread Dan Strohl
there a large enough benefit in processing that you want to be able to use it multiple ways without having to regenerate the list. (note that this is the last criteria, unless performance is really critical, readability and predictability is normally much more important than what is prob

RE: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread Dan Strohl
Disadvantages of python... (compared to VB) That's a hard one, but here are my thoughts: (keep in mind that these kinds of discussions are subjective and much is based on the background and experience of the coder, these are also assuming that 100% of your audience is on windows, as soon as yo

RE: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread Dan Strohl
I totally agree with Chris here, try it out, do some simpler things to get your feet wet before committing to redoing hundreds of thousands of lines of code in it. Find a few of the "deal breakers" and try to solve them in Python (create a hello world app in python, then package it in an exe an

RE:

2016-03-01 Thread Dan Strohl
I am sorry, though I have to say that I would find it hard working with a large snake every day as well. Luckily, there is a programing language (called Python) that could help in developing a snake removing application pretty easily. If, however you are actually talking about the programming

python PEP suggestion

2015-11-08 Thread Dan Strohl
at this point to see if it resonates... (or if it falls flat and goes "splat" ). Thoughts? Dan Strohl New special method name to allow for more flexible object type casting/access, and extend type() to cast objects using this special method name. Overview: Have a new special m

RE: Script to extract text from PDF files

2015-11-08 Thread Dan Strohl
Its possible (likely) that I came into this in the middle, so sorry if this was already thrown out... but have you looked at any of the following suggestions? https://pypi.python.org/pypi?%3Aaction=search&term=pdf+convert&submit=search http://stackoverflow.com/questions/6413441/python-pdf-library

RE: python PEP suggestion

2015-11-10 Thread Dan Strohl
p? Dan -Original Message- From: Python-list [mailto:python-list-bounces+d.strohl=f5@python.org] On Behalf Of Terry Reedy Sent: Sunday, November 08, 2015 2:27 PM To: python-list@python.org Subject: Re: python PEP suggestion On 11/6/2015 1:21 PM, Dan Strohl wrote: > All, > >

RE: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
The best bet (unless you know that you are outputting to a specific place, like html or excel) is to always include the "https://"; or "http://"; since most of the consoles / terminals that support clickable links are parsing them based on "seeing" the initial "http://";. If your output just lo

RE: Re: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
Keeping mind how this all works... Python is providing the data, the console/terminal/app handles how that data is displayed. There is no specification for text output to be hyperlinked (that I know about at least), so while some apps may handle specific coding to tell them that "this text s

RE: Clickable hyperlinks

2017-01-05 Thread Dan Strohl via Python-list
The best bet (unless you know that you are outputting to a specific place, like html or excel) is to always include the "https://"; or "http://"; since most of the consoles / terminals that support clickable links are parsing them based on "seeing" the initial "http://";. If your output just lo

RE: Re: Clickable hyperlinks

2017-01-05 Thread Dan Strohl via Python-list
Keeping mind how this all works... Python is providing the data, the console/terminal/app handles how that data is displayed. There is no specification for text output to be hyperlinked (that I know about at least), so while some apps may handle specific coding to tell them that "this text sho

RE: Request for comments: use-cases for delayed evaluation

2018-05-17 Thread Dan Strohl via Python-list
I could easily see using all of the examples; I run into this pretty regularly. What about something like the following (which, honestly is really a combination of other examples). If I have a function that has multiple parameters, each of which might be expensive, but it might break out ear

RE: why does list's .remove() does not return an object?

2018-05-17 Thread Dan Strohl via Python-list
the objects as well for lookups, or a number of other techniques, but it would be easier to simply get it back during the remove(). Dan Strohl -- https://mail.python.org/mailman/listinfo/python-list

RE: "Data blocks" syntax specification draft

2018-05-21 Thread Dan Strohl via Python-list
thout having a totally different parser engine just for that, and there are lots of corner cases that would break this approach and would need a different approach, requiring a long list of caveats, and at least personally, I just don't see the value there. The few places where it seems like it would be a benefit are pretty small, and the places where it makes things more complex seem common. Dan Strohl -- https://mail.python.org/mailman/listinfo/python-list

RE: "Data blocks" syntax specification draft

2018-05-22 Thread Dan Strohl via Python-list
> -Original Message- > > I think it would be appropriate to propose an alternative to TQS for this > specific purposes. Namely for making it easier to implement parsers and > embedded syntaxes. > > So what do I have now with triple quoted strings - a simple example: > > if 1: > s =

RE: "Data blocks" syntax specification draft

2018-05-23 Thread Dan Strohl via Python-list
First of all, I suggest splitting this into a separate proposal (new thread) that way you will avoid confusion for people who are still considering the older proposal, and for the (probably many) people who have stopped reding the old thread due to some of the more heated conversations in there.

RE: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-23 Thread Dan Strohl via Python-list
> > > Personally though, I would not hard code it to knock out 4 leading > > spaces. I would have it handle spaces the same was that the existing > > parser does, if there are 4 spaces indending the next line, then it > > removes 4 spaces, if there are 6 spaces, it removes 6 spaces, etc... > >

RE: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-23 Thread Dan Strohl via Python-list
> > How about we instead just use the rules from PEP 257 so that there aren't two > different sets of multi-line string indentation rules to have to remember? > > https://www.python.org/dev/peps/pep-0257/#handling-docstring-indentation > I like that, better to be closer to the existing stand

RE: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-31 Thread Dan Strohl via Python-list
> This is of course not a problem if the *trailing* quote determines the > indentation: > > a_multi_line_string = i''' >Py- > thon > ''' I get the point, but it feels like it would be a pain to use, and it "Feels" different from the other python indenting, which

Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
yes, I know I could simply not do [] and always do my_list('item1', 'item2', 'item3'] I am envisioning something in the header like an import statement where I could do; override str=my_string override list=my_list This would only be scoped to the current module

RE: Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
> > > > I am envisioning something in the header like an import statement > > where I could do; > > > > override str=my_string > > override list=my_list > > > > This would only be scoped to the current module and would not be > imported when that

RE: Indented multi-line strings

2018-06-01 Thread Dan Strohl via Python-list
ndent or outdent, so this would clean up those pieces. So... how does one go about suggesting changes to the built in types? I could take a whack at the code for it, but my C skills are no where near what should probably be needed for something this close to the core of the language. I'm not sure if adding a couple of methods is a PEP type of thing. Dan Strohl -- https://mail.python.org/mailman/listinfo/python-list

RE: Indented multi-line strings

2018-06-01 Thread Dan Strohl via Python-list
> > It would probably have to go via python-ideas, but if it gets the OK there I > doubt it would need a PEP. > Cool, thanks! > There are a few key questions I'd expect to see come up. > > Why does this need to be a string method? Why can't it be a standalone > function? Maybe you should publi

RE: Indented multi-line strings

2018-06-04 Thread Dan Strohl via Python-list
> > > No-one is saying a method is *worse* than a standalone function - they are > just saying it's *not sufficiently better* to justify creating a string > method that > replicates an existing stdlib function. > What about performance? I would expect a string method to perform better than a

RE: syntax difference (type hints)

2018-06-18 Thread Dan Strohl via Python-list
> -Original Message- > From: Python-list On > Behalf Of Schachner, Joseph > Sent: Monday, June 18, 2018 7:58 AM > To: Ed Kellett ; python-list@python.org > Subject: RE: syntax difference (type hints) > > EXTERNAL MAIL: python-list-bounces+d.strohl=f5@python.org > > Assuming that we

RE: __init__ patterns

2018-08-30 Thread Dan Strohl via Python-list
I will put imports into my __init__ files, so that I can import things from the module directly instead of having to import from a file in the module. I almost never put code in the __init__'s, I have a couple of times put in something that was designed to modify which routine was imported (i.e.

RE: how to setup for localhost:8000

2016-04-14 Thread Dan Strohl via Python-list
If you got an empty page with no errors (and no warnings trying to get there...) it is likely that your server is working, and you are trying to access it correctly, but the server is not serving anything. Most of the time, if the server is not present, you will get a timeout error saying the b

RE: How to print a part of a string?

2016-04-15 Thread Dan Strohl via Python-list
As with lots of things in python, there are lots of ways of approaching this, here are some hints for you to think about (in no particular order): - REGEX - replace() - string[:y] - split() And of course, you could consider creating a table with every possible string that could start with "ABC

RE: Controlling the passing of data

2016-04-28 Thread Dan Strohl via Python-list
ore (and more useful) help you are likely to receive. To this lists credit, even if you are completely unclear in your question, you will likely get *something* back, (as you saw with Peters response), but what you get back is more likely to be a general suggestion rather than a specific fix fo

RE: online python courses

2016-04-28 Thread Dan Strohl via Python-list
I've heard good things about codeacademy.com and learnpython.org. Also, I've heard that pycharm educational edition is helpful. (https://www.jetbrains.com/pycharm-edu/ ) I haven't personally tried any of these though, so your mileage may vary. Good Luck! Dan Strohl

RE: Controlling the passing of data

2016-04-28 Thread Dan Strohl via Python-list
If I am reading this correctly... you have something like (you will have to excuse my lack of knowledge about what kinds of information these actually are): 1234 first 5678 second And you want something like: nominations = [(1,1234), (2,5678)] meetings = [(1,'first')

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
I would suggest using argparse https://docs.python.org/3/library/argparse.html as it handles all of that natively... including validating arguments, showing errors, help, etc... however, assuming you don't want to; Send it to stdout, that allows the user to redirect it if they want to (and play

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
From: John Wong [mailto:gokoproj...@gmail.com] Sent: Thursday, April 28, 2016 10:06 AM To: Dan Strohl Cc: alister ; python-list@python.org Subject: Re: What should Python apps do when asked to show help? On Thu, Apr 28, 2016 at 1:02 PM, Dan Strohl via Python-list mailto:python-list@python.org

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
I would hesitate to take this approach unless the tool was one that only I was going to be using, and I knew exactly what environments it was going to be in. I know that many of the system items in python work differently in different operating systems, and different os's report things different

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
Yup.. another reason to use something like argparse... you define the argument descriptions, help, and when you raise an error, it automatically handles the output, sending it to the right place (stderr/stdout)... as well as allowing you to define different levels of verbosity easily... (or not

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
github.com/madprime/python-gedcom/blob/master/gedcom/__init__.py) at the end of the file you can see they defined __str__() in the ELEMENT object, but there is no definition for __repr__(), which matches what we surmised above. If you want to fix it by editing the gedcom library, you could si

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
> I added a __repr__ method at the end of the gedcom library like so: > > def __repr__(self): > """ Format this element as its original string """ > result = repr(self.level()) > if self.pointer() != "": > result += ' ' + self.pointer() > result += ' '

RE: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Dan Strohl via Python-list
> > One other point for you, if your "__repr__(self)" code is the same as > > the "__str__(self)" code (which it looks like it is, at a glance at > > least), you can instead reference the __str__ method and save having a > > duplicate code block... > > Alternatively, consider: the ‘__repr__’ metho

RE: Wanted Python programmer to join team

2016-05-16 Thread Dan Strohl via Python-list
> My team is getting more projects that it can handle so we are looking for > Python programers to join. You will be given tasks to complete full or part of > the project. > > Skype: piefektas > > Contact me now with short description about yourself, your skills and > projects you have worked on.

RE: reduction

2016-05-31 Thread Dan Strohl via Python-list
> My problem. I have lists of substrings associated to values: > > ['a','b','c','g'] => 1 > ['a','b','c','h'] => 1 > ['a','b','c','i'] => 1 > ['a','b','c','j'] => 1 > ['a','b','c','k'] => 1 > ['a','b','c','l'] => 0 # <- Black sheep!!! > ['a','b','c','m'] => 1 > ['a','b','c','n'] => 1 > ['a','b','

RE: Encapsulation in Python

2016-03-10 Thread Dan Strohl via Python-list
Theory, each approaches it in its own way, and each has its own benefits and challenges. This is a perfectly valid question (and a good one), but don’t let yourself get into the trap of feeling that Java is the definitive/best/only approach to OO (or Python for that matter, or C++, or whatever!). Dan Strohl > > Regards, > > Ben Mezger > > [1] - http://stackoverflow.com/q/4555932 -- https://mail.python.org/mailman/listinfo/python-list

RE: Replace weird error message?

2016-03-19 Thread Dan Strohl via Python-list
Actually, I think that was the complete code... give it a try... "{:02}".format("1") produces the error listed. I agree the error is not very clear, since the "=" was not passed, it seems like an incorrect error. What about something like: "ValueError: '=' and '0' padding are not allowed in s

RE: Users of namedtuple: do you use the _source attribute?

2017-07-17 Thread Dan Strohl via Python-list
I have never used it personally. It always looked interesting, but I never ran into a need to generate the source for it. -Original Message- From: Python-list [mailto:python-list-bounces+d.strohl=f5@python.org] On Behalf Of Steve D'Aprano Sent: Monday, July 17, 2017 9:58 AM To: pyth

RE: Best way to assert unit test cases with many conditions

2017-07-18 Thread Dan Strohl via Python-list
Ganesh; I'm not 100% sure what you are trying to do.. so let me throw out a few things I do and see if that helps... If you are trying to run a bunch of similar tests on something, changing only (or mostly) in the parameters passed, you can use self.subTest(). Like this: Def test_this(self):