New answers tagged

2

No. The key word here is "nonexclusive" license. It means that you're granting them the right to distribute your code, (which is the entire point of putting it up on a package manager,) without setting up any sort of exclusive deal or transfer of rights with them. And as the license is to distribute your code, rather than to use it, it doesn't conflict ...


0

In the interest of making information available to anyone in the future, my current solution is having a socket.io server running, which connects over a socket to a python script. the socket.io server just relays information between the two and is capable of handling multiple clients whereas a python only solution would not handle multiple clients without me ...


0

I've found an answer I'm somewhat happy with. I don't think it's possible to have a front-end interface that controls the execution of continuous loops on Heroku, but I did find an app called Nezumi which allows you to run functions and control Heroku processes from your phone. What I ended up doing was I made a file run.py in my root directory of a Django ...


1

I'm sure the type specifications could be used to greatly speed up the runtime […] No, they can't. The definition of an optional type system is that it does not impact the runtime behavior in any way. That's what makes it "optional" in the first place. If adding or removing types made the program change its behavior, the types wouldn't be optional. Note ...


2

I don't know whether TypeScript enforces type constraints at compile or run time. But Python does support type hints. Python 3.0 introduced function annotations as defined in PEP 3107. They work like this: def log_in(login: 'Login', password: 'Password') -> 'Return value': # ... log_in.func_annotation['login'] # => 'Login' log_in.func_annotation[...


1

Don't think too much about Pip. If your Setuptools configuration works correctly, it's easy enough to upload all and only those files you actually want to PyPI (at which point end users will be able to install it with Pip; developers will be cloning your git repository since they need history for things like git bisect to work, and Pip does not provide git ...


0

Move the configuration parameters to a back end database, and create the web UI to manipulate those settings which the script reads in each iteration (in case the parameters have been changed) For part 3, start looking at the twitter API and the various python wrappers that are out there. To improve the frequency that the script executes for each account, ...


4

I think a very maintainable way would be to define functions that take a tweet and return a boolean like this: def has_terms(*terms): return lambda tweet: any(term in tweet['text'] for term in terms) def complex_rule(tweet): return 'boo' in tweet['text'] and not any(y in tweet['text'] for y in no_words) Then you can set up your list of rules ...


7

The authoritative reason is because PEP-8 says so: Comparisons to singletons like None should always be done with is or is not, never the equality operators. Thus, if you ever find yourself in dire need of comparing exactly to True or False, you should also use is. Remember: in cases like these, 'truthiness' is generally preferred over comparison to ...


2

Standard input and standard output seems to be the simple overlooked answer (or maybe I'm not understanding the problem). For anyone reading this now, stdin and stdout is the simplest way for two applications to communicate. The main application can spawn a different process and send messages through stdin and stdout. It's simple, direct, and fast. However, ...


4

Jeff Bezanson's PhD thesis on Julia, "Abstraction in Technical Computing" discusses this question at length, reaching only partial answers. Here are key quotes. We propose that technical users crave the flexibility to pick notation for their problems, and language design — the highest level of abstraction — is where you go when you need this level of ...


0

why does it need run in Raspberry Pi instead of proper server? I think parallel processing capabilities are quite limited. Anyway, here are my idea, I don't know if these works in Raspberry Pi. First step, parameterize the python script so a command-line argument specify which user should be run. Second, make the web app manipulates cron entries, so each ...


0

If the amount of data that needs to be passed is small, then for an OS X application, one can run some Python code via a system() shell command from Swift or Objective C code. For iOS, unless you want to build a Python interpreter into your app, it may be best to push running the Python library and scripts to a server "in the cloud".


0

A big thing to consider is that once a language is "settled" a lot of it comes set in stone. A lot of time and resources are spent making software in that language. And in a lot of cases, once software is done, it's done and only small maintenance remains to be done. You can't sell: "hey you need to change all the software you made because we introduced ...


5

Generally when someone refers to a programming language as scientific it is either because there are useful libraries for use in that field or the syntax of the language makes it easy to write the required algorithms. However, just because one field considers a particular language as a scientific does not mean that a different field considers it the same. ...


2

Money. Cheaper developers, faster development speeds, and less bugs equal more money. Portability. Many high level languages allow you to target different platforms out of the box. Low level languages like C require significant efforts run on multiple platforms. Training. You can train a developer in Python in a day, while something like C++ takes ...


24

"Besides the fact that a higher level language is easier to code in and therefore less error prone" I really think this is a good enough reason all by itself. If you have no compelling reason to work in a low level of abstraction (such as performance, knowledge in the team, etc), then there is no reason to do it. If all you want is a coffee, then you want ...


1

Higher lever languages are by definition easier to learn, they take away a lot of the complexities of lower level programming such as memory management. Besides that since the explosion of hardware power it is much cheaper to get a faster processor or more RAM into a machine that paying the developer hours that'd come with a more complex programming language....


0

As long as performance isn't massively important to you you could always run it in Brython which effectively puts it in the JavaScript sandbox


1

The problem you currently face with a simple HTTP post simply cannot be solved in that protocol. HTTP works asynchronously in strict client/server so there is no server-side notification and no native cancel. Also, you will face the problem of answers lost because of internet network timeouts. I will suggest a different and modern approach. Disclaimer : a ...


4

It mostly depends on how deep are your changes. Wrappers can bring additional behavior, but can rarely change the existing one. For instance, if a target library writes some data to a file and you want, instead, to send this data to a database, unless the library was designed to allow that, you won't be able to change the behavior just with a wrapper. If ...


1

I think you missed probably the more important part of the book's corrected example. The more fundamental change to the code is from the method operating on all values in a list to operating on one element. There already exist functions like iter (in this case named pipeline_foreach) which perform a given operation on all elements in a list. There was no ...


-1

Looking at published code fragments, importing entire modules and referring to module.function is pretty much the standard, at least for standard modules. The one exception seems to be datetime from datetime import datetime, timedelta so you can say datetime.now() rather than datetime.datetime.now(). If you are concerned about performance, you can always ...


1

As a general, largely language agnostic approach, any time you're concerned that the behavior of a third party library might change, the providing of that behavior (be it your own code in the future, or another third party library) might change, or you simply want to decouple the third party library, it's perfectly reasonable to build a more abstracted ...



Top 50 recent answers are included